generated from Template/H563ZI-HAL-CMake-Template
替换\n结尾,replace with $
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -152,82 +152,18 @@
|
|||||||
<Bp>
|
<Bp>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
<Type>0</Type>
|
<Type>0</Type>
|
||||||
<LineNumber>97</LineNumber>
|
<LineNumber>162</LineNumber>
|
||||||
<EnabledFlag>1</EnabledFlag>
|
<EnabledFlag>1</EnabledFlag>
|
||||||
<Address>134229406</Address>
|
<Address>134296028</Address>
|
||||||
<ByteObject>0</ByteObject>
|
<ByteObject>0</ByteObject>
|
||||||
<HtxType>0</HtxType>
|
<HtxType>0</HtxType>
|
||||||
<ManyObjects>0</ManyObjects>
|
<ManyObjects>0</ManyObjects>
|
||||||
<SizeOfObject>0</SizeOfObject>
|
<SizeOfObject>0</SizeOfObject>
|
||||||
<BreakByAccess>0</BreakByAccess>
|
<BreakByAccess>0</BreakByAccess>
|
||||||
<BreakIfRCount>1</BreakIfRCount>
|
<BreakIfRCount>1</BreakIfRCount>
|
||||||
<Filename>../Core/Src/app_threadx.c</Filename>
|
<Filename>..\fun\HCBle.c</Filename>
|
||||||
<ExecCommand></ExecCommand>
|
<ExecCommand></ExecCommand>
|
||||||
<Expression>\\AutoGuideStick\../Core/Src/app_threadx.c\97</Expression>
|
<Expression>\\AutoGuideStick\../fun/HCBle.c\162</Expression>
|
||||||
</Bp>
|
|
||||||
<Bp>
|
|
||||||
<Number>1</Number>
|
|
||||||
<Type>0</Type>
|
|
||||||
<LineNumber>0</LineNumber>
|
|
||||||
<EnabledFlag>1</EnabledFlag>
|
|
||||||
<Address>134229670</Address>
|
|
||||||
<ByteObject>0</ByteObject>
|
|
||||||
<HtxType>0</HtxType>
|
|
||||||
<ManyObjects>0</ManyObjects>
|
|
||||||
<SizeOfObject>0</SizeOfObject>
|
|
||||||
<BreakByAccess>0</BreakByAccess>
|
|
||||||
<BreakIfRCount>1</BreakIfRCount>
|
|
||||||
<Filename></Filename>
|
|
||||||
<ExecCommand></ExecCommand>
|
|
||||||
<Expression></Expression>
|
|
||||||
</Bp>
|
|
||||||
<Bp>
|
|
||||||
<Number>2</Number>
|
|
||||||
<Type>0</Type>
|
|
||||||
<LineNumber>93</LineNumber>
|
|
||||||
<EnabledFlag>1</EnabledFlag>
|
|
||||||
<Address>0</Address>
|
|
||||||
<ByteObject>0</ByteObject>
|
|
||||||
<HtxType>0</HtxType>
|
|
||||||
<ManyObjects>0</ManyObjects>
|
|
||||||
<SizeOfObject>0</SizeOfObject>
|
|
||||||
<BreakByAccess>0</BreakByAccess>
|
|
||||||
<BreakIfRCount>0</BreakIfRCount>
|
|
||||||
<Filename>../Core/Src/app_threadx.c</Filename>
|
|
||||||
<ExecCommand></ExecCommand>
|
|
||||||
<Expression></Expression>
|
|
||||||
</Bp>
|
|
||||||
<Bp>
|
|
||||||
<Number>3</Number>
|
|
||||||
<Type>0</Type>
|
|
||||||
<LineNumber>95</LineNumber>
|
|
||||||
<EnabledFlag>1</EnabledFlag>
|
|
||||||
<Address>0</Address>
|
|
||||||
<ByteObject>0</ByteObject>
|
|
||||||
<HtxType>0</HtxType>
|
|
||||||
<ManyObjects>0</ManyObjects>
|
|
||||||
<SizeOfObject>0</SizeOfObject>
|
|
||||||
<BreakByAccess>0</BreakByAccess>
|
|
||||||
<BreakIfRCount>0</BreakIfRCount>
|
|
||||||
<Filename>../Core/Src/app_threadx.c</Filename>
|
|
||||||
<ExecCommand></ExecCommand>
|
|
||||||
<Expression></Expression>
|
|
||||||
</Bp>
|
|
||||||
<Bp>
|
|
||||||
<Number>4</Number>
|
|
||||||
<Type>0</Type>
|
|
||||||
<LineNumber>95</LineNumber>
|
|
||||||
<EnabledFlag>1</EnabledFlag>
|
|
||||||
<Address>0</Address>
|
|
||||||
<ByteObject>0</ByteObject>
|
|
||||||
<HtxType>0</HtxType>
|
|
||||||
<ManyObjects>0</ManyObjects>
|
|
||||||
<SizeOfObject>0</SizeOfObject>
|
|
||||||
<BreakByAccess>0</BreakByAccess>
|
|
||||||
<BreakIfRCount>0</BreakIfRCount>
|
|
||||||
<Filename>startup_stm32h563xx.s</Filename>
|
|
||||||
<ExecCommand></ExecCommand>
|
|
||||||
<Expression></Expression>
|
|
||||||
</Bp>
|
</Bp>
|
||||||
</Breakpoint>
|
</Breakpoint>
|
||||||
<WatchWindow1>
|
<WatchWindow1>
|
||||||
|
|||||||
Binary file not shown.
@@ -27,10 +27,6 @@ Project File Date: 06/26/2025
|
|||||||
<h2>Output:</h2>
|
<h2>Output:</h2>
|
||||||
*** Using Compiler 'V6.21', folder: 'D:\keil5\ARM\ARMCLANG\Bin'
|
*** Using Compiler 'V6.21', folder: 'D:\keil5\ARM\ARMCLANG\Bin'
|
||||||
Build target 'AutoGuideStick'
|
Build target 'AutoGuideStick'
|
||||||
compiling app_threadx.c...
|
|
||||||
linking...
|
|
||||||
Program Size: Code=83340 RO-data=1604 RW-data=16 ZI-data=11520
|
|
||||||
FromELF: creating hex file...
|
|
||||||
"AutoGuideStick\AutoGuideStick.axf" - 0 Error(s), 0 Warning(s).
|
"AutoGuideStick\AutoGuideStick.axf" - 0 Error(s), 0 Warning(s).
|
||||||
|
|
||||||
<h2>Software Packages used:</h2>
|
<h2>Software Packages used:</h2>
|
||||||
@@ -55,7 +51,7 @@ Package Vendor: Keil
|
|||||||
|
|
||||||
* Component: ARM::CMSIS:CORE@5.6.0
|
* Component: ARM::CMSIS:CORE@5.6.0
|
||||||
Include file: CMSIS/Core/Include/tz_context.h
|
Include file: CMSIS/Core/Include/tz_context.h
|
||||||
Build Time Elapsed: 00:00:08
|
Build Time Elapsed: 00:00:00
|
||||||
</pre>
|
</pre>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
Dependencies for Project 'AutoGuideStick', Target 'AutoGuideStick': (DO NOT MODIFY !)
|
Dependencies for Project 'AutoGuideStick', Target 'AutoGuideStick': (DO NOT MODIFY !)
|
||||||
CompilerVersion: 6210000::V6.21::ARMCLANG
|
CompilerVersion: 6210000::V6.21::ARMCLANG
|
||||||
F (startup_stm32h563xx.s)(0x685D3117)(--target=arm-arm-none-eabi -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -mfloat-abi=hard -masm=auto -Wa,armasm,--diag_suppress=A1950W -c
|
F (startup_stm32h563xx.s)(0x685D3117)(--target=arm-arm-none-eabi -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -mfloat-abi=hard -masm=auto -Wa,armasm,--diag_suppress=A1950W -c
|
||||||
|
|
||||||
-gdwarf-4 -I ../Core/Inc -I ../AZURE_RTOS/App -I ../Drivers/STM32H5xx_HAL_Driver/Inc -I ../Drivers/STM32H5xx_HAL_Driver/Inc/Legacy -I ../Middlewares/ST/threadx/common/inc -I ../Drivers/CMSIS/Device/ST/STM32H5xx/Include -I ../Middlewares/ST/threadx/ports/cortex_m33/ac6/inc -I ../Drivers/CMSIS/Include
|
-gdwarf-4 -I ../Core/Inc -I ../AZURE_RTOS/App -I ../Drivers/STM32H5xx_HAL_Driver/Inc -I ../Drivers/STM32H5xx_HAL_Driver/Inc/Legacy -I ../Middlewares/ST/threadx/common/inc -I ../Drivers/CMSIS/Device/ST/STM32H5xx/Include -I ../Middlewares/ST/threadx/ports/cortex_m33/ac6/inc -I ../Drivers/CMSIS/Include
|
||||||
|
|
||||||
-I./RTE/_AutoGuideStick
|
-I./RTE/_AutoGuideStick
|
||||||
@@ -140,8 +140,8 @@ I (..\Drivers\STM32H5xx_HAL_Driver\Inc\stm32h5xx_hal_tim_ex.h)(0x683FA4DD)
|
|||||||
-ID:/keil5/ARM/PACK/Keil/STM32H5xx_DFP/1.3.0/Drivers/CMSIS/Device/ST/STM32H5xx/Include
|
-ID:/keil5/ARM/PACK/Keil/STM32H5xx_DFP/1.3.0/Drivers/CMSIS/Device/ST/STM32H5xx/Include
|
||||||
|
|
||||||
-D__UVISION_VERSION="539" -D_RTE_ -DSTM32H563xx -D_RTE_ -DTX_INCLUDE_USER_DEFINE_FILE -DTX_SINGLE_MODE_NON_SECURE="1" -DUSE_HAL_DRIVER -DSTM32H563xx
|
-D__UVISION_VERSION="539" -D_RTE_ -DSTM32H563xx -D_RTE_ -DTX_INCLUDE_USER_DEFINE_FILE -DTX_SINGLE_MODE_NON_SECURE="1" -DUSE_HAL_DRIVER -DSTM32H563xx
|
||||||
|
|
||||||
-o autoguidestick/gpdma.o -MD)
|
-o autoguidestick/gpdma.o -MD)
|
||||||
I (..\Core\Inc\main.hc.\Drivers\STM32H5xx_HAL_Driver\Inc\stm32h5xx_hal.h)(0x00000000)
|
I (..\Core\Inc\main.hc.\Drivers\STM32H5xx_HAL_Driver\Inc\stm32h5xx_hal.h)(0x00000000)
|
||||||
I (..\Core\Inc\stm32h5xx_hal_conf.h)(0x685C2A98)
|
I (..\Core\Inc\stm32h5xx_hal_conf.h)(0x685C2A98)
|
||||||
I (..\Drivers\STM32H5xx_HAL_Driver\Inc\stm32h5xx_hal_rcc.h)(0x683FA4DD)
|
I (..\Drivers\STM32H5xx_HAL_Driver\Inc\stm32h5xx_hal_rcc.h)(0x683FA4DD)
|
||||||
@@ -352,7 +352,7 @@ I (..\Drivers\STM32H5xx_HAL_Driver\Inc\stm32h5xx_hal_tim_ex.h)(0x683FA4DD)
|
|||||||
I (D:\advance_stick\AutoGuideStick\Drivers\CMSIS\Include\mpu_armv8.h)(0x683FA4DE)
|
I (D:\advance_stick\AutoGuideStick\Drivers\CMSIS\Include\mpu_armv8.h)(0x683FA4DE)
|
||||||
I (..\Drivers\CMSIS\Device\ST\STM32H5xx\Include\system_stm32h5xx.h)(0x683FA4DE)
|
I (..\Drivers\CMSIS\Device\ST\STM32H5xx\Include\system_stm32h5xx.h)(0x683FA4DE)
|
||||||
I (..\Drivers\STM32H5xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h)(0x683FA4DD)
|
I (..\Drivers\STM32H5xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h)(0x683FA4DD)
|
||||||
I (D:\keil5\ARM\ARMCLANG\include\stddef.h)(0x6569B012)
|
I (D:\keil5\ARM\ARMCLANG\include\stddef.h)(0x6569B012)
|
||||||
I (..\Drivers\STM32H5xx_HAL_Driver\Inc\stm32h5xx_hal_rcc_ex.h)(0x683FA4DD)
|
I (..\Drivers\STM32H5xx_HAL_Driver\Inc\stm32h5xx_hal_rcc_ex.h)(0x683FA4DD)
|
||||||
I (..\Drivers\STM32H5xx_HAL_Driver\Inc\stm32h5xx_hal_gpio.h)(0x683FA4DD)
|
I (..\Drivers\STM32H5xx_HAL_Driver\Inc\stm32h5xx_hal_gpio.h)(0x683FA4DD)
|
||||||
I (..\Drivers\STM32H5xx_HAL_Driver\Inc\stm32h5xx_hal_gpio_ex.h)(0x683FA4DD)
|
I (..\Drivers\STM32H5xx_HAL_Driver\Inc\stm32h5xx_hal_gpio_ex.h)(0x683FA4DD)
|
||||||
@@ -2070,7 +2070,7 @@ I (..\Middlewares\ST\threadx\ports\cortex_m33\ac6\inc\tx_port.h)(0x683FA4D9)
|
|||||||
|
|
||||||
-o autoguidestick/tx_event_flags_info_get.o -MD)
|
-o autoguidestick/tx_event_flags_info_get.o -MD)
|
||||||
I (..\Middlewares\ST\threadx\common\inc\tx_api.h)(0x683FA4DA)
|
I (..\Middlewares\ST\threadx\common\inc\tx_api.h)(0x683FA4DA)
|
||||||
I (..\Middlewares\ST\threadx\ports\cortex_m33\ac6\inc\tx_port.h)(0x683FA4D9)
|
I (..\Middlewares\ST\threadx\ports\cortex_m33\ac6\inc\tx_port.h)(0x683FA4D9)
|
||||||
I (..\Core\Inc\tx_user.he:\keil5\ARM\ARMCLANG\include\stdlib.h)(0x00000000)
|
I (..\Core\Inc\tx_user.he:\keil5\ARM\ARMCLANG\include\stdlib.h)(0x00000000)
|
||||||
I (D:\keil5\ARM\ARMCLANG\include\string.h)(0x6569B012)
|
I (D:\keil5\ARM\ARMCLANG\include\string.h)(0x6569B012)
|
||||||
I (..\Middlewares\ST\threadx\common\inc\tx_trace.h)(0x683FA4DA)
|
I (..\Middlewares\ST\threadx\common\inc\tx_trace.h)(0x683FA4DA)
|
||||||
@@ -2111,9 +2111,9 @@ I (D:\keil5\ARM\ARMCLANG\include\string.h)(0x6569B012)
|
|||||||
|
|
||||||
-o autoguidestick/tx_event_flags_set.o -MD)
|
-o autoguidestick/tx_event_flags_set.o -MD)
|
||||||
I (..\Middlewares\ST\threadx\common\inc\tx_api.h)(0x683FA4DA)
|
I (..\Middlewares\ST\threadx\common\inc\tx_api.h)(0x683FA4DA)
|
||||||
I (..\Middlewares\ST\threadx\ports\cortex_m33\ac6\inc\tx_port.h)(0x683FA4D9)
|
I (..\Middlewares\ST\threadx\ports\cortex_m33\ac6\inc\tx_port.h)(0x683FA4D9)
|
||||||
I (..\Core\Inc\tx_user.he:\keil5\ARM\ARMCLANG\include\stdlib.h)(0x00000000)
|
I (..\Core\Inc\tx_user.he:\keil5\ARM\ARMCLANG\include\stdlib.h)(0x00000000)
|
||||||
I (D:\keil5\ARM\ARMCLANG\include\string.h)(0x6569B012)
|
I (D:\keil5\ARM\ARMCLANG\include\string.h)(0x6569B012)
|
||||||
I (..\Middlewares\ST\threadx\common\inc\tx_trace.h)(0x683FA4DA)
|
I (..\Middlewares\ST\threadx\common\inc\tx_trace.h)(0x683FA4DA)
|
||||||
I (..\Middlewares\ST\threadx\common\inc\tx_thread.h)(0x683FA4DA)
|
I (..\Middlewares\ST\threadx\common\inc\tx_thread.h)(0x683FA4DA)
|
||||||
I (..\Middlewares\ST\threadx\common\inc\tx_event_flags.h)(0x683FA4DA)
|
I (..\Middlewares\ST\threadx\common\inc\tx_event_flags.h)(0x683FA4DA)
|
||||||
@@ -2154,7 +2154,7 @@ I (D:\keil5\ARM\ARMCLANG\include\string.h)(0x6569B012)
|
|||||||
|
|
||||||
-o autoguidestick/tx_mutex_cleanup.o -MD)
|
-o autoguidestick/tx_mutex_cleanup.o -MD)
|
||||||
I (..\Middlewares\ST\threadx\common\inc\tx_api.h)(0x683FA4DA)
|
I (..\Middlewares\ST\threadx\common\inc\tx_api.h)(0x683FA4DA)
|
||||||
I (..\Middlewares\ST\threadx\ports\cortex_m33\ac6\inc\tx_port.h)(0x683FA4D9)
|
I (..\Middlewares\ST\threadx\ports\cortex_m33\ac6\inc\tx_port.h)(0x683FA4D9)
|
||||||
I (..\Core\Inc\tx_user.he:\keil5\ARM\ARMCLANG\include\stdlib.h)(0x00000000)
|
I (..\Core\Inc\tx_user.he:\keil5\ARM\ARMCLANG\include\stdlib.h)(0x00000000)
|
||||||
I (D:\keil5\ARM\ARMCLANG\include\string.h)(0x6569B012)
|
I (D:\keil5\ARM\ARMCLANG\include\string.h)(0x6569B012)
|
||||||
I (..\Middlewares\ST\threadx\common\inc\tx_thread.h)(0x683FA4DA)
|
I (..\Middlewares\ST\threadx\common\inc\tx_thread.h)(0x683FA4DA)
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
103
fun/HCBle.c
103
fun/HCBle.c
@@ -77,7 +77,7 @@ void HCBle_SendData(char *p,...)
|
|||||||
// <20><><EFBFBD>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD>һ<EFBFBD><D2BB>DMA
|
// <20><><EFBFBD>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD>һ<EFBFBD><D2BB>DMA
|
||||||
|
|
||||||
|
|
||||||
|
// <20>ҷ<EFBFBD><D2B7>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD> --- \n <20><><EFBFBD>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ծ<EFBFBD>һֱ<D2BB><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
|
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
|
||||||
{
|
{
|
||||||
if (huart->Instance == UART4)
|
if (huart->Instance == UART4)
|
||||||
@@ -87,65 +87,44 @@ void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
|
|||||||
uint8_t ch = uart_dma_rx_buf[i];
|
uint8_t ch = uart_dma_rx_buf[i];
|
||||||
uint16_t next_head = (ble_rx_ring.head + 1) % RING_BUFFER_SIZE;
|
uint16_t next_head = (ble_rx_ring.head + 1) % RING_BUFFER_SIZE;
|
||||||
|
|
||||||
if (next_head != ble_rx_ring.tail)
|
if(next_head != ble_rx_ring.tail)
|
||||||
{
|
{
|
||||||
ble_rx_ring.buffer[ble_rx_ring.head] = ch;
|
ble_rx_ring.buffer[ble_rx_ring.head] = ch;
|
||||||
ble_rx_ring.head = next_head;
|
ble_rx_ring.head = next_head;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tx_event_flags_set(&ble_event_flags, BLE_EVENT_DATA_READY, TX_OR);
|
tx_event_flags_set(&ble_event_flags, BLE_EVENT_DATA_READY, TX_OR);
|
||||||
HAL_UARTEx_ReceiveToIdle_IT(&huart4, uart_dma_rx_buf, UART_DMA_RX_BUF_SIZE);
|
HAL_UARTEx_ReceiveToIdle_IT(&huart4, uart_dma_rx_buf, UART_DMA_RX_BUF_SIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD> Json<6F><6E><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD> <20>Լ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݸ<EFBFBD><DDB8>ֻ<EFBFBD>App
|
|
||||||
|
|
||||||
|
void HCBle_ParseAndHandleFrame(const char *frame)
|
||||||
|
{
|
||||||
|
int left, right;
|
||||||
|
float lat, lon, angle;
|
||||||
|
|
||||||
void HCBle_ExtractAndParseFrame(void) {
|
// if (sscanf(frame, "#{\"leftSpeed\":%d,\"rightSpeed\":%d}", &left, &right) == 2) {
|
||||||
static char json_buf[128];
|
// cmd.LeftSpeed = left;
|
||||||
static int idx = 0;
|
// cmd.RightSpeed = right;
|
||||||
static int parsing = 0;
|
// HCBle_SendData("? <20><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>: <20><>=%d, <20><>=%d\r\n", left, right);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
while (ble_rx_ring.tail != ble_rx_ring.head) {
|
if (sscanf(frame, "%*[^0-9]%d%*[^0-9]%d", &left, &right) == 2) {
|
||||||
char c = ble_rx_ring.buffer[ble_rx_ring.tail];
|
cmd.LeftSpeed = left;
|
||||||
ble_rx_ring.tail = (ble_rx_ring.tail + 1) % RING_BUFFER_SIZE;
|
cmd.RightSpeed = right;
|
||||||
|
HCBle_SendData("? <20><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>: <20><>=%d, <20><>=%d\r\n", left, right);
|
||||||
if (!parsing) {
|
return;
|
||||||
if (c == '#') {
|
|
||||||
idx = 0;
|
|
||||||
parsing = 1;
|
|
||||||
memset(json_buf, 0, sizeof(json_buf));
|
|
||||||
json_buf[idx++] = c;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (idx < sizeof(json_buf) - 1) {
|
|
||||||
json_buf[idx++] = c;
|
|
||||||
if (c == '\n') {
|
|
||||||
json_buf[idx] = '\0';
|
|
||||||
int left, right;
|
|
||||||
if (sscanf(json_buf, "#{\"leftSpeed\":%d,\"rightSpeed\":%d}\n", &left, &right) == 2) {
|
|
||||||
HCBle_SendData("? <20><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>: <20><>=%d, <20><>=%d\r\n", left, right);
|
|
||||||
cmd.LeftSpeed = left;
|
|
||||||
cmd.RightSpeed = right;
|
|
||||||
} else {
|
|
||||||
HCBle_SendData("? JSON<4F><4E>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>: %s\r\n", json_buf);
|
|
||||||
}
|
|
||||||
parsing = 0;
|
|
||||||
idx = 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
parsing = 0;
|
|
||||||
idx = 0;
|
|
||||||
memset(json_buf, 0, sizeof(json_buf));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HCBle_SendData("? <20><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>: %s\r\n", frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Ϊɶһֱʹ<D6B1>ò<EFBFBD><C3B2>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD><EFBFBD>һֱ<D2BB>ٵȴ<D9B5>TX<54><58><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
//Ϊɶһֱʹ<D6B1>ò<EFBFBD><C3B2>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD><EFBFBD>һֱ<D2BB>ٵȴ<D9B5>TX<54><58><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
// <20>ں<EFBFBD>̨<EFBFBD><CCA8><EFBFBD>е<EFBFBD>һ<EFBFBD><D2BB><EFBFBD>̣߳<DFB3><CCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD>UART<52>յ<EFBFBD>BLE<4C><45><EFBFBD>ݺ<DDBA><F3B4A5B7><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD><EFBFBD>
|
// <20>ں<EFBFBD>̨<EFBFBD><CCA8><EFBFBD>е<EFBFBD>һ<EFBFBD><D2BB><EFBFBD>̣߳<DFB3><CCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD>UART<52>յ<EFBFBD>BLE<4C><45><EFBFBD>ݺ<DDBA><F3B4A5B7><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD><EFBFBD>
|
||||||
void ble_rx_task_entry(ULONG thread_input)
|
void ble_rx_task_entry(ULONG thread_input)
|
||||||
@@ -153,19 +132,47 @@ void ble_rx_task_entry(ULONG thread_input)
|
|||||||
HCBle_InitDMAReception();
|
HCBle_InitDMAReception();
|
||||||
|
|
||||||
ULONG actual_flags;
|
ULONG actual_flags;
|
||||||
|
static char json_buf[128];
|
||||||
|
static int idx = 0;
|
||||||
|
static int parsing = 0;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
tx_event_flags_get(&ble_event_flags, BLE_EVENT_DATA_READY, TX_OR_CLEAR, &actual_flags, TX_WAIT_FOREVER);
|
tx_event_flags_get(&ble_event_flags, BLE_EVENT_DATA_READY, TX_OR_CLEAR, &actual_flags, TX_WAIT_FOREVER);
|
||||||
|
|
||||||
if (actual_flags & BLE_EVENT_DATA_READY)
|
while (ble_rx_ring.tail != ble_rx_ring.head)
|
||||||
{
|
{
|
||||||
HCBle_ExtractAndParseFrame();
|
char c = ble_rx_ring.buffer[ble_rx_ring.tail];
|
||||||
|
ble_rx_ring.tail = (ble_rx_ring.tail + 1) % RING_BUFFER_SIZE;
|
||||||
|
|
||||||
|
if (!parsing) {
|
||||||
|
if (c == '#') {
|
||||||
|
parsing = 1;
|
||||||
|
idx = 0;
|
||||||
|
json_buf[idx++] = c;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (idx < sizeof(json_buf) - 1) {
|
||||||
|
json_buf[idx++] = c;
|
||||||
|
if (c == '$') {
|
||||||
|
json_buf[idx] = '\0';
|
||||||
|
HCBle_SendData("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>json_buf: %s\r\n", json_buf);
|
||||||
|
HCBle_ParseAndHandleFrame(json_buf);
|
||||||
|
parsing = 0;
|
||||||
|
idx = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
parsing = 0;
|
||||||
|
idx = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// "#{\"lat\":%.6f,\"lon\":%.6f,\"angle\":%.2f}\n",23.123456, 113.654321, 95.0);
|
// "#{\"lat\":%.6f,\"lon\":%.6f,\"angle\":%.2f}\n",23.123456, 113.654321, 95.0);
|
||||||
// HCBle_SendData("#{\"lat\":%.6f,\"lon\":%.6f,\"angle\":%.2f}\n",
|
// HCBle_SendData("#{\"lat\":%.6f,\"lon\":%.6f,\"angle\":%.2f}\n",
|
||||||
// current_location.lat, current_location.lon, current_location.angle);
|
// current_location.lat, current_location.lon, current_location.angle);
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
#define __HCBLE_H
|
#define __HCBLE_H
|
||||||
|
|
||||||
#include "headfile.h"
|
#include "headfile.h"
|
||||||
//#define DEBUG_EN 1 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> ʹ<><CAB9>DMA <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> <20><><EFBFBD><EFBFBD>ʽ
|
#define DEBUG_EN 1 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> ʹ<><CAB9>DMA <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> <20><><EFBFBD><EFBFBD>ʽ
|
||||||
#define RX_DataSize 128
|
#define RX_DataSize 128
|
||||||
#define RING_BUFFER_SIZE 256
|
#define RING_BUFFER_SIZE 256
|
||||||
#define UART_DMA_RX_BUF_SIZE 64
|
#define UART_DMA_RX_BUF_SIZE 20
|
||||||
|
|
||||||
|
|
||||||
// HCBle <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD>
|
// HCBle <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD>
|
||||||
|
|||||||
10
fun/gps.c
10
fun/gps.c
@@ -161,14 +161,6 @@ void GPS_Data_CLR(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void GPS_DMA_Start(void)
|
|
||||||
{
|
|
||||||
HAL_UART_Receive_DMA(&huart2,GPS_DMA_RX_BUF,GPS_DMA_RX_BUF_LEN);
|
|
||||||
__HAL_DMA_ENABLE_IT(huart2.hdmarx,DMA_IT_HT); //<2F>봫<EFBFBD><EBB4AB><EFBFBD>ж<EFBFBD>
|
|
||||||
__HAL_DMA_ENABLE_IT(huart2.hdmarx,DMA_IT_TC); //ȫ<><C8AB><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|
||||||
}
|
|
||||||
|
|
||||||
//void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
|
//void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
|
||||||
//{
|
//{
|
||||||
// if(huart->Instance == USART2)
|
// if(huart->Instance == USART2)
|
||||||
@@ -181,7 +173,6 @@ void GPS_DMA_Start(void)
|
|||||||
// tx_event_flags_set(&system_events, EVENT_GPS_DATA_READY, TX_OR);
|
// tx_event_flags_set(&system_events, EVENT_GPS_DATA_READY, TX_OR);
|
||||||
// //<2F><><EFBFBD>¿<EFBFBD><C2BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
// //<2F><><EFBFBD>¿<EFBFBD><C2BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
// HAL_UARTEx_ReceiveToIdle_DMA(&huart2,GPS_DMA_RX_BUF,GPS_DMA_RX_BUF_LEN);
|
// HAL_UARTEx_ReceiveToIdle_DMA(&huart2,GPS_DMA_RX_BUF,GPS_DMA_RX_BUF_LEN);
|
||||||
// __HAL_DMA_DISABLE_IT(&handle_GPDMA1_Channel3,DMA_IT_HT);
|
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
//}
|
//}
|
||||||
@@ -216,7 +207,6 @@ void gps_thread_entry(ULONG thread_input)
|
|||||||
current_location.angle);
|
current_location.angle);
|
||||||
tx_queue_send(&ble_tx_queue, &msg, TX_WAIT_FOREVER);
|
tx_queue_send(&ble_tx_queue, &msg, TX_WAIT_FOREVER);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user