File a2dp_sink/main/main.c changed (mode: 100644) (index 6e700e2..9cdef49) |
22 |
22 |
#include "nvs_flash.h" |
#include "nvs_flash.h" |
23 |
23 |
#include "esp_system.h" |
#include "esp_system.h" |
24 |
24 |
#include "esp_log.h" |
#include "esp_log.h" |
|
25 |
|
#include "esp_timer.h" |
|
26 |
|
#include "soc/rtc.h" |
25 |
27 |
|
|
26 |
28 |
#include "esp_bt.h" |
#include "esp_bt.h" |
27 |
29 |
#include "bt_app_core.h" |
#include "bt_app_core.h" |
|
... |
... |
enum { |
44 |
46 |
/* handler for bluetooth stack enabled events */ |
/* handler for bluetooth stack enabled events */ |
45 |
47 |
static void bt_av_hdl_stack_evt(uint16_t event, void *p_param); |
static void bt_av_hdl_stack_evt(uint16_t event, void *p_param); |
46 |
48 |
|
|
|
49 |
|
#if 0 |
|
50 |
|
rtc_xtal_freq_t rtc_clk_xtal_freq_get(); |
|
51 |
|
uint32_t rtc_clk_slow_freq_get_hz(); |
|
52 |
|
rtc_fast_freq_t rtc_clk_fast_freq_get(); |
|
53 |
|
rtc_cpu_freq_t rtc_clk_cpu_freq_get(); |
|
54 |
|
uint32_t rtc_clk_cpu_freq_value(rtc_cpu_freq_t cpu_freq); |
|
55 |
|
uint32_t rtc_clk_apb_freq_get(); |
|
56 |
|
uint64_t rtc_time_get(); |
|
57 |
|
#endif |
|
58 |
|
|
|
59 |
|
static void periodic_timer_callback(void* arg) |
|
60 |
|
{ |
|
61 |
|
static uint32_t testTick = 0; |
|
62 |
|
++testTick; |
|
63 |
|
ESP_LOGI(BT_AV_TAG, "This is a timer callback,"\ |
|
64 |
|
"xtal:%u, slow:%u, cpu:%u, apb:%u, rtctime:%llu, time:%llu %u", |
|
65 |
|
rtc_clk_xtal_freq_get(), |
|
66 |
|
rtc_clk_slow_freq_get_hz(), |
|
67 |
|
rtc_clk_cpu_freq_value(rtc_clk_cpu_freq_get()), |
|
68 |
|
rtc_clk_apb_freq_get(), |
|
69 |
|
rtc_time_get(), |
|
70 |
|
esp_timer_get_time(), |
|
71 |
|
testTick); |
|
72 |
|
} |
47 |
73 |
|
|
48 |
74 |
void app_main() |
void app_main() |
49 |
75 |
{ |
{ |
|
76 |
|
const esp_timer_create_args_t periodic_timer_args = { |
|
77 |
|
.callback = &periodic_timer_callback, |
|
78 |
|
/* name is optional, but may help identify the timer when debugging */ |
|
79 |
|
.name = "periodic" |
|
80 |
|
}; |
|
81 |
|
|
|
82 |
|
esp_timer_handle_t periodic_timer; |
|
83 |
|
ESP_ERROR_CHECK(esp_timer_create(&periodic_timer_args, &periodic_timer)); |
|
84 |
|
/* The timer has been created but is not running yet */ |
|
85 |
|
|
|
86 |
|
ESP_ERROR_CHECK(esp_timer_start_periodic(periodic_timer, 500000)); |
|
87 |
|
|
50 |
88 |
fifo_init(); |
fifo_init(); |
51 |
89 |
|
|
52 |
90 |
/* Initialize NVS — it is used to store PHY calibration data */ |
/* Initialize NVS — it is used to store PHY calibration data */ |