renamed app core
This commit is contained in:
4
ESP32/.vscode/settings.json
vendored
4
ESP32/.vscode/settings.json
vendored
@@ -14,6 +14,8 @@
|
|||||||
"idf.toolsPathWin": "C:\\Users\\ms\\.espressif",
|
"idf.toolsPathWin": "C:\\Users\\ms\\.espressif",
|
||||||
"idf.flashType": "UART",
|
"idf.flashType": "UART",
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"esp_log.h": "c"
|
"esp_log.h": "c",
|
||||||
|
"h2201_app.h": "c",
|
||||||
|
"h2201_a2dp.h": "c"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
idf_component_register(SRCS "H2201_avrcp.c" "H2201_a2dp.c" "H2201_i2s.c"
|
idf_component_register(SRCS "h2201_app.c" "H2201_avrcp.c" "H2201_a2dp.c" "H2201_i2s.c"
|
||||||
"bt_app_core.c"
|
|
||||||
"main.c"
|
"main.c"
|
||||||
INCLUDE_DIRS ".")
|
INCLUDE_DIRS ".")
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#include "sys/lock.h"
|
#include "sys/lock.h"
|
||||||
|
|
||||||
#include "bt_app_core.h"
|
#include "H2201_app.h"
|
||||||
#include "H2201_i2s.h"
|
#include "H2201_i2s.h"
|
||||||
#include "H2201_a2dp.h"
|
#include "H2201_a2dp.h"
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ void h2201_a2dp_callback(esp_a2d_cb_event_t event, esp_a2d_cb_param_t *param)
|
|||||||
case ESP_A2D_AUDIO_CFG_EVT:
|
case ESP_A2D_AUDIO_CFG_EVT:
|
||||||
case ESP_A2D_PROF_STATE_EVT:
|
case ESP_A2D_PROF_STATE_EVT:
|
||||||
{
|
{
|
||||||
bt_app_work_dispatch(h2201_a2dp_eventhandler, event, param, sizeof(esp_a2d_cb_param_t), NULL);
|
h2201_app_work_dispatch(h2201_a2dp_eventhandler, event, param, sizeof(esp_a2d_cb_param_t), NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#include "sys/lock.h"
|
#include "sys/lock.h"
|
||||||
|
|
||||||
#include "bt_app_core.h"
|
#include "H2201_app.h"
|
||||||
#include "H2201_avrcp.h"
|
#include "H2201_avrcp.h"
|
||||||
#include "H2201_i2s.h"
|
#include "H2201_i2s.h"
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ void h2201_avrcp_controller_callback(esp_avrc_ct_cb_event_t event, esp_avrc_ct_c
|
|||||||
case ESP_AVRC_CT_REMOTE_FEATURES_EVT:
|
case ESP_AVRC_CT_REMOTE_FEATURES_EVT:
|
||||||
case ESP_AVRC_CT_GET_RN_CAPABILITIES_RSP_EVT:
|
case ESP_AVRC_CT_GET_RN_CAPABILITIES_RSP_EVT:
|
||||||
{
|
{
|
||||||
bt_app_work_dispatch(h2201_avrcp_controller_eventhandler, event, param, sizeof(esp_avrc_ct_cb_param_t), NULL);
|
h2201_app_work_dispatch(h2201_avrcp_controller_eventhandler, event, param, sizeof(esp_avrc_ct_cb_param_t), NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -77,7 +77,7 @@ void h2201_avrcp_target_callback(esp_avrc_tg_cb_event_t event, esp_avrc_tg_cb_pa
|
|||||||
case ESP_AVRC_TG_SET_ABSOLUTE_VOLUME_CMD_EVT:
|
case ESP_AVRC_TG_SET_ABSOLUTE_VOLUME_CMD_EVT:
|
||||||
case ESP_AVRC_TG_REGISTER_NOTIFICATION_EVT:
|
case ESP_AVRC_TG_REGISTER_NOTIFICATION_EVT:
|
||||||
case ESP_AVRC_TG_SET_PLAYER_APP_VALUE_EVT:
|
case ESP_AVRC_TG_SET_PLAYER_APP_VALUE_EVT:
|
||||||
bt_app_work_dispatch(h2201_avrcp_target_eventhandler, event, param, sizeof(esp_avrc_tg_cb_param_t), NULL);
|
h2201_app_work_dispatch(h2201_avrcp_target_eventhandler, event, param, sizeof(esp_avrc_tg_cb_param_t), NULL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ESP_LOGE(H2201_AVRCP_TG_TAG, "Invalid AVRC event: %d", event);
|
ESP_LOGE(H2201_AVRCP_TG_TAG, "Invalid AVRC event: %d", event);
|
||||||
|
|||||||
@@ -7,18 +7,19 @@
|
|||||||
#include "freertos/queue.h"
|
#include "freertos/queue.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "bt_app_core.h"
|
//#include "driver/i2s.h"
|
||||||
#include "driver/i2s.h"
|
//#include "freertos/ringbuf.h"
|
||||||
#include "freertos/ringbuf.h"
|
|
||||||
|
|
||||||
static void bt_app_task_handler(void *arg);
|
#include "H2201_app.h"
|
||||||
static bool bt_app_send_msg(bt_app_msg_t *msg);
|
|
||||||
static void bt_app_work_dispatched(bt_app_msg_t *msg);
|
static void h2201_app_task(void *arg);
|
||||||
|
static bool h2201_app_send_msg(bt_app_msg_t *msg);
|
||||||
|
static void h2201_app_work_dispatched(bt_app_msg_t *msg);
|
||||||
|
|
||||||
static xQueueHandle s_bt_app_task_queue = NULL;
|
static xQueueHandle s_bt_app_task_queue = NULL;
|
||||||
static xTaskHandle s_bt_app_task_handle = NULL;
|
static xTaskHandle s_bt_app_task_handle = NULL;
|
||||||
|
|
||||||
bool bt_app_work_dispatch(bt_app_cb_t p_cback, uint16_t event, void *p_params, int param_len, bt_app_copy_cb_t p_copy_cback)
|
bool h2201_app_work_dispatch(bt_app_cb_t p_cback, uint16_t event, void *p_params, int param_len, bt_app_copy_cb_t p_copy_cback)
|
||||||
{
|
{
|
||||||
ESP_LOGD(BT_APP_CORE_TAG, "%s event 0x%x, param len %d", __func__, event, param_len);
|
ESP_LOGD(BT_APP_CORE_TAG, "%s event 0x%x, param len %d", __func__, event, param_len);
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@ bool bt_app_work_dispatch(bt_app_cb_t p_cback, uint16_t event, void *p_params, i
|
|||||||
|
|
||||||
if (param_len == 0)
|
if (param_len == 0)
|
||||||
{
|
{
|
||||||
return bt_app_send_msg(&msg);
|
return h2201_app_send_msg(&msg);
|
||||||
}
|
}
|
||||||
else if (p_params && param_len > 0)
|
else if (p_params && param_len > 0)
|
||||||
{
|
{
|
||||||
@@ -43,14 +44,14 @@ bool bt_app_work_dispatch(bt_app_cb_t p_cback, uint16_t event, void *p_params, i
|
|||||||
{
|
{
|
||||||
p_copy_cback(&msg, msg.param, p_params);
|
p_copy_cback(&msg, msg.param, p_params);
|
||||||
}
|
}
|
||||||
return bt_app_send_msg(&msg);
|
return h2201_app_send_msg(&msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool bt_app_send_msg(bt_app_msg_t *msg)
|
static bool h2201_app_send_msg(bt_app_msg_t *msg)
|
||||||
{
|
{
|
||||||
if (msg == NULL)
|
if (msg == NULL)
|
||||||
{
|
{
|
||||||
@@ -65,7 +66,7 @@ static bool bt_app_send_msg(bt_app_msg_t *msg)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bt_app_work_dispatched(bt_app_msg_t *msg)
|
static void h2201_app_work_dispatched(bt_app_msg_t *msg)
|
||||||
{
|
{
|
||||||
if (msg->cb)
|
if (msg->cb)
|
||||||
{
|
{
|
||||||
@@ -73,7 +74,7 @@ static void bt_app_work_dispatched(bt_app_msg_t *msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bt_app_task_handler(void *arg)
|
static void h2201_app_task(void *arg)
|
||||||
{
|
{
|
||||||
bt_app_msg_t msg;
|
bt_app_msg_t msg;
|
||||||
for (;;)
|
for (;;)
|
||||||
@@ -84,7 +85,7 @@ static void bt_app_task_handler(void *arg)
|
|||||||
switch (msg.sig)
|
switch (msg.sig)
|
||||||
{
|
{
|
||||||
case BT_APP_SIG_WORK_DISPATCH:
|
case BT_APP_SIG_WORK_DISPATCH:
|
||||||
bt_app_work_dispatched(&msg);
|
h2201_app_work_dispatched(&msg);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ESP_LOGW(BT_APP_CORE_TAG, "%s, unhandled sig: %d", __func__, msg.sig);
|
ESP_LOGW(BT_APP_CORE_TAG, "%s, unhandled sig: %d", __func__, msg.sig);
|
||||||
@@ -99,14 +100,14 @@ static void bt_app_task_handler(void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bt_app_task_start_up(void)
|
void h2201_app_task_startup(void)
|
||||||
{
|
{
|
||||||
s_bt_app_task_queue = xQueueCreate(10, sizeof(bt_app_msg_t));
|
s_bt_app_task_queue = xQueueCreate(10, sizeof(bt_app_msg_t));
|
||||||
xTaskCreate(bt_app_task_handler, "BtAppT", 3072, NULL, configMAX_PRIORITIES - 3, &s_bt_app_task_handle);
|
xTaskCreate(h2201_app_task, "BtAppT", 3072, NULL, configMAX_PRIORITIES - 3, &s_bt_app_task_handle);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bt_app_task_shut_down(void)
|
void h2201_app_task_shutdown(void)
|
||||||
{
|
{
|
||||||
if (s_bt_app_task_handle)
|
if (s_bt_app_task_handle)
|
||||||
{
|
{
|
||||||
@@ -31,10 +31,10 @@ typedef void (*bt_app_copy_cb_t)(bt_app_msg_t *msg, void *p_dest, void *p_src);
|
|||||||
/**
|
/**
|
||||||
* @brief work dispatcher for the application task
|
* @brief work dispatcher for the application task
|
||||||
*/
|
*/
|
||||||
bool bt_app_work_dispatch(bt_app_cb_t p_cback, uint16_t event, void *p_params, int param_len, bt_app_copy_cb_t p_copy_cback);
|
bool h2201_app_work_dispatch(bt_app_cb_t p_cback, uint16_t event, void *p_params, int param_len, bt_app_copy_cb_t p_copy_cback);
|
||||||
|
|
||||||
void bt_app_task_start_up(void);
|
void h2201_app_task_startup(void);
|
||||||
|
|
||||||
void bt_app_task_shut_down(void);
|
void h2201_app_task_shutdown(void);
|
||||||
|
|
||||||
#endif /* __BT_APP_CORE_H__ */
|
#endif /* __BT_APP_CORE_H__ */
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
#include "esp_avrc_api.h"
|
#include "esp_avrc_api.h"
|
||||||
#include "driver/i2s.h"
|
#include "driver/i2s.h"
|
||||||
|
|
||||||
#include "bt_app_core.h"
|
#include "H2201_app.h"
|
||||||
#include "H2201_avrcp.h"
|
#include "H2201_avrcp.h"
|
||||||
#include "H2201_a2dp.h"
|
#include "H2201_a2dp.h"
|
||||||
|
|
||||||
@@ -110,10 +110,10 @@ void app_main(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* create application task */
|
/* create application task */
|
||||||
bt_app_task_start_up();
|
h2201_app_task_startup();
|
||||||
|
|
||||||
/* Bluetooth device name, connection mode and profile set up */
|
/* Bluetooth device name, connection mode and profile set up */
|
||||||
bt_app_work_dispatch(bt_av_hdl_stack_evt, BT_APP_EVT_STACK_UP, NULL, 0, NULL);
|
h2201_app_work_dispatch(bt_av_hdl_stack_evt, BT_APP_EVT_STACK_UP, NULL, 0, NULL);
|
||||||
|
|
||||||
//#if (CONFIG_BT_SSP_ENABLED == true)
|
//#if (CONFIG_BT_SSP_ENABLED == true)
|
||||||
/* Set default parameters for Secure Simple Pairing */
|
/* Set default parameters for Secure Simple Pairing */
|
||||||
@@ -135,7 +135,7 @@ void app_main(void)
|
|||||||
// esp_bt_gap_set_pin(pin_type, 4, pin_code);
|
// esp_bt_gap_set_pin(pin_type, 4, pin_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bt_app_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param)
|
void h2201_gap_register_callback(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param)
|
||||||
{
|
{
|
||||||
switch (event)
|
switch (event)
|
||||||
{
|
{
|
||||||
@@ -190,7 +190,7 @@ static void bt_av_hdl_stack_evt(uint16_t event, void *p_param)
|
|||||||
char *dev_name = "ESP_SPEAKER";
|
char *dev_name = "ESP_SPEAKER";
|
||||||
esp_bt_dev_set_device_name(dev_name);
|
esp_bt_dev_set_device_name(dev_name);
|
||||||
|
|
||||||
esp_bt_gap_register_callback(bt_app_gap_cb);
|
esp_bt_gap_register_callback(h2201_gap_register_callback);
|
||||||
|
|
||||||
/* initialize AVRCP controller */
|
/* initialize AVRCP controller */
|
||||||
esp_avrc_ct_init();
|
esp_avrc_ct_init();
|
||||||
|
|||||||
Reference in New Issue
Block a user