BLE transmit and receive success

This commit is contained in:
2025-06-26 01:41:18 +08:00
parent 331d7dedb7
commit 59f65128b0
29 changed files with 8421 additions and 7601 deletions

View File

@@ -33,10 +33,10 @@
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
#define BLE_RX_THREAD_STACK_SIZE 1024
#define BLE_RX_THREAD_STACK_SIZE 2048
#define BLE_RX_THREAD_PRIORITY 10
#define BLE_TX_THREAD_STACK_SIZE 1024
#define BLE_TX_THREAD_STACK_SIZE 2048
#define BLE_TX_THREAD_PRIORITY 10
/* USER CODE END PD */
@@ -58,8 +58,7 @@ UCHAR ble_rx_stack[BLE_RX_THREAD_STACK_SIZE];
TX_THREAD ble_tx_thread;
UCHAR ble_tx_stack[BLE_TX_THREAD_STACK_SIZE];
#define BLE_TX_QUEUE_DEPTH 4
UCHAR ble_tx_queue_buffer[BLE_TX_QUEUE_DEPTH * sizeof(BLE_Message)];
@@ -82,42 +81,13 @@ UCHAR ble_tx_queue_buffer[BLE_TX_QUEUE_DEPTH * sizeof(BLE_Message)];
*/
UINT App_ThreadX_Init(VOID *memory_ptr)
{
// UINT ret = TX_SUCCESS;
/* USER CODE BEGIN App_ThreadX_MEM_POOL */
UINT status;
//初始化BLE接收任务
// 初始化 BLE 接收任务
status = tx_thread_create(&ble_rx_thread, "BLE RX Thread",
ble_rx_task_entry, 0,
ble_rx_stack, BLE_RX_THREAD_STACK_SIZE,
BLE_RX_THREAD_PRIORITY, BLE_RX_THREAD_PRIORITY,
TX_NO_TIME_SLICE, TX_AUTO_START);
if (status != TX_SUCCESS) {
return status;
}
// 创建 BLE TX 线程
status = tx_thread_create(&ble_tx_thread, "BLE TX Thread",
ble_tx_task_entry, 0,
ble_tx_stack, BLE_TX_THREAD_STACK_SIZE,
BLE_TX_THREAD_PRIORITY, BLE_TX_THREAD_PRIORITY,
TX_NO_TIME_SLICE, TX_AUTO_START);
if (status != TX_SUCCESS) return status;
// ✅ 创建 BLE TX 消息队列
status = tx_queue_create(&ble_tx_queue, "BLE TX Queue",
sizeof(BLE_Message)/sizeof(ULONG),
ble_tx_queue_buffer,
sizeof(ble_tx_queue_buffer));
if (status != TX_SUCCESS) return status;
/* USER CODE END App_ThreadX_MEM_POOL */
/* USER CODE BEGIN App_ThreadX_Init */
/* USER CODE END App_ThreadX_Init */
HCBle_SendData("进入 App_ThreadX_Init\r\n");
return TX_SUCCESS;
return TX_SUCCESS;
}
/**
* @brief Function that implements the kernel's initialization.
* @param None