ESP32

ESP32, TIMER, esp_timer

CoyoteUgly 2018. 8. 22. 17:41

ESP32, TIMER, esp_timer


  • us 단위로 timer를 설정합니다.
  • esp_timer_get_time() 함수를 부팅 이후 동작 시간을 확인할 수 있습니다.
  • esp_sleep_enable_timer_wakeup(), esp_light_sleep_start() 함수를 통해 조금 더 정확하게 delay를 줄  수 있습니다.

0. 참고 사이트


1. 모듈


2. 보드 연결


3. 소스 설명

주요 API는 다음 Header를 참고하면 됩니다.
  • esp-idf\components\esp32\include\esp_timer.h
  • esp-idf\components\esp32\include\esp_sleep.h

4. 소스

https://github.com/sglee0223/esp32/tree/master/esp_timer


5. 결과 확인


I (0) cpu_start: App cpu up.
I (210) heap_init: Initializing. RAM available for dynamic allocation:
I (217) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (223) heap_init: At 3FFB3328 len 0002CCD8 (179 KiB): DRAM
I (229) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (236) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (242) heap_init: At 400899FC len 00016604 (89 KiB): IRAM
I (248) cpu_start: Pro cpu start user code
I (266) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (268) ESP_TIMER: Started timers, time since boot: 2353 us
periodic            500000        502341          1          0             0
one-shot                 0       5002346          1          0             0

I (768) ESP_TIMER: Periodic timer called, time since boot: 502387 us
I (1268) ESP_TIMER: Periodic timer called, time since boot: 1002364 us
I (1768) ESP_TIMER: Periodic timer called, time since boot: 1502364 us
I (2268) ESP_TIMER: Periodic timer called, time since boot: 2002364 us
periodic            500000       2502341          1          4           555
one-shot                 0       5002346          1          0             0

I (2768) ESP_TIMER: Periodic timer called, time since boot: 2502367 us
I (3268) ESP_TIMER: Periodic timer called, time since boot: 3002364 us
I (3768) ESP_TIMER: Periodic timer called, time since boot: 3502364 us
I (4268) ESP_TIMER: Periodic timer called, time since boot: 4002364 us
periodic            500000       4502341          1          8          1070
one-shot                 0       5002346          1          0             0

I (4768) ESP_TIMER: Periodic timer called, time since boot: 4502367 us
I (5268) ESP_TIMER: Periodic timer called, time since boot: 5002362 us
I (5268) ESP_TIMER: One-shot timer called, time since boot: 5002484 us
I (5268) ESP_TIMER: Restarted periodic timer with 1s period, time since boot: 5005715 us
I (6268) ESP_TIMER: Periodic timer called, time since boot: 6005732 us
periodic           1000000       7005710          2         11          1458
one-shot                 0             0          1          1         11994

I (7268) ESP_TIMER: Periodic timer called, time since boot: 7005736 us
I (8268) ESP_TIMER: Periodic timer called, time since boot: 8005732 us
periodic           1000000       9005710          2         13          1723
one-shot                 0             0          1          1         11994

I (9268) ESP_TIMER: Periodic timer called, time since boot: 9005736 us
I (10268) ESP_TIMER: Periodic timer called, time since boot: 10005732 us
I (10278) ESP_TIMER: Entering light sleep for 0.5s, time since boot: 10011541 us
I (10278) ESP_TIMER: Woke up from light sleep, time since boot: 10511997 us
I (10768) ESP_TIMER: Periodic timer called, time since boot: 11005736 us
I (11768) ESP_TIMER: Periodic timer called, time since boot: 12005732 us
I (12278) ESP_TIMER: Stopped and deleted timers 


'ESP32' 카테고리의 다른 글

ESP32, NVS, nvs_rw_value  (0) 2018.08.23
ESP32, NVS 이해하기  (0) 2018.08.22
ESP32, GPIO, gpio_intr  (0) 2018.08.22
ESP32, Bluetooth, ble_spp_server, ble_spp_client  (0) 2018.08.21
ESP32, Wi-Fi, smart_config  (0) 2018.08.21