保存cli注释
This commit is contained in:
parent
6082c3bee5
commit
806b2e889d
@ -230,7 +230,7 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
|
||||
/* USER CODE BEGIN 1 */
|
||||
uint8_t uart_buffer[255],uart2_data[255],uart2_datalength;
|
||||
__weak void MR16_NotifyUARTIdle(void) { }
|
||||
void USAR_UART_IDLECallback(UART_HandleTypeDef *huart)
|
||||
void USAR_UART2_IDLECallback(UART_HandleTypeDef *huart)
|
||||
{
|
||||
if (huart == NULL) return;
|
||||
if (huart->Instance != USART2) return; // 目前仅支持 USART2 的 DMA 空闲处理
|
||||
@ -239,7 +239,7 @@ void USAR_UART_IDLECallback(UART_HandleTypeDef *huart)
|
||||
|
||||
uart2_datalength = 255 - __HAL_DMA_GET_COUNTER(&hdma_usart2_rx); // 计算接收长度(针对 USART2)
|
||||
|
||||
printf("Receive Data(length = %d): ", uart2_datalength);
|
||||
printf("[UART2 RX:%d] ", uart2_datalength);
|
||||
HAL_UART_Transmit(huart, uart_buffer, uart2_datalength, 0x200); // 回显/打印接收数据
|
||||
printf("\r\n");
|
||||
|
||||
@ -260,9 +260,8 @@ void USER_UART_IRQHandler(UART_HandleTypeDef *huart)
|
||||
{
|
||||
if (__HAL_UART_GET_FLAG(huart, UART_FLAG_IDLE) != RESET) // 检测 IDLE
|
||||
{
|
||||
__HAL_UART_CLEAR_IDLEFLAG(huart); // 清除 IDLE 标志,避免重复进入中断
|
||||
printf("\r\nUART2 Idle IRQ Detected\r\n");
|
||||
USAR_UART_IDLECallback(huart); // 调用具体处理
|
||||
__HAL_UART_CLEAR_IDLEFLAG(huart); // 清除 IDLE 标志,避免重复进入中断
|
||||
USAR_UART2_IDLECallback(huart); // 调用具体处理
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -152,9 +152,9 @@
|
||||
<Bp>
|
||||
<Number>0</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>319</LineNumber>
|
||||
<LineNumber>321</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>134231564</Address>
|
||||
<Address>134246252</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
@ -163,7 +163,7 @@
|
||||
<BreakIfRCount>1</BreakIfRCount>
|
||||
<Filename>..\User\module\mr16.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression>\\MR16\../User/module/mr16.c\319</Expression>
|
||||
<Expression>\\MR16\../User/module/mr16.c\321</Expression>
|
||||
</Bp>
|
||||
</Breakpoint>
|
||||
<WatchWindow1>
|
||||
@ -185,7 +185,7 @@
|
||||
<Ww>
|
||||
<count>3</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>mr16</ItemText>
|
||||
<ItemText>mr16,0x0A</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>4</count>
|
||||
@ -197,12 +197,17 @@
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>radio</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>6</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>robot_config,0x0A</ItemText>
|
||||
</Ww>
|
||||
</WatchWindow1>
|
||||
<MemoryWindow1>
|
||||
<Mm>
|
||||
<WinNumber>1</WinNumber>
|
||||
<SubType>0</SubType>
|
||||
<ItemText>0x800f800</ItemText>
|
||||
<ItemText>0x800e000</ItemText>
|
||||
<AccSizeX>0</AccSizeX>
|
||||
</Mm>
|
||||
</MemoryWindow1>
|
||||
@ -1301,6 +1306,30 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>82</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\User\module\config.c</PathWithFileName>
|
||||
<FilenameWithoutPath>config.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>83</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\User\module\config.h</PathWithFileName>
|
||||
<FilenameWithoutPath>config.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
@ -1311,7 +1340,7 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>82</FileNumber>
|
||||
<FileNumber>84</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -1323,7 +1352,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>83</FileNumber>
|
||||
<FileNumber>85</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -1335,7 +1364,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>84</FileNumber>
|
||||
<FileNumber>86</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -1347,7 +1376,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>85</FileNumber>
|
||||
<FileNumber>87</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
||||
@ -1514,6 +1514,16 @@
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\User\module\mr16.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>config.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\User\module\config.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>config.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\User\module\config.h</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
|
||||
BIN
MDK-ARM/MR16/MR16.axf
Normal file
BIN
MDK-ARM/MR16/MR16.axf
Normal file
Binary file not shown.
@ -22,23 +22,13 @@ Dialog DLL: TCM.DLL V1.48.0.0
|
||||
|
||||
<h2>Project:</h2>
|
||||
D:\CUBEMX\MR16\MDK-ARM\MR16.uvprojx
|
||||
Project File Date: 12/03/2025
|
||||
Project File Date: 12/04/2025
|
||||
|
||||
<h2>Output:</h2>
|
||||
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\cangming\ARM\ARMCC\Bin'
|
||||
Build target 'MR16'
|
||||
Note: source file '..\User\bsp\gpio.c' - object file renamed from 'MR16\gpio.o' to 'MR16\gpio_1.o'.
|
||||
Note: source file '..\User\bsp\spi.c' - object file renamed from 'MR16\spi.o' to 'MR16\spi_1.o'.
|
||||
compiling radio.c...
|
||||
../User/task/user_task.h(80): warning: #1-D: last line of file ends without a newline
|
||||
#endif
|
||||
../User/module/mr16.h(96): warning: #1-D: last line of file ends without a newline
|
||||
#endif
|
||||
..\User\task\radio.c(43): error: #167: argument of type "MR16_Param_t" is incompatible with parameter of type "MR16_Param_t *"
|
||||
MR16_Init(&mr16,Config_Get()->mr16,MR16_MODE_RC, RADIOMODE_FLRC);
|
||||
..\User\task\radio.c(56): warning: #1-D: last line of file ends without a newline
|
||||
}
|
||||
..\User\task\radio.c: 3 warnings, 1 error
|
||||
compiling mr16.c...
|
||||
../User/module/mr16.h(96): warning: #1-D: last line of file ends without a newline
|
||||
#endif
|
||||
@ -50,30 +40,37 @@ compiling mr16.c...
|
||||
variable "RXheader" (declared at line 100)
|
||||
switch (source) {
|
||||
^
|
||||
..\User\module\mr16.c(152): warning: #940-D: missing return statement at end of non-void function "MR16_UI_PowerON"
|
||||
..\User\module\mr16.c(155): warning: #940-D: missing return statement at end of non-void function "MR16_UI_PowerON"
|
||||
}
|
||||
..\User\module\mr16.c(156): warning: #940-D: missing return statement at end of non-void function "MR16_UI_Home"
|
||||
..\User\module\mr16.c(159): warning: #940-D: missing return statement at end of non-void function "MR16_UI_Home"
|
||||
}
|
||||
..\User\module\mr16.c(160): warning: #940-D: missing return statement at end of non-void function "MR16_UI_Setting"
|
||||
..\User\module\mr16.c(163): warning: #940-D: missing return statement at end of non-void function "MR16_UI_Setting"
|
||||
}
|
||||
..\User\module\mr16.c(172): warning: #188-D: enumerated type mixed with another type
|
||||
..\User\module\mr16.c(177): warning: #188-D: enumerated type mixed with another type
|
||||
LCD_Init(1);
|
||||
..\User\module\mr16.c(176): warning: #940-D: missing return statement at end of non-void function "MR16_Init"
|
||||
..\User\module\mr16.c(181): warning: #940-D: missing return statement at end of non-void function "MR16_Init"
|
||||
}
|
||||
..\User\module\mr16.c(232): warning: #940-D: missing return statement at end of non-void function "MR16_Main"
|
||||
..\User\module\mr16.c(237): warning: #940-D: missing return statement at end of non-void function "MR16_Main"
|
||||
}
|
||||
..\User\module\mr16.c(265): error: #171: invalid type conversion
|
||||
BSP_Flash_WriteBytes(ADDR_FLASH_SECTOR(200), (const uint16_t*)Config_Get()->mr16, sizeof(MR16_Param_t));
|
||||
..\User\module\mr16.c(350): warning: #1-D: last line of file ends without a newline
|
||||
..\User\module\mr16.c(471): warning: #223-D: function "strtoul" declared implicitly
|
||||
if (arg4[0] != '\0') val = strtoul(arg4, NULL, 0);
|
||||
..\User\module\mr16.c(472): warning: #223-D: function "strtoul" declared implicitly
|
||||
else if (arg3[0] != '\0') val = strtoul(arg3, NULL, 0);
|
||||
..\User\module\mr16.c(660): warning: #177-D: variable "proto" was declared but never referenced
|
||||
SX1281_RadioMode_t proto;
|
||||
..\User\module\mr16.c(737): warning: #1-D: last line of file ends without a newline
|
||||
}
|
||||
..\User\module\mr16.c(350): warning: #940-D: missing return statement at end of non-void function "MR16_CLI_Init"
|
||||
..\User\module\mr16.c(737): warning: #940-D: missing return statement at end of non-void function "MR16_CLI_Init"
|
||||
}
|
||||
..\User\module\mr16.c(79): warning: #550-D: variable "MR16_FSM" was set but never used
|
||||
..\User\module\mr16.c(79): warning: #177-D: variable "MR16_FSM" was declared but never referenced
|
||||
static MR16_FSM_t MR16_FSM = MR16_FSM_NONE;
|
||||
..\User\module\mr16.c(81): warning: #177-D: variable "MR16_SettingFSM" was declared but never referenced
|
||||
static MR16_SettingFSM_t MR16_SettingFSM=MR16_SETTINGFSM_home;
|
||||
..\User\module\mr16.c: 14 warnings, 1 error
|
||||
"MR16\MR16.axf" - 2 Error(s), 17 Warning(s).
|
||||
..\User\module\mr16.c: 17 warnings, 0 errors
|
||||
linking...
|
||||
Program Size: Code=38876 RO-data=18360 RW-data=380 ZI-data=19716
|
||||
FromELF: creating hex file...
|
||||
"MR16\MR16.axf" - 0 Error(s), 17 Warning(s).
|
||||
|
||||
<h2>Software Packages used:</h2>
|
||||
|
||||
@ -97,8 +94,7 @@ Package Vendor: Keil
|
||||
|
||||
* Component: ARM::CMSIS:CORE:5.4.0
|
||||
Include file: CMSIS\Core\Include\tz_context.h
|
||||
Target not created.
|
||||
Build Time Elapsed: 00:00:02
|
||||
Build Time Elapsed: 00:00:06
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -55,6 +55,7 @@
|
||||
"mr16\keystatuscheck.o"
|
||||
"mr16\ui.o"
|
||||
"mr16\mr16.o"
|
||||
"mr16\config.o"
|
||||
"mr16\init.o"
|
||||
"mr16\user_task.o"
|
||||
"mr16\radio.o"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -213,7 +213,7 @@ I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_spi.h)(0x67480A20)
|
||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h)(0x67480A20)
|
||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h)(0x67480A20)
|
||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x67480A20)
|
||||
F (../Core/Src/usart.c)(0x692EE31B)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3
-I.\RTE\_MR16
-ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include
-ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB
-o mr16\usart.o --omf_browse mr16\usart.crf --depend mr16\usart.d)
|
||||
F (../Core/Src/usart.c)(0x69310F17)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3
-I.\RTE\_MR16
-ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include
-ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB
-o mr16\usart.o --omf_browse mr16\usart.crf --depend mr16\usart.d)
|
||||
I (../Core/Inc/usart.h)(0x692EE31B)
|
||||
I (../Core/Inc/main.h)(0x6926BBE5)
|
||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x67480A20)
|
||||
@ -1102,8 +1102,10 @@ I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x67480A20)
|
||||
I (../Middlewares/Third_Party/FreeRTOS/Source/include/task.h)(0x67480A20)
|
||||
I (../Middlewares/Third_Party/FreeRTOS/Source/include/list.h)(0x67480A20)
|
||||
F (..\User\bsp\time.h)(0x692EA1CD)()
|
||||
F (..\User\bsp\flash.c)(0x69304D86)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3
-I.\RTE\_MR16
-ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include
-ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB
-o mr16\flash.o --omf_browse mr16\flash.crf --depend mr16\flash.d)
|
||||
I (../User/bsp\flash.h)(0x69304D87)
|
||||
F (..\User\bsp\flash.c)(0x69305F89)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3
-I.\RTE\_MR16
-ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include
-ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB
-o mr16\flash.o --omf_browse mr16\flash.crf --depend mr16\flash.d)
|
||||
I (../User/bsp/flash.h)(0x69306310)
|
||||
I (D:\cangming\ARM\ARMCC\include\stdint.h)(0x5E8E3CC2)
|
||||
I (../User/bsp/bsp.h)(0x692EA1CC)
|
||||
I (../Core/Inc/main.h)(0x6926BBE5)
|
||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x67480A20)
|
||||
I (../Core/Inc/stm32f1xx_hal_conf.h)(0x6925BA2A)
|
||||
@ -1112,7 +1114,6 @@ I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h)(0x67480A20)
|
||||
I (../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h)(0x67480A20)
|
||||
I (../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h)(0x67480A20)
|
||||
I (../Drivers/CMSIS/Include/core_cm3.h)(0x67480A0A)
|
||||
I (D:\cangming\ARM\ARMCC\include\stdint.h)(0x5E8E3CC2)
|
||||
I (../Drivers/CMSIS/Include/cmsis_version.h)(0x67480A0A)
|
||||
I (../Drivers/CMSIS/Include/cmsis_compiler.h)(0x67480A0A)
|
||||
I (../Drivers/CMSIS/Include/cmsis_armcc.h)(0x67480A0A)
|
||||
@ -1133,9 +1134,7 @@ I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_spi.h)(0x67480A20)
|
||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h)(0x67480A20)
|
||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h)(0x67480A20)
|
||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x67480A20)
|
||||
I (../User/bsp/bsp.h)(0x692EA1CC)
|
||||
I (D:\cangming\ARM\ARMCC\include\string.h)(0x5E8E3CC2)
|
||||
F (..\User\bsp\flash.h)(0x69304D87)()
|
||||
F (..\User\bsp\flash.h)(0x69306310)()
|
||||
F (..\User\device\device.h)(0x692EA1CD)()
|
||||
F (..\User\device\lcd_driver\lcd.c)(0x692ABE66)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3
-I.\RTE\_MR16
-ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include
-ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB
-o mr16\lcd.o --omf_browse mr16\lcd.crf --depend mr16\lcd.d)
|
||||
I (../User/device/lcd_driver/lcd.h)(0x692ABE66)
|
||||
@ -1180,7 +1179,7 @@ I (D:\cangming\ARM\ARMCC\include\stdio.h)(0x5E8E3CC2)
|
||||
F (..\User\device\lcd_driver\lcd.h)(0x692ABE66)()
|
||||
F (..\User\device\lcd_driver\lcd_lib.h)(0x692ABE66)()
|
||||
F (..\User\device\sx1281_driver\radio.h)(0x692C10EB)()
|
||||
F (..\User\device\sx1281_driver\sx1281.c)(0x693055D0)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3
-I.\RTE\_MR16
-ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include
-ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB
-o mr16\sx1281.o --omf_browse mr16\sx1281.crf --depend mr16\sx1281.d)
|
||||
F (..\User\device\sx1281_driver\sx1281.c)(0x69310DB8)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3
-I.\RTE\_MR16
-ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include
-ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB
-o mr16\sx1281.o --omf_browse mr16\sx1281.crf --depend mr16\sx1281.d)
|
||||
I (..\User\device\sx1281_driver\sx1281_driver.h)(0x692DCACF)
|
||||
I (D:\cangming\ARM\ARMCC\include\stdint.h)(0x5E8E3CC2)
|
||||
I (D:\cangming\ARM\ARMCC\include\stdbool.h)(0x5E8E3CC2)
|
||||
@ -1529,7 +1528,7 @@ I (D:\cangming\ARM\ARMCC\include\stdbool.h)(0x5E8E3CC2)
|
||||
I (D:\cangming\ARM\ARMCC\include\stddef.h)(0x5E8E3CC2)
|
||||
I (D:\cangming\ARM\ARMCC\include\stdio.h)(0x5E8E3CC2)
|
||||
F (..\User\component\ui.h)(0x692EA1CD)()
|
||||
F (..\User\module\mr16.c)(0x69305BCF)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3
-I.\RTE\_MR16
-ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include
-ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB
-o mr16\mr16.o --omf_browse mr16\mr16.crf --depend mr16\mr16.d)
|
||||
F (..\User\module\mr16.c)(0x69318E82)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3
-I.\RTE\_MR16
-ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include
-ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB
-o mr16\mr16.o --omf_browse mr16\mr16.crf --depend mr16\mr16.d)
|
||||
I (../User/module/mr16.h)(0x693057A1)
|
||||
I (D:\cangming\ARM\ARMCC\include\stdint.h)(0x5E8E3CC2)
|
||||
I (D:\cangming\ARM\ARMCC\include\stdbool.h)(0x5E8E3CC2)
|
||||
@ -1567,7 +1566,7 @@ I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h)(0x67480A20)
|
||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x67480A20)
|
||||
I (D:\cangming\ARM\ARMCC\include\string.h)(0x5E8E3CC2)
|
||||
I (D:\cangming\ARM\ARMCC\include\stdio.h)(0x5E8E3CC2)
|
||||
I (../User/bsp/flash.h)(0x69304D87)
|
||||
I (../User/bsp/flash.h)(0x69306310)
|
||||
I (../User/bsp/bsp.h)(0x692EA1CC)
|
||||
I (../Core/Inc/usart.h)(0x692EE31B)
|
||||
I (../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.h)(0x67480A20)
|
||||
@ -1586,6 +1585,16 @@ I (../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3/portmacro.h)
|
||||
I (../Middlewares/Third_Party/FreeRTOS/Source/include/mpu_wrappers.h)(0x67480A20)
|
||||
I (../User/module/config.h)(0x69305B59)
|
||||
F (..\User\module\mr16.h)(0x693057A1)()
|
||||
F (..\User\module\config.c)(0x69306B2C)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3
-I.\RTE\_MR16
-ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include
-ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB
-o mr16\config.o --omf_browse mr16\config.crf --depend mr16\config.d)
|
||||
I (../User/module/config.h)(0x69305B59)
|
||||
I (D:\cangming\ARM\ARMCC\include\stdint.h)(0x5E8E3CC2)
|
||||
I (../User/device/sx1281_driver/sx1281.h)(0x693056E4)
|
||||
I (D:\cangming\ARM\ARMCC\include\stdbool.h)(0x5E8E3CC2)
|
||||
I (../User/device/sx1281_driver/sx1281_driver.h)(0x692DCACF)
|
||||
I (D:\cangming\ARM\ARMCC\include\math.h)(0x5E8E3CC2)
|
||||
I (../User/device/device.h)(0x692EA1CD)
|
||||
I (../User/module/mr16.h)(0x693057A1)
|
||||
F (..\User\module\config.h)(0x69305B59)()
|
||||
F (..\User\task\init.c)(0x692EA1CB)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3
-I.\RTE\_MR16
-ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include
-ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB
-o mr16\init.o --omf_browse mr16\init.crf --depend mr16\init.d)
|
||||
I (../User/task/user_task.h)(0x692EA1CB)
|
||||
I (../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.h)(0x67480A20)
|
||||
@ -1615,7 +1624,7 @@ I (../Middlewares/Third_Party/FreeRTOS/Source/include/mpu_wrappers.h)(0x67480A20
|
||||
I (../Middlewares/Third_Party/FreeRTOS/Source/include/task.h)(0x67480A20)
|
||||
I (../Middlewares/Third_Party/FreeRTOS/Source/include/list.h)(0x67480A20)
|
||||
F (..\User\task\user_task.h)(0x692EA1CB)()
|
||||
F (..\User\task\radio.c)(0x693058C5)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3
-I.\RTE\_MR16
-ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include
-ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB
-o mr16\radio.o --omf_browse mr16\radio.crf --depend mr16\radio.d)
|
||||
F (..\User\task\radio.c)(0x69305FB0)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3
-I.\RTE\_MR16
-ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include
-ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB
-o mr16\radio.o --omf_browse mr16\radio.crf --depend mr16\radio.d)
|
||||
I (../User/task/user_task.h)(0x692EA1CB)
|
||||
I (../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.h)(0x67480A20)
|
||||
I (D:\cangming\ARM\ARMCC\include\stdint.h)(0x5E8E3CC2)
|
||||
@ -1664,7 +1673,7 @@ I (../User/device/sx1281_driver/sx1281.h)(0x693056E4)
|
||||
I (../User/device/sx1281_driver/sx1281_driver.h)(0x692DCACF)
|
||||
I (D:\cangming\ARM\ARMCC\include\math.h)(0x5E8E3CC2)
|
||||
I (../User/device/device.h)(0x692EA1CD)
|
||||
I (../User/bsp/flash.h)(0x69304D87)
|
||||
I (../User/bsp/flash.h)(0x69306310)
|
||||
I (../User/bsp/bsp.h)(0x692EA1CC)
|
||||
I (../User/device/sx1281_driver/radio.h)(0x692C10EB)
|
||||
I (../User/module/config.h)(0x69305B59)
|
||||
|
||||
BIN
MDK-ARM/MR16/config.crf
Normal file
BIN
MDK-ARM/MR16/config.crf
Normal file
Binary file not shown.
9
MDK-ARM/MR16/config.d
Normal file
9
MDK-ARM/MR16/config.d
Normal file
@ -0,0 +1,9 @@
|
||||
mr16\config.o: ..\User\module\config.c
|
||||
mr16\config.o: ../User/module/config.h
|
||||
mr16\config.o: D:\cangming\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
mr16\config.o: ../User/device/sx1281_driver/sx1281.h
|
||||
mr16\config.o: D:\cangming\ARM\ARMCC\Bin\..\include\stdbool.h
|
||||
mr16\config.o: ../User/device/sx1281_driver/sx1281_driver.h
|
||||
mr16\config.o: D:\cangming\ARM\ARMCC\Bin\..\include\math.h
|
||||
mr16\config.o: ../User/device/device.h
|
||||
mr16\config.o: ../User/module/mr16.h
|
||||
BIN
MDK-ARM/MR16/config.o
Normal file
BIN
MDK-ARM/MR16/config.o
Normal file
Binary file not shown.
Binary file not shown.
@ -1,5 +1,7 @@
|
||||
mr16\flash.o: ..\User\bsp\flash.c
|
||||
mr16\flash.o: ../User/bsp\flash.h
|
||||
mr16\flash.o: ../User/bsp/flash.h
|
||||
mr16\flash.o: D:\cangming\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
mr16\flash.o: ../User/bsp/bsp.h
|
||||
mr16\flash.o: ../Core/Inc/main.h
|
||||
mr16\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h
|
||||
mr16\flash.o: ../Core/Inc/stm32f1xx_hal_conf.h
|
||||
@ -8,7 +10,6 @@ mr16\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h
|
||||
mr16\flash.o: ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h
|
||||
mr16\flash.o: ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h
|
||||
mr16\flash.o: ../Drivers/CMSIS/Include/core_cm3.h
|
||||
mr16\flash.o: D:\cangming\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
mr16\flash.o: ../Drivers/CMSIS/Include/cmsis_version.h
|
||||
mr16\flash.o: ../Drivers/CMSIS/Include/cmsis_compiler.h
|
||||
mr16\flash.o: ../Drivers/CMSIS/Include/cmsis_armcc.h
|
||||
@ -30,5 +31,3 @@ mr16\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_spi.h
|
||||
mr16\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h
|
||||
mr16\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h
|
||||
mr16\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h
|
||||
mr16\flash.o: ../User/bsp/bsp.h
|
||||
mr16\flash.o: D:\cangming\ARM\ARMCC\Bin\..\include\string.h
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
MDK-ARM/MR16/mr16.o
Normal file
BIN
MDK-ARM/MR16/mr16.o
Normal file
Binary file not shown.
Binary file not shown.
BIN
MDK-ARM/MR16/radio.o
Normal file
BIN
MDK-ARM/MR16/radio.o
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
193
User/bsp/flash.c
193
User/bsp/flash.c
@ -1,56 +1,167 @@
|
||||
/* Includes ----------------------------------------------------------------- */
|
||||
#include "bsp\flash.h"
|
||||
#include "flash.h"
|
||||
#include <main.h>
|
||||
#include <string.h>
|
||||
#include "bsp/flash.h"
|
||||
#include "bsp.h"
|
||||
|
||||
#include "main.h"
|
||||
|
||||
/* USER INCLUDE BEGIN */
|
||||
|
||||
/* USER INCLUDE END */
|
||||
/* Private define ----------------------------------------------------------- */
|
||||
/* USER DEFINE BEGIN */
|
||||
|
||||
/* USER DEFINE END */
|
||||
|
||||
/* Private macro ------------------------------------------------------------ */
|
||||
/* Private typedef ---------------------------------------------------------- */
|
||||
/* USER STRUCT BEGIN */
|
||||
|
||||
/* USER STRUCT END */
|
||||
|
||||
/* Private variables -------------------------------------------------------- */
|
||||
/* Private function -------------------------------------------------------- */
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
|
||||
void BSP_Flash_EraseSector(uint32_t sector) {
|
||||
FLASH_EraseInitTypeDef flash_erase;
|
||||
uint32_t sector_error;
|
||||
#include "flash.h"
|
||||
|
||||
#ifdef DEV_BOARD_C
|
||||
if (sector > 0 && sector < 12) {
|
||||
flash_erase.Sector = sector;
|
||||
flash_erase.TypeErase = FLASH_TYPEERASE_PAGES;
|
||||
flash_erase.VoltageRange = FLASH_VOLTAGE_RANGE_3;
|
||||
flash_erase.NbSectors = 1;
|
||||
FLASH_ProcessTypeDef p_Flash;
|
||||
uint16_t STMFLASH_BUF[STM_SECTOR_SIZE/2]; //缓存数组
|
||||
|
||||
/**********************************************************************************
|
||||
* 函数功能: 读取指定地址的半字(16位数据)
|
||||
* 输入参数: faddr:读地址
|
||||
* 返 回 值: 对应数据
|
||||
* 说 明:
|
||||
*/
|
||||
uint16_t STMFLASH_ReadHalfWord(uint32_t faddr)
|
||||
{
|
||||
return *(volatile uint16_t*)faddr;
|
||||
}
|
||||
|
||||
#if STM32_FLASH_WREN //如果使能了写
|
||||
/**********************************************************************************
|
||||
* 函数功能:不检查的写入
|
||||
* 输入参数: WriteAddr:起始地址、pBuffer:数据指针、NumToWrite:半字(16位)数
|
||||
* 返 回 值: 无
|
||||
* 说 明:
|
||||
*/
|
||||
void STMFLASH_Write_NoCheck(uint32_t WriteAddr,uint16_t *pBuffer,uint16_t NumToWrite)
|
||||
{
|
||||
uint16_t i;
|
||||
for(i=0;i<NumToWrite;i++)
|
||||
{
|
||||
HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD,WriteAddr,pBuffer[i]);
|
||||
WriteAddr+=2;//地址增加2.
|
||||
}
|
||||
}
|
||||
/**********************************************************************************
|
||||
* 函数功能:从指定地址开始写入指定长度的数据
|
||||
* 输入参数:WriteAddr:起始地址(此地址必须为2的倍数!!)、pBuffer:数据指针、NumToWrite:半字(16位)数(就是要写入的16位数据的个数.)
|
||||
* 返 回 值: 无
|
||||
* 说 明:
|
||||
*/
|
||||
void STMFLASH_Write(uint32_t WriteAddr,uint16_t *pBuffer,uint16_t NumToWrite)
|
||||
{
|
||||
uint32_t secpos; //扇区地址
|
||||
uint16_t secoff; //扇区内偏移地址(16位字计算)
|
||||
uint16_t secremain; //扇区内剩余地址(16位字计算)
|
||||
uint16_t i;
|
||||
uint32_t offaddr; //去掉0X08000000后的地址
|
||||
|
||||
if(WriteAddr<STM32_FLASH_BASE||(WriteAddr>=(STM32_FLASH_BASE+1024*STM32_FLASH_SIZE)))return;//非法地址
|
||||
|
||||
HAL_FLASH_Unlock(); //解锁
|
||||
offaddr=WriteAddr-STM32_FLASH_BASE; //实际偏移地址.
|
||||
secpos=offaddr/STM_SECTOR_SIZE; //扇区地址 0~64 for STM32F103C8T6
|
||||
secoff=(offaddr%STM_SECTOR_SIZE)/2; //在扇区内的偏移(2个字节为基本单位.)
|
||||
secremain=STM_SECTOR_SIZE/2-secoff; //扇区剩余空间大小
|
||||
if(NumToWrite<=secremain)secremain=NumToWrite;//不大于该扇区范围
|
||||
while(1)
|
||||
{
|
||||
STMFLASH_Read(secpos*STM_SECTOR_SIZE+STM32_FLASH_BASE,STMFLASH_BUF,STM_SECTOR_SIZE/2);//读出整个扇区的内容
|
||||
for(i=0;i<secremain;i++) //校验数据
|
||||
{
|
||||
if(STMFLASH_BUF[secoff+i]!=0XFFFF)break;//需要擦除
|
||||
}
|
||||
if(i<secremain) //需要擦除
|
||||
{
|
||||
Flash_PageErase(secpos*STM_SECTOR_SIZE+STM32_FLASH_BASE); //擦除这个扇区
|
||||
FLASH_WaitForLastOperation(FLASH_WAITETIME); //等待上次操作完成
|
||||
CLEAR_BIT(FLASH->CR, FLASH_CR_PER); //清除CR寄存器的PER位,此操作应该在FLASH_PageErase()中完成!
|
||||
//但是HAL库里面并没有做,应该是HAL库bug!
|
||||
for(i=0;i<secremain;i++)//复制
|
||||
{
|
||||
STMFLASH_BUF[i+secoff]=pBuffer[i];
|
||||
}
|
||||
STMFLASH_Write_NoCheck(secpos*STM_SECTOR_SIZE+STM32_FLASH_BASE,STMFLASH_BUF,STM_SECTOR_SIZE/2);//写入整个扇区
|
||||
}else
|
||||
{
|
||||
FLASH_WaitForLastOperation(FLASH_WAITETIME); //等待上次操作完成
|
||||
STMFLASH_Write_NoCheck(WriteAddr,pBuffer,secremain);//写已经擦除了的,直接写入扇区剩余区间.
|
||||
}
|
||||
if(NumToWrite==secremain)break;//写入结束了
|
||||
else//写入未结束
|
||||
{
|
||||
secpos++; //扇区地址增1
|
||||
secoff=0; //偏移位置为0
|
||||
pBuffer+=secremain; //指针偏移
|
||||
WriteAddr+=secremain*2; //写地址偏移(16位数据地址,需要*2)
|
||||
NumToWrite-=secremain; //字节(16位)数递减
|
||||
if(NumToWrite>(STM_SECTOR_SIZE/2))secremain=STM_SECTOR_SIZE/2;//下一个扇区还是写不完
|
||||
else secremain=NumToWrite;//下一个扇区可以写完了
|
||||
}
|
||||
};
|
||||
HAL_FLASH_Lock(); //上锁
|
||||
}
|
||||
#endif
|
||||
#ifdef STM32F103x8
|
||||
if (sector > 0 && sector < 12) {
|
||||
flash_erase.TypeErase = FLASH_TYPEERASE_PAGES;
|
||||
flash_erase.Banks = FLASH_BANK_1; // 单 bank 器件通常这样写
|
||||
flash_erase.PageAddress = ADDR_FLASH_SECTOR(sector); // 要擦除的页地址
|
||||
flash_erase.NbPages = 1;
|
||||
#endif
|
||||
HAL_FLASH_Unlock();
|
||||
while (FLASH_WaitForLastOperation(50) != HAL_OK)
|
||||
;
|
||||
HAL_FLASHEx_Erase(&flash_erase, §or_error);
|
||||
HAL_FLASH_Lock();
|
||||
}
|
||||
/**********************************************************************************
|
||||
* 函数功能:从指定地址开始读出指定长度的数据
|
||||
* 输入参数:ReadAddr:起始地址、pBuffer:数据指针、NumToWrite:半字(16位)数
|
||||
* 返 回 值: 无
|
||||
* 说 明:
|
||||
*/
|
||||
void STMFLASH_Read(uint32_t ReadAddr,uint16_t *pBuffer,uint16_t NumToRead)
|
||||
{
|
||||
uint16_t i;
|
||||
for(i=0;i<NumToRead;i++)
|
||||
{
|
||||
pBuffer[i]=STMFLASH_ReadHalfWord(ReadAddr);//读取2个字节.
|
||||
ReadAddr+=2;//偏移2个字节.
|
||||
}
|
||||
}
|
||||
|
||||
void BSP_Flash_WriteBytes(uint32_t address, const uint8_t *buf, size_t len) {
|
||||
HAL_FLASH_Unlock();
|
||||
while (len > 0) {
|
||||
while (FLASH_WaitForLastOperation(50) != HAL_OK)
|
||||
;
|
||||
HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, address, *buf);
|
||||
address++;
|
||||
buf++;
|
||||
len--;
|
||||
}
|
||||
HAL_FLASH_Lock();
|
||||
}
|
||||
/**********************************************************************************
|
||||
* 函数功能:擦除扇区
|
||||
* 输入参数:PageAddress:擦除扇区地址
|
||||
* 返 回 值: 无
|
||||
* 说 明:
|
||||
*/
|
||||
void Flash_PageErase(uint32_t PageAddress)
|
||||
{
|
||||
/* Clean the error context */
|
||||
p_Flash.ErrorCode = HAL_FLASH_ERROR_NONE;
|
||||
|
||||
void BSP_Flash_ReadBytes(uint32_t address, void *buf, size_t len) {
|
||||
memcpy(buf, (void *)address, len);
|
||||
}
|
||||
#if defined(FLASH_BANK2_END)
|
||||
if(PageAddress > FLASH_BANK1_END)
|
||||
{
|
||||
/* Proceed to erase the page */
|
||||
SET_BIT(FLASH->CR2, FLASH_CR2_PER);
|
||||
WRITE_REG(FLASH->AR2, PageAddress);
|
||||
SET_BIT(FLASH->CR2, FLASH_CR2_STRT);
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif /* FLASH_BANK2_END */
|
||||
/* Proceed to erase the page */
|
||||
SET_BIT(FLASH->CR, FLASH_CR_PER);
|
||||
WRITE_REG(FLASH->AR, PageAddress);
|
||||
SET_BIT(FLASH->CR, FLASH_CR_STRT);
|
||||
#if defined(FLASH_BANK2_END)
|
||||
|
||||
}
|
||||
#endif /* FLASH_BANK2_END */
|
||||
}
|
||||
|
||||
/* USER FUNCTION BEGIN */
|
||||
|
||||
/* USER FUNCTION END */
|
||||
@ -4,62 +4,47 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*4表示16KB(小容量ld), 6表示32KB(小容量ld), 8表示64KB(中容量md),
|
||||
B表示128KB(中容量md), C表示256 KB(大容量hd), E表示512 KB(大容量hd),
|
||||
F表示768KB(超大容量xl), G表示1024KB(超大容量xl), */
|
||||
/* Includes ------------------------------------------------------------------ */
|
||||
#include <main.h>
|
||||
/* Includes ----------------------------------------------------------------- */
|
||||
#include <stdint.h>
|
||||
|
||||
#include "bsp/bsp.h"
|
||||
|
||||
/* Exported constants -------------------------------------------------------- */
|
||||
/* USER INCLUDE BEGIN */
|
||||
|
||||
/* USER INCLUDE END */
|
||||
|
||||
/* Exported constants ------------------------------------------------------- */
|
||||
/* Exported macro ----------------------------------------------------------- */
|
||||
/* USER DEFINE BEGIN */
|
||||
|
||||
/* USER DEFINE END */
|
||||
|
||||
/* Exported types ----------------------------------------------------------- */
|
||||
/* Exported functions prototypes -------------------------------------------- */
|
||||
|
||||
#include "main.h"
|
||||
|
||||
//=========================用户根据自己的需要设置
|
||||
#define STM32_FLASH_SIZE 64 //所选STM32的FLASH容量大小(单位为K)
|
||||
#if STM32_FLASH_SIZE < 256 //设置扇区大小
|
||||
#define STM_SECTOR_SIZE 1024 //1K字节
|
||||
#else
|
||||
#define STM_SECTOR_SIZE 2048 //2K字节
|
||||
#endif
|
||||
#define STM32_FLASH_BASE 0x08000000 //STM32 FLASH的起始地址
|
||||
#define FLASH_SAVE_ADDR STM32_FLASH_BASE+STM_SECTOR_SIZE*56 //写Flash的地址,这里从倒数第二页开始
|
||||
#define STM32_FLASH_WREN 1 //使能FLASH写入(0,不使能;1,使能)
|
||||
#define FLASH_WAITETIME 50000 //FLASH等待超时时间
|
||||
|
||||
|
||||
/* Exported macro ------------------------------------------------------------ */
|
||||
uint16_t STMFLASH_ReadHalfWord(uint32_t faddr); //读出半字
|
||||
void STMFLASH_Write(uint32_t WriteAddr,uint16_t *pBuffer,uint16_t NumToWrite); //从指定地址开始写入指定长度的数据
|
||||
void STMFLASH_Read(uint32_t ReadAddr,uint16_t *pBuffer,uint16_t NumToRead); //从指定地址开始读出指定长度的数据
|
||||
void Flash_PageErase(uint32_t PageAddress); //扇区擦除
|
||||
|
||||
#define STM32F103x8
|
||||
#ifdef STM32F103x8
|
||||
/*
|
||||
页0 0x0800 0000-0x0800 07FF
|
||||
页1 0x0800 0800-0x0800 0FFF
|
||||
页2 0x0800 1000-0x0800 17FF
|
||||
页3 0x0800 1800-0x0800 1FFF
|
||||
页255 0x0807 F800-0x0807 FFFF
|
||||
系统存储器 0x1FFF F000 -0x1FFF F7FF
|
||||
*/
|
||||
#define ADDR_FLASH_SECTOR(x) ((uint32_t)0x08000000) + ((x) * 0x800) //每个扇区2KB
|
||||
#endif
|
||||
/* USER FUNCTION BEGIN */
|
||||
|
||||
/* Base address of the Flash sectors */
|
||||
#define ADDR_FLASH_SECTOR_0 ((uint32_t)0x08000000)
|
||||
/* Base address of Sector 0, 16 Kbytes */
|
||||
#define ADDR_FLASH_SECTOR_1 ((uint32_t)0x08004000)
|
||||
/* Base address of Sector 1, 16 Kbytes */
|
||||
#define ADDR_FLASH_SECTOR_2 ((uint32_t)0x08008000)
|
||||
/* Base address of Sector 2, 16 Kbytes */
|
||||
#define ADDR_FLASH_SECTOR_3 ((uint32_t)0x0800C000)
|
||||
/* Base address of Sector 3, 16 Kbytes */
|
||||
#define ADDR_FLASH_SECTOR_4 ((uint32_t)0x08010000)
|
||||
/* Base address of Sector 4, 64 Kbytes */
|
||||
#define ADDR_FLASH_SECTOR_5 ((uint32_t)0x08020000)
|
||||
/* Base address of Sector 5, 128 Kbytes */
|
||||
#define ADDR_FLASH_SECTOR_6 ((uint32_t)0x08040000)
|
||||
/* Base address of Sector 6, 128 Kbytes */
|
||||
#define ADDR_FLASH_SECTOR_7 ((uint32_t)0x08060000)
|
||||
/* Base address of Sector 7, 128 Kbytes */
|
||||
#define ADDR_FLASH_SECTOR_8 ((uint32_t)0x08080000)
|
||||
/* Base address of Sector 8, 128 Kbytes */
|
||||
#define ADDR_FLASH_SECTOR_9 ((uint32_t)0x080A0000)
|
||||
/* Base address of Sector 9, 128 Kbytes */
|
||||
#define ADDR_FLASH_SECTOR_10 ((uint32_t)0x080C0000)
|
||||
/* Base address of Sector 10, 128 Kbytes */
|
||||
#define ADDR_FLASH_SECTOR_11 ((uint32_t)0x080E0000)
|
||||
/* Base address of Sector 11, 128 Kbytes */
|
||||
/* Exported types ------------------------------------------------------------ */
|
||||
/* Exported functions prototypes --------------------------------------------- */
|
||||
void BSP_Flash_EraseSector(uint32_t sector);
|
||||
void BSP_Flash_WriteBytes(uint32_t address, const uint8_t *buf, size_t len);
|
||||
void BSP_Flash_ReadBytes(uint32_t address, void *buf, size_t len);
|
||||
/* USER FUNCTION END */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@ -285,101 +285,78 @@ int8_t SX1281_Init(SX1281_t *radio, SX1281_Params_t *param,SX1281_RadioMode_t mo
|
||||
|
||||
#ifdef SX1281_VIEW
|
||||
/* 打印版本号,检查SPI是否跑通 */
|
||||
printf( "\n\n\r SX1281 Application. %s\n\n\r", FIRMWARE_VERSION );
|
||||
printf( "\n\n\r Radio firmware version 0x%x\n\n\r", Radio.GetFirmwareVersion( ) );
|
||||
char radioInit[]={
|
||||
"\n\n\r "
|
||||
"***********************************************************\r\n"
|
||||
" SX1281 Application. %s"
|
||||
|
||||
};
|
||||
|
||||
printf( "\r\n" );
|
||||
printf( "============================================================\r\n" );
|
||||
printf( " SX1281 Radio Initialization\r\n" );
|
||||
printf( "============================================================\r\n" );
|
||||
printf( " Application Version : %s\r\n", FIRMWARE_VERSION );
|
||||
printf( " Firmware Version : 0x%04X\r\n", Radio.GetFirmwareVersion( ) );
|
||||
printf( "============================================================\r\n" );
|
||||
#endif //SX1281_VIEW
|
||||
|
||||
/* 默认属性 */
|
||||
radio->param->baudrate.ble=RF_BAUDRATE_BLE_1M;
|
||||
radio->param->baudrate.lora=RF_BAUDRATE_LORA_005K;
|
||||
radio->param->baudrate.gfks=RF_BAUDRATE_GFSK_125K;
|
||||
radio->param->baudrate.flrc=RF_BAUDRATE_FLRC_130K;
|
||||
|
||||
/* 根据模式选择属性 */
|
||||
switch (mode) {
|
||||
case RADIOMODE_BLE:
|
||||
#ifdef SX1281_VIEW
|
||||
printf( "\nrunning in BLE mode\n\r" );
|
||||
#endif //SX1281_VIEW
|
||||
radio->param->modulationParams.PacketType = PACKET_TYPE_BLE;
|
||||
radio->param->modulationParams.Params.Ble.BitrateBandwidth
|
||||
= bleConfigList[radio->param->baudrate.ble].BitrateBandwidth;
|
||||
radio->param->modulationParams.Params.Ble.ModulationIndex
|
||||
= bleConfigList[radio->param->baudrate.ble].ModulationIndex;
|
||||
radio->param->modulationParams.Params.Ble.ModulationShaping
|
||||
= bleConfigList[radio->param->baudrate.ble].ModulationShaping;
|
||||
radio->param->modulationParams.Params.Ble.BitrateBandwidth
|
||||
= bleConfigList[radio->param->baudrate.ble].BitrateBandwidth;
|
||||
radio->param->modulationParams.Params.Ble.ModulationIndex
|
||||
= bleConfigList[radio->param->baudrate.ble].ModulationIndex;
|
||||
radio->param->modulationParams.Params.Ble.ModulationShaping
|
||||
= bleConfigList[radio->param->baudrate.ble].ModulationShaping;
|
||||
radio->param->packetParams.Params.Ble.BlePacketType = BLE_EYELONG_1_0;
|
||||
radio->param->packetParams.Params.Ble.ConnectionState = BLE_ADVERTISER;
|
||||
radio->param->packetParams.Params.Ble.CrcField = BLE_CRC_3B;
|
||||
radio->param->packetParams.Params.Ble.Whitening = RADIO_WHITENING_ON;
|
||||
|
||||
radio->param->packetParams.PacketType = PACKET_TYPE_BLE;
|
||||
radio->param->packetParams.Params.Ble.BlePacketType = BLE_EYELONG_1_0;
|
||||
radio->param->packetParams.Params.Ble.ConnectionState = BLE_ADVERTISER;
|
||||
radio->param->packetParams.Params.Ble.CrcField = BLE_CRC_3B;
|
||||
radio->param->packetParams.Params.Ble.Whitening = RADIO_WHITENING_ON;
|
||||
break;
|
||||
case RADIOMODE_LORA:
|
||||
#ifdef SX1281_VIEW
|
||||
printf( "\nrunning in LORA mode\n\r" );
|
||||
#endif //SX1281_VIEW
|
||||
radio->param->modulationParams.PacketType = PACKET_TYPE_LORA;
|
||||
radio->param->modulationParams.Params.LoRa.SpreadingFactor
|
||||
= loraConfigList[radio->param->baudrate.lora].SpreadingFactor;
|
||||
radio->param->modulationParams.Params.LoRa.Bandwidth
|
||||
= loraConfigList[radio->param->baudrate.lora].Bandwidth;
|
||||
radio->param->modulationParams.Params.LoRa.CodingRate
|
||||
= loraConfigList[radio->param->baudrate.lora].CodingRate;
|
||||
radio->param->modulationParams.Params.LoRa.SpreadingFactor
|
||||
= loraConfigList[radio->param->baudrate.lora].SpreadingFactor;
|
||||
radio->param->modulationParams.Params.LoRa.Bandwidth
|
||||
= loraConfigList[radio->param->baudrate.lora].Bandwidth;
|
||||
radio->param->modulationParams.Params.LoRa.CodingRate
|
||||
= loraConfigList[radio->param->baudrate.lora].CodingRate;
|
||||
radio->param->packetParams.Params.LoRa.PreambleLength = 12;
|
||||
radio->param->packetParams.Params.LoRa.HeaderType = LORA_PACKET_VARIABLE_LENGTH;
|
||||
radio->param->packetParams.Params.LoRa.PayloadLength = BUFFER_SIZE;
|
||||
radio->param->packetParams.Params.LoRa.CrcMode = LORA_CRC_ON;
|
||||
radio->param->packetParams.Params.LoRa.InvertIQ = LORA_IQ_NORMAL;
|
||||
|
||||
radio->param->packetParams.PacketType = PACKET_TYPE_LORA;
|
||||
radio->param->packetParams.Params.LoRa.PreambleLength = 12;
|
||||
radio->param->packetParams.Params.LoRa.HeaderType = LORA_PACKET_VARIABLE_LENGTH;
|
||||
radio->param->packetParams.Params.LoRa.PayloadLength = BUFFER_SIZE;
|
||||
radio->param->packetParams.Params.LoRa.CrcMode = LORA_CRC_ON;
|
||||
radio->param->packetParams.Params.LoRa.InvertIQ = LORA_IQ_NORMAL;
|
||||
break;
|
||||
case RADIOMODE_GFSK:
|
||||
#ifdef SX1281_VIEW
|
||||
printf( "\nrunning in GFSK mode\n\r" );
|
||||
#endif //SX1281_VIEW
|
||||
radio->param->modulationParams.PacketType = PACKET_TYPE_GFSK;
|
||||
radio->param->modulationParams.Params.Gfsk.BitrateBandwidth
|
||||
= gfskConfigList[radio->param->baudrate.gfks].BitrateBandwidth;
|
||||
radio->param->modulationParams.Params.Gfsk.ModulationIndex
|
||||
= gfskConfigList[radio->param->baudrate.gfks].ModulationIndex;
|
||||
radio->param->modulationParams.Params.Gfsk.ModulationShaping
|
||||
= gfskConfigList[radio->param->baudrate.gfks].ModulationShaping;
|
||||
|
||||
radio->param->packetParams.PacketType = PACKET_TYPE_GFSK;
|
||||
radio->param->packetParams.Params.Gfsk.PreambleLength = PREAMBLE_LENGTH_32_BITS;
|
||||
radio->param->packetParams.Params.Gfsk.SyncWordLength = GFS_SYNCWORD_LENGTH_5_BYTE;
|
||||
radio->param->packetParams.Params.Gfsk.SyncWordMatch = RADIO_RX_MATCH_SYNCWORD_1;
|
||||
radio->param->packetParams.Params.Gfsk.HeaderType = RADIO_PACKET_VARIABLE_LENGTH;
|
||||
radio->param->packetParams.Params.Gfsk.PayloadLength = BUFFER_SIZE;
|
||||
radio->param->packetParams.Params.Gfsk.CrcLength = RADIO_CRC_3_BYTES;
|
||||
radio->param->packetParams.Params.Gfsk.Whitening = RADIO_WHITENING_ON;
|
||||
break;
|
||||
case RADIOMODE_FLRC:
|
||||
#ifdef SX1281_VIEW
|
||||
printf( "\nrunning in FLRC mode\n\r" );
|
||||
#endif //SX1281_VIEW
|
||||
radio->param->modulationParams.PacketType = PACKET_TYPE_FLRC;
|
||||
radio->param->modulationParams.Params.Flrc.BitrateBandwidth
|
||||
= flrcConfigList[radio->param->baudrate.flrc].BitrateBandwidth;
|
||||
radio->param->modulationParams.Params.Flrc.CodingRate
|
||||
= flrcConfigList[radio->param->baudrate.flrc].CodingRate;
|
||||
radio->param->modulationParams.Params.Flrc.ModulationShaping
|
||||
= flrcConfigList[radio->param->baudrate.flrc].ModulationShaping;
|
||||
|
||||
radio->param->packetParams.PacketType = PACKET_TYPE_FLRC;
|
||||
radio->param->packetParams.Params.Flrc.PreambleLength = PREAMBLE_LENGTH_32_BITS;
|
||||
radio->param->packetParams.Params.Flrc.SyncWordLength = FLRC_SYNCWORD_LENGTH_4_BYTE;
|
||||
radio->param->packetParams.Params.Flrc.SyncWordMatch = RADIO_RX_MATCH_SYNCWORD_1;
|
||||
radio->param->packetParams.Params.Flrc.HeaderType = RADIO_PACKET_VARIABLE_LENGTH;
|
||||
radio->param->packetParams.Params.Flrc.PayloadLength = BUFFER_SIZE;
|
||||
radio->param->packetParams.Params.Flrc.CrcLength = RADIO_CRC_3_BYTES;
|
||||
radio->param->packetParams.Params.Flrc.Whitening = RADIO_WHITENING_OFF;
|
||||
|
||||
break;
|
||||
default:
|
||||
return DEVICE_ERR;
|
||||
}
|
||||
radio->param->modulationParams.Params.Gfsk.BitrateBandwidth
|
||||
= gfskConfigList[radio->param->baudrate.gfks].BitrateBandwidth;
|
||||
radio->param->modulationParams.Params.Gfsk.ModulationIndex
|
||||
= gfskConfigList[radio->param->baudrate.gfks].ModulationIndex;
|
||||
radio->param->modulationParams.Params.Gfsk.ModulationShaping
|
||||
= gfskConfigList[radio->param->baudrate.gfks].ModulationShaping;
|
||||
radio->param->packetParams.Params.Gfsk.PreambleLength = PREAMBLE_LENGTH_32_BITS;
|
||||
radio->param->packetParams.Params.Gfsk.SyncWordLength = GFS_SYNCWORD_LENGTH_5_BYTE;
|
||||
radio->param->packetParams.Params.Gfsk.SyncWordMatch = RADIO_RX_MATCH_SYNCWORD_1;
|
||||
radio->param->packetParams.Params.Gfsk.HeaderType = RADIO_PACKET_VARIABLE_LENGTH;
|
||||
radio->param->packetParams.Params.Gfsk.PayloadLength = BUFFER_SIZE;
|
||||
radio->param->packetParams.Params.Gfsk.CrcLength = RADIO_CRC_3_BYTES;
|
||||
radio->param->packetParams.Params.Gfsk.Whitening = RADIO_WHITENING_ON;
|
||||
|
||||
radio->param->modulationParams.Params.Flrc.BitrateBandwidth
|
||||
= flrcConfigList[radio->param->baudrate.flrc].BitrateBandwidth;
|
||||
radio->param->modulationParams.Params.Flrc.CodingRate
|
||||
= flrcConfigList[radio->param->baudrate.flrc].CodingRate;
|
||||
radio->param->modulationParams.Params.Flrc.ModulationShaping
|
||||
= flrcConfigList[radio->param->baudrate.flrc].ModulationShaping;
|
||||
radio->param->packetParams.Params.Flrc.PreambleLength = PREAMBLE_LENGTH_32_BITS;
|
||||
radio->param->packetParams.Params.Flrc.SyncWordLength = FLRC_SYNCWORD_LENGTH_4_BYTE;
|
||||
radio->param->packetParams.Params.Flrc.SyncWordMatch = RADIO_RX_MATCH_SYNCWORD_1;
|
||||
radio->param->packetParams.Params.Flrc.HeaderType = RADIO_PACKET_VARIABLE_LENGTH;
|
||||
radio->param->packetParams.Params.Flrc.PayloadLength = BUFFER_SIZE;
|
||||
radio->param->packetParams.Params.Flrc.CrcLength = RADIO_CRC_3_BYTES;
|
||||
radio->param->packetParams.Params.Flrc.Whitening = RADIO_WHITENING_OFF;
|
||||
/* 默认功率13dBm */
|
||||
radio->param->txOutputPower=13;
|
||||
radio->param->rampTime=RADIO_RAMP_02_US;
|
||||
@ -403,6 +380,39 @@ int8_t SX1281_Init(SX1281_t *radio, SX1281_Params_t *param,SX1281_RadioMode_t mo
|
||||
memcpy(radio->param->syncWord.gfsk.second, sync2, sizeof(sync2));
|
||||
memcpy(radio->param->syncWord.gfsk.third, sync3, sizeof(sync3));
|
||||
}
|
||||
/* 根据模式选择属性 */
|
||||
switch (mode) {
|
||||
case RADIOMODE_BLE:
|
||||
#ifdef SX1281_VIEW
|
||||
printf( "\r\n[*] Radio Mode: BLE (Bluetooth Low Energy)\r\n" );
|
||||
#endif //SX1281_VIEW
|
||||
radio->param->modulationParams.PacketType = PACKET_TYPE_BLE;
|
||||
radio->param->packetParams.PacketType = PACKET_TYPE_BLE;
|
||||
break;
|
||||
case RADIOMODE_LORA:
|
||||
#ifdef SX1281_VIEW
|
||||
printf( "\r\n[*] Radio Mode: LORA (Long Range)\r\n" );
|
||||
#endif //SX1281_VIEW
|
||||
radio->param->modulationParams.PacketType = PACKET_TYPE_LORA;
|
||||
radio->param->packetParams.PacketType = PACKET_TYPE_LORA;
|
||||
break;
|
||||
case RADIOMODE_GFSK:
|
||||
#ifdef SX1281_VIEW
|
||||
printf( "\r\n[*] Radio Mode: GFSK (Gaussian FSK)\r\n" );
|
||||
#endif //SX1281_VIEW
|
||||
radio->param->modulationParams.PacketType = PACKET_TYPE_GFSK;
|
||||
radio->param->packetParams.PacketType = PACKET_TYPE_GFSK;
|
||||
break;
|
||||
case RADIOMODE_FLRC:
|
||||
#ifdef SX1281_VIEW
|
||||
printf( "\r\n[*] Radio Mode: FLRC (Fast Long Range Communication)\r\n" );
|
||||
#endif //SX1281_VIEW
|
||||
radio->param->modulationParams.PacketType = PACKET_TYPE_FLRC;
|
||||
radio->param->packetParams.PacketType = PACKET_TYPE_FLRC;
|
||||
break;
|
||||
default:
|
||||
return DEVICE_ERR;
|
||||
}
|
||||
/* 设置属性 */
|
||||
Radio.SetStandby( STDBY_RC );
|
||||
Radio.SetPacketType( radio->param->modulationParams.PacketType );//包类型
|
||||
@ -421,6 +431,27 @@ int8_t SX1281_Init(SX1281_t *radio, SX1281_Params_t *param,SX1281_RadioMode_t mo
|
||||
Radio.SetPollingMode();
|
||||
#endif
|
||||
|
||||
#ifdef SX1281_VIEW
|
||||
printf( "\r\n" );
|
||||
printf( "------------------------------------------------------------\r\n" );
|
||||
printf( " Configuration Summary\r\n" );
|
||||
printf( "------------------------------------------------------------\r\n" );
|
||||
printf( " RF Frequency : %llu Hz (%.1f MHz)\r\n",
|
||||
(unsigned long long)radio->param->rfFrequency, radio->param->rfFrequency/1000000.0f );
|
||||
printf( " TX Power : %d dBm\r\n",
|
||||
radio->param->txOutputPower );
|
||||
printf( " Buffer Size : %d bytes\r\n",
|
||||
BUFFER_SIZE );
|
||||
#ifdef SX1281_INTERRUP_MODE
|
||||
printf( " Mode : INTERRUPT\r\n" );
|
||||
#endif
|
||||
#ifdef SX1281_POLLING_MODE
|
||||
printf( " Mode : POLLING\r\n" );
|
||||
#endif
|
||||
printf( "------------------------------------------------------------\r\n" );
|
||||
printf( "\r\n[*] SX1281 Initialization Complete!\r\n\r\n" );
|
||||
#endif //SX1281_VIEW
|
||||
|
||||
/* 还没搞懂这里是干啥的 */
|
||||
// if (radio->param->radioMode==RADIOMODE_BLE) {
|
||||
// // only used in GENERIC and BLE mode
|
||||
@ -744,13 +775,16 @@ __attribute__((weak)) int8_t SX1281_Callback(SX1281_States_t source) {
|
||||
case RX_DONE:
|
||||
#ifdef SX1281_VIEW
|
||||
/* 打印状态 */
|
||||
printf( "<>>>>>>>>OnRxDone" );
|
||||
printf( "\r\n[RX] >>> Packet Received <<<\r\n" );
|
||||
#endif
|
||||
/* 从缓冲区拿数据 */
|
||||
uint8_t radioRXSize = 0;
|
||||
uint8_t radioRXBuffer[BUFFER_SIZE]={0};
|
||||
Radio.GetPayload( radioRXBuffer, &radioRXSize, BUFFER_SIZE);
|
||||
radioRXBuffer[radioRXSize+1] = 0;
|
||||
#ifdef SX1281_VIEW
|
||||
printf( "[RX] Size: %d bytes\r\n", radioRXSize );
|
||||
#endif
|
||||
/* 重启接收 */
|
||||
//Radio.SetRx( ( TickTime_t ) { RX_TIMEOUT_TICK_SIZE, RX_TIMEOUT_VALUE } );
|
||||
break;
|
||||
@ -758,7 +792,7 @@ __attribute__((weak)) int8_t SX1281_Callback(SX1281_States_t source) {
|
||||
case RX_TIMEOUT:
|
||||
#ifdef SX1281_VIEW
|
||||
/* 打印状态 */
|
||||
printf( "<>>>>>>>>OnRXTimeout" );
|
||||
printf( "\r\n[RX] ... Timeout (Restarting RX)\r\n" );
|
||||
#endif
|
||||
//Radio.SetRx( ( TickTime_t ) { RX_TIMEOUT_TICK_SIZE, RX_TIMEOUT_VALUE } );
|
||||
Radio.SetRx( ( TickTime_t ) { RX_TIMEOUT_TICK_SIZE, 0xFFFF } );
|
||||
@ -767,7 +801,7 @@ __attribute__((weak)) int8_t SX1281_Callback(SX1281_States_t source) {
|
||||
case RX_ERROR:
|
||||
#ifdef SX1281_VIEW
|
||||
/* 打印状态 */
|
||||
printf( "<>>>>>>>>OnRxErr" );
|
||||
printf( "\r\n[RX] !!! ERROR - Reception Failed !!!\r\n" );
|
||||
#endif
|
||||
// SX1281_SetRXSuccessive(&radio);
|
||||
break;
|
||||
@ -775,7 +809,7 @@ __attribute__((weak)) int8_t SX1281_Callback(SX1281_States_t source) {
|
||||
case TX_DONE:
|
||||
#ifdef SX1281_VIEW
|
||||
/* 打印状态 */
|
||||
printf( "<>>>>>>>>OnTxDone" );
|
||||
printf( "\r\n[TX] <<< Packet Sent Successfully >>>\r\n" );
|
||||
#endif
|
||||
// SX1281_SetTX(&radio,(uint8_t*)"hello", 5);
|
||||
break;
|
||||
@ -783,7 +817,7 @@ __attribute__((weak)) int8_t SX1281_Callback(SX1281_States_t source) {
|
||||
case TX_TIMEOUT:
|
||||
#ifdef SX1281_VIEW
|
||||
/* 打印状态 */
|
||||
printf( "<>>>>>>>>OnTxTimeout" );
|
||||
printf( "\r\n[TX] !!! TIMEOUT - Transmission Failed !!!\r\n" );
|
||||
#endif
|
||||
// SX1281_SetTX(&radio,(uint8_t*)"hello", 5);
|
||||
|
||||
@ -792,7 +826,7 @@ __attribute__((weak)) int8_t SX1281_Callback(SX1281_States_t source) {
|
||||
case LORA_CAD_DONE:
|
||||
#ifdef SX1281_VIEW
|
||||
/* 打印状态 */
|
||||
printf( "<>>>>>>>>OnCadDone" );
|
||||
printf( "\r\n[CAD] Channel Activity Detected\r\n" );
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
// 机器人参数配置
|
||||
Config_t robot_config = {
|
||||
.mr16={
|
||||
.TX_ID=0x0001,
|
||||
.TX_ID=0xf1e2,
|
||||
|
||||
}
|
||||
|
||||
@ -28,6 +28,6 @@ Config_t robot_config = {
|
||||
* @brief 获取机器人配置参数
|
||||
* @return 机器人配置参数指针
|
||||
*/
|
||||
Config_t* Config_GetRobotParam(void) {
|
||||
Config_t* Config_Get(void) {
|
||||
return &robot_config;
|
||||
}
|
||||
@ -12,6 +12,7 @@ extern "C" {
|
||||
#include "device/sx1281_driver/sx1281.h"
|
||||
#include "module/mr16.h"
|
||||
typedef struct {
|
||||
uint32_t earsed_count; // 擦除计数
|
||||
MR16_Param_t mr16;
|
||||
} Config_t;
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ int8_t SX1281_Callback(SX1281_States_t source) {
|
||||
switch (source) {
|
||||
case RX_DONE:
|
||||
/* 打印状态 */
|
||||
printf( "<>>>>>>>>OnRxDone" );
|
||||
printf( "\r\n[RX] >>> Packet Received <<<\r\n" );
|
||||
/* 从缓冲区拿数据 */
|
||||
radioRXSize = 0;
|
||||
Radio.GetPayload( radioRXBuffer, &radioRXSize, BUFFER_SIZE);
|
||||
@ -103,23 +103,26 @@ int8_t SX1281_Callback(SX1281_States_t source) {
|
||||
mr16.packetCount[i]++;
|
||||
}
|
||||
}
|
||||
printf( "[RX] Header: 0x%04X | Size: %d bytes | Count: %d\r\n",
|
||||
RXheader, radioRXSize, mr16.packetCount[0]+mr16.packetCount[1]+mr16.packetCount[2] );
|
||||
break;
|
||||
|
||||
case RX_TIMEOUT:
|
||||
/* 打印状态 */
|
||||
printf( "<>>>>>>>>OnRXTimeout" );
|
||||
printf( "\r\n[RX] ... Timeout (Restarting RX)\r\n" );
|
||||
SX1281_SetRXSuccessive(&radio);
|
||||
break;
|
||||
|
||||
case RX_ERROR:
|
||||
/* 打印状态 */
|
||||
printf( "<>>>>>>>>OnRxErr" );
|
||||
printf( "\r\n[RX] !!! ERROR - Reception Failed !!!\r\n" );
|
||||
Radio.SetRx( ( TickTime_t ) { RADIO_TICK_SIZE_1000_US, 0x1000 } );
|
||||
break;
|
||||
|
||||
case TX_DONE:
|
||||
/* 打印状态 */
|
||||
printf( "<>>>>>>>>OnTxDone" );
|
||||
printf( "\r\n[TX] <<< Packet Sent Successfully >>>\r\n" );
|
||||
printf( "[TX] Length: %d bytes\r\n", mr16.txbuffer[2]+5 );
|
||||
// radio.param.packetParams.Params.Flrc.PayloadLength = data_length;
|
||||
// Radio.SetPacketParams( &radio.param.packetParams );
|
||||
// a++;if (a>100) a=0;
|
||||
@ -131,13 +134,13 @@ int8_t SX1281_Callback(SX1281_States_t source) {
|
||||
|
||||
case TX_TIMEOUT:
|
||||
/* 打印状态 */
|
||||
printf( "<>>>>>>>>OnTxTimeout" );
|
||||
printf( "\r\n[TX] !!! TIMEOUT - Transmission Failed !!!\r\n" );
|
||||
|
||||
break;
|
||||
|
||||
case LORA_CAD_DONE:
|
||||
/* 打印状态 */
|
||||
printf( "<>>>>>>>>OnCadDone" );
|
||||
printf( "\r\n[CAD] Channel Activity Detected\r\n" );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -163,8 +166,10 @@ int8_t MR16_Init(MR16_t *mr16, MR16_Param_t *param, MR16_Mode_t mr16Mode, SX1281
|
||||
MR16_CLI_Init();
|
||||
|
||||
mr16->param=param;
|
||||
mr16->param->mode=mr16Mode;
|
||||
MR16_FSM=MR16_FSM_INIT;
|
||||
///////////////////待解决flash和SX1281Init中默认参数的问题
|
||||
STMFLASH_Read(FLASH_SAVE_ADDR, (uint16_t*)&Config_Get()->mr16, sizeof(MR16_Param_t)/2);
|
||||
// mr16->param->mode=mr16Mode;
|
||||
// MR16_FSM=MR16_FSM_INIT;
|
||||
SX1281_Init(&radio, ¶m->radioParams, radioMode);
|
||||
// SX1281_SetTX(&radio,uart_data,data_length);
|
||||
SX1281_SetRXSuccessive(&radio);
|
||||
@ -180,13 +185,13 @@ void MR16_NotifyUARTIdle(void)
|
||||
{
|
||||
UART2_IdleFlag=true;
|
||||
}
|
||||
char cInputBuffer[256];
|
||||
char cOutputBuffer[256];
|
||||
|
||||
static char cInputBuffer[64];
|
||||
static char cOutputBuffer[256];
|
||||
int8_t MR16_Main(MR16_t *mr16, uint8_t data[],uint8_t data_length) {
|
||||
|
||||
if (UART2_IdleFlag==true) {
|
||||
UART2_IdleFlag = false;
|
||||
mr16->param->mode=MR16_MODE_SETTING;
|
||||
|
||||
if (uart2_datalength > 0 && uart2_datalength < sizeof(cInputBuffer)) {
|
||||
memcpy(cInputBuffer, uart2_data, uart2_datalength);
|
||||
@ -237,9 +242,82 @@ int8_t MR16_Main(MR16_t *mr16, uint8_t data[],uint8_t data_length) {
|
||||
CLI
|
||||
|
||||
--------------------------------------------------*/
|
||||
static const char radio_help_en[] =
|
||||
"============================================================================\r\n"
|
||||
"radio <subcmd> [args] - SX1281 radio control\r\n"
|
||||
" mode <BLE|LORA|GFSK|FLRC> - Change working mode\r\n"
|
||||
" modulation <field> <value> - Set modulation parameters\r\n"
|
||||
" packet <field> <value> - Set packet parameters\r\n"
|
||||
" baudrate <mode> <index> - Set baudrate\r\n"
|
||||
" power <dBm> - Set TX power (-18..+13)\r\n"
|
||||
" ramptime <us> - Set ramp time (2|4|6|8|10|12|16|20)\r\n"
|
||||
" rffreq <Hz> - Set RF frequency\r\n"
|
||||
" tx | rx - TX/RX operations\r\n"
|
||||
" modulation help | packet help - Show detailed help\r\n"
|
||||
"============================================================================\r\n";
|
||||
|
||||
static const char modulation_help[] =
|
||||
"============================================================================================================\r\n"
|
||||
"modulation <field> <value> - Set modulation parameters\r\n"
|
||||
" BLE/GFSK fields:\r\n"
|
||||
" br_bw : 0x04(2.0M/2.4M)||0x28(1.6M/2.4M)||0x4C(1.0M/2.4M)||0x45(1.0M/1.2M)\r\n"
|
||||
" 0x70(0.8M/2.4M)||0x69(0.8M/1.2M)||0x8D(0.5M/1.2M)||0x86(0.5M/0.6M)\r\n"
|
||||
" 0xB1(0.4M/1.2M)||0xAA(0.4M/0.6M)||0xCE(0.25M/0.6M)||0xC7(0.25M/0.3M)||0xEF(0.125M/0.3M)\r\n"
|
||||
" modindex : 0(0.35)||1(0.50)||2(0.75)||3(1.00)||4(1.25)||5(1.50)||6(1.75)||7(2.00)\r\n"
|
||||
" 8(2.25)||9(2.50)||10(2.75)||11(3.00)||12(3.25)||13(3.50)||14(3.75)||15(4.00)\r\n"
|
||||
" shaping : 0x00(OFF)||0x10(BT_1_0)||0x20(BT_0_5)\r\n"
|
||||
" LORA fields:\r\n"
|
||||
" sf : 0x50(SF5)||0x60(SF6)||0x70(SF7)||0x80(SF8)||0x90(SF9)||0xA0(SF10)||0xB0(SF11)||0xC0(SF12)\r\n"
|
||||
" bw : 0x34(BW_200K)||0x26(BW_400K)||0x18(BW_800K)||0x0A(BW_1600K)\r\n"
|
||||
" cr : 0x01(4/5)||0x02(4/6)||0x03(4/7)||0x04(4/8)||0x05(LI_4/5)||0x06(LI_4/6)||0x07(LI_4/7)\r\n"
|
||||
" FLRC fields:\r\n"
|
||||
" br_bw : 0x04(2.6M/2.4M)||0x28(2.08M/2.4M)||0x45(1.3M/1.2M)||0x69(1.04M/1.2M)\r\n"
|
||||
" 0x86(0.65M/0.6M)||0xAA(0.52M/0.6M)||0xC7(0.325M/0.3M)||0xEB(0.26M/0.3M)\r\n"
|
||||
" cr : 0x00(CR_1/2)||0x02(CR_3/4)||0x04(CR_1/0)\r\n"
|
||||
" shaping : 0x00(OFF)||0x10(BT_1_0)||0x20(BT_0_5)\r\n"
|
||||
"Examples: radio modulation br_bw 0x4C\r\n"
|
||||
" radio modulation sf 0x70\r\n"
|
||||
"============================================================================================================\r\n";
|
||||
static const char packet_help[] =
|
||||
"================================================================================================\r\n"
|
||||
"packet <field> <value> - Set packet parameters (current PacketType based)\r\n"
|
||||
" BLE fields:\r\n"
|
||||
" ConnectionState : 0(MASTER_SLAVE)||1(ADVERTISER)||2(TX_TEST)||3(RX_TEST)||4(RXTX_TEST)\r\n"
|
||||
" CrcField : 0(OFF)||1(CRC_3B)\r\n"
|
||||
" BlePacketType : 0(PRBS_9)||1(PRBS_15)||2(EYELONG_1_0)||3(EYELONG_0_1)\r\n"
|
||||
" 4(EYESHORT_1_0)||5(EYESHORT_0_1)||6(ALL_1)||7(ALL_0)\r\n"
|
||||
" Whitening : 0x00(ON)||0x08(OFF)\r\n"
|
||||
" GFSK fields:\r\n"
|
||||
" Preamble : 0x00(4bits)||0x10(8bits)||0x20(12bits)||0x30(16bits)\r\n"
|
||||
" 0x40(20bits)||0x50(24bits)||0x60(28bits)||0x70(32bits)\r\n"
|
||||
" SyncWordLength : 0x00(1byte)||0x02(2bytes)||0x04(3bytes)||0x06(4bytes)||0x08(5bytes)\r\n"
|
||||
" SyncWordMatch : 0x00(OFF)||0x10(1)||0x20(2)||0x30(1_2)||0x40(3)||0x50(1_3)||0x60(2_3)||0x70(1_2_3)\r\n"
|
||||
" Header : 0x00(VARIABLE)||0x20(FIXED)\r\n"
|
||||
" Payload : 1-255 (bytes)\r\n"
|
||||
" Crc : 0x00(OFF)||0x10(1byte)||0x20(2bytes)||0x30(3bytes)\r\n"
|
||||
" Whitening : 0x00(ON)||0x08(OFF)\r\n"
|
||||
" LORA fields:\r\n"
|
||||
" Preamble : 0-255 (symbols count)\r\n"
|
||||
" Header : 0x00(VARIABLE/EXPLICIT)||0x80(FIXED/IMPLICIT)\r\n"
|
||||
" Payload : 1-255 (bytes)\r\n"
|
||||
" Crc : 0x20(ON)||0x00(OFF)\r\n"
|
||||
" InvertIQ : 0x40(NORMAL)||0x00(INVERTED)\r\n"
|
||||
" FLRC fields: Same as GFSK (Preamble/SyncWordLength/SyncWordMatch/Header/Payload/Crc/Whitening)\r\n"
|
||||
"Examples: radio packet Payload 64\r\n"
|
||||
" radio packet Crc 0x20\r\n"
|
||||
" radio packet Header 0x00\r\n"
|
||||
"================================================================================================\r\n";
|
||||
|
||||
|
||||
static const char baudrate_help[] =
|
||||
"=====================================================================\r\n"
|
||||
"baudrate <mode> <index> - Set baudrate\r\n"
|
||||
" BLE : 0(250K)||1(500K)||2(1M)\r\n"
|
||||
" LORA : 0(216b)||1(1K)||2(5K)||3(10K)||4(20K)||5(61K)||6(127K)||7(203K)\r\n"
|
||||
" GFSK : 0(125K)||1(250K)||2(500K)||3(1M)\r\n"
|
||||
" FLRC : 0(130K)||1(260K)||2(520K)||3(1040K)\r\n"
|
||||
"Examples: radio baudrate GFSK 2\r\n"
|
||||
" radio baudrate LORA 3\r\n"
|
||||
"=====================================================================\r\n";
|
||||
static BaseType_t mr16CommandHandler( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString ) {
|
||||
BaseType_t len1 = 0, len2 = 0;
|
||||
const char *p1 = FreeRTOS_CLIGetParameter(pcCommandString, 1, &len1); // 第1个参数(不包含命令名)
|
||||
@ -261,9 +339,16 @@ static BaseType_t mr16CommandHandler( char *pcWriteBuffer, size_t xWriteBufferLe
|
||||
|
||||
if (strcasecmp(arg1, "save") == 0) {
|
||||
// 保存配置到Flash
|
||||
BSP_Flash_EraseSector(200);
|
||||
BSP_Flash_WriteBytes(ADDR_FLASH_SECTOR(200), (const uint8_t*)&Config_Get()->mr16, sizeof(MR16_Param_t));
|
||||
// Flash_PageErase(FLASH_SAVE_ADDR);
|
||||
STMFLASH_Write(FLASH_SAVE_ADDR, (uint16_t*)&Config_Get()->mr16, sizeof(MR16_Param_t)/2);
|
||||
// STMFLASH_Write(FLASH_SAVE_ADDR, (uint16_t*)&Config_Get()->mr16.TX_ID, 1);
|
||||
// BSP_Flash_EraseSector(200);
|
||||
// BSP_Flash_WriteBytes(ADDR_FLASH_SECTOR(200), (const uint8_t*)&Config_Get()->mr16, sizeof(MR16_Param_t));
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "Configuration saved to Flash!\r\n");
|
||||
} else if(strcasecmp(arg1, "get") == 0){
|
||||
// 从Flash读取配置,测试使用
|
||||
STMFLASH_Read(FLASH_SAVE_ADDR, (uint16_t*)&Config_Get()->mr16, sizeof(MR16_Param_t)/2);
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "%s\r\n", (char *)&Config_Get()->mr16);
|
||||
} else if (strcasecmp(arg1, "mode") == 0) {
|
||||
if (arg2[0] != '\0') {
|
||||
if (strcasecmp(arg2, "RFUART") == 0) {
|
||||
@ -300,30 +385,332 @@ static BaseType_t mr16CommandHandler( char *pcWriteBuffer, size_t xWriteBufferLe
|
||||
}
|
||||
|
||||
static BaseType_t radioCommandHandler( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString ) {
|
||||
BaseType_t len1 = 0, len2 = 0;
|
||||
BaseType_t len1 = 0, len2 = 0, len3 = 0, len4 = 0;
|
||||
const char *p1 = FreeRTOS_CLIGetParameter(pcCommandString, 1, &len1); // 第1个参数(不包含命令名)
|
||||
const char *p2 = FreeRTOS_CLIGetParameter(pcCommandString, 2, &len2); // 第2个参数
|
||||
const char *p3 = FreeRTOS_CLIGetParameter(pcCommandString, 3, &len3); // 第3个参数
|
||||
const char *p4 = FreeRTOS_CLIGetParameter(pcCommandString, 4, &len4); // 第4个参数
|
||||
|
||||
char arg1[32] = {0};
|
||||
char arg2[64] = {0};
|
||||
char arg2[32] = {0};
|
||||
char arg3[32] = {0};
|
||||
char arg4[32] = {0};
|
||||
|
||||
if (p1) {
|
||||
size_t c1 = (len1 < (BaseType_t)(sizeof(arg1)-1)) ? (size_t)len1 : sizeof(arg1)-1;
|
||||
strncpy(arg1, p1, c1);
|
||||
arg1[c1] = '\0';
|
||||
}
|
||||
if (p2) {
|
||||
size_t c2 = (len2 < (BaseType_t)(sizeof(arg2)-1)) ? (size_t)len2 : sizeof(arg2)-1;
|
||||
strncpy(arg2, p2, c2);
|
||||
arg2[c2] = '\0';
|
||||
if (p1) { size_t c1 = (len1 < (BaseType_t)(sizeof(arg1)-1)) ? (size_t)len1 : sizeof(arg1)-1; strncpy(arg1, p1, c1); arg1[c1] = '\0'; }
|
||||
if (p2) { size_t c2 = (len2 < (BaseType_t)(sizeof(arg2)-1)) ? (size_t)len2 : sizeof(arg2)-1; strncpy(arg2, p2, c2); arg2[c2] = '\0'; }
|
||||
if (p3) { size_t c3 = (len3 < (BaseType_t)(sizeof(arg3)-1)) ? (size_t)len3 : sizeof(arg3)-1; strncpy(arg3, p3, c3); arg3[c3] = '\0'; }
|
||||
if (p4) { size_t c4 = (len4 < (BaseType_t)(sizeof(arg4)-1)) ? (size_t)len4 : sizeof(arg4)-1; strncpy(arg4, p4, c4); arg4[c4] = '\0'; }
|
||||
|
||||
/*
|
||||
help命令
|
||||
*/
|
||||
if (strcasecmp(arg1, "help") == 0) {
|
||||
static size_t help_pos = 0;
|
||||
size_t help_len = strlen(radio_help_en);
|
||||
if (help_pos >= help_len) {
|
||||
help_pos = 0;
|
||||
return pdFALSE;
|
||||
}
|
||||
size_t chunk = (xWriteBufferLen > 1) ? (xWriteBufferLen - 1) : 0;
|
||||
size_t remain = help_len - help_pos;
|
||||
size_t to_copy = (remain < chunk) ? remain : chunk;
|
||||
if (to_copy > 0) {
|
||||
memcpy(pcWriteBuffer, radio_help_en + help_pos, to_copy);
|
||||
pcWriteBuffer[to_copy] = '\0';
|
||||
help_pos += to_copy;
|
||||
return (help_pos < help_len) ? pdTRUE : pdFALSE;
|
||||
}
|
||||
help_pos = 0;
|
||||
return pdFALSE;
|
||||
} else if (strcasecmp(arg1, "modulation") == 0 && strcasecmp(arg2, "help") == 0) {
|
||||
static size_t mod_help_pos = 0;
|
||||
size_t mod_help_len = strlen(modulation_help);
|
||||
if (mod_help_pos >= mod_help_len) {
|
||||
mod_help_pos = 0;
|
||||
return pdFALSE;
|
||||
}
|
||||
size_t chunk = (xWriteBufferLen > 1) ? (xWriteBufferLen - 1) : 0;
|
||||
size_t remain = mod_help_len - mod_help_pos;
|
||||
size_t to_copy = (remain < chunk) ? remain : chunk;
|
||||
if (to_copy > 0) {
|
||||
memcpy(pcWriteBuffer, modulation_help + mod_help_pos, to_copy);
|
||||
pcWriteBuffer[to_copy] = '\0';
|
||||
mod_help_pos += to_copy;
|
||||
return (mod_help_pos < mod_help_len) ? pdTRUE : pdFALSE;
|
||||
}
|
||||
mod_help_pos = 0;
|
||||
return pdFALSE;
|
||||
} else if (strcasecmp(arg1, "packet") == 0 && strcasecmp(arg2, "help") == 0) {
|
||||
static size_t pkt_help_pos = 0;
|
||||
size_t pkt_help_len = strlen(packet_help);
|
||||
if (pkt_help_pos >= pkt_help_len) {
|
||||
pkt_help_pos = 0;
|
||||
return pdFALSE;
|
||||
}
|
||||
size_t chunk = (xWriteBufferLen > 1) ? (xWriteBufferLen - 1) : 0;
|
||||
size_t remain = pkt_help_len - pkt_help_pos;
|
||||
size_t to_copy = (remain < chunk) ? remain : chunk;
|
||||
if (to_copy > 0) {
|
||||
memcpy(pcWriteBuffer, packet_help + pkt_help_pos, to_copy);
|
||||
pcWriteBuffer[to_copy] = '\0';
|
||||
pkt_help_pos += to_copy;
|
||||
return (pkt_help_pos < pkt_help_len) ? pdTRUE : pdFALSE;
|
||||
}
|
||||
pkt_help_pos = 0;
|
||||
return pdFALSE;
|
||||
} else if (strcasecmp(arg1, "baudrate") == 0 && strcasecmp(arg2, "help") == 0) {
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "%s", baudrate_help);
|
||||
return pdFALSE;
|
||||
}
|
||||
|
||||
// 示例:处理 "MR16 Set hello"
|
||||
if (strcmp(arg1, "Set") == 0) {
|
||||
// arg2 是 "hello"
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "Set -> %s\r\n", arg2);
|
||||
|
||||
/*
|
||||
修改参数命令
|
||||
*/
|
||||
unsigned long val = 0;
|
||||
if (arg4[0] != '\0') val = strtoul(arg4, NULL, 0);
|
||||
else if (arg3[0] != '\0') val = strtoul(arg3, NULL, 0);
|
||||
|
||||
/* Process commands */
|
||||
if (strcasecmp(arg1, "mode") == 0) {
|
||||
/* radio mode change: arg2 = BLE/LORA/GFSK/FLRC */
|
||||
SX1281_RadioMode_t proto;
|
||||
if (strcasecmp(arg2, "BLE") == 0) proto = RADIOMODE_BLE;
|
||||
else if (strcasecmp(arg2, "LORA") == 0) proto = RADIOMODE_LORA;
|
||||
else if (strcasecmp(arg2, "GFSK") == 0) proto = RADIOMODE_GFSK;
|
||||
else if (strcasecmp(arg2, "FLRC") == 0) proto = RADIOMODE_FLRC;
|
||||
else {
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "Unknown radio mode: %s\r\n", arg2);
|
||||
return pdFALSE;
|
||||
}
|
||||
if (SX1281_SetMode(&radio, proto) == DEVICE_OK) {
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "Radio mode set to %s\r\n", arg2);
|
||||
} else {
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "Failed to set radio mode\r\n");
|
||||
return pdFALSE;
|
||||
}
|
||||
} else if (strcasecmp(arg1, "modulation") == 0) {
|
||||
|
||||
switch (radio.param->modulationParams.PacketType) {
|
||||
case PACKET_TYPE_BLE:
|
||||
if (strcasecmp(arg2, "br_bw") == 0) {
|
||||
if (val > 0xEF) { snprintf(pcWriteBuffer, xWriteBufferLen, "Invalid br_bw value for BLE\r\n"); return pdFALSE; }
|
||||
radio.param->modulationParams.Params.Ble.BitrateBandwidth = (RadioGfskBleBitrates_t)val;
|
||||
}
|
||||
else if (strcasecmp(arg2, "modindex") == 0) {
|
||||
if (val > 15) { snprintf(pcWriteBuffer, xWriteBufferLen, "Invalid modindex value for BLE\r\n"); return pdFALSE; }
|
||||
radio.param->modulationParams.Params.Ble.ModulationIndex = (RadioGfskBleModIndexes_t)val;
|
||||
}
|
||||
else if (strcasecmp(arg2, "shaping") == 0) {
|
||||
if (val != 0x00 && val != 0x10 && val != 0x20) { snprintf(pcWriteBuffer, xWriteBufferLen, "Invalid shaping value for BLE\r\n"); return pdFALSE; }
|
||||
radio.param->modulationParams.Params.Ble.ModulationShaping = (RadioModShapings_t)val;
|
||||
}
|
||||
else { snprintf(pcWriteBuffer, xWriteBufferLen, "Unknown modulation field\r\n"); return pdFALSE; }
|
||||
break;
|
||||
case PACKET_TYPE_GFSK:
|
||||
if (strcasecmp(arg2, "br_bw") == 0) {
|
||||
if (val > 0xEF) { snprintf(pcWriteBuffer, xWriteBufferLen, "Invalid br_bw value for GFSK\r\n"); return pdFALSE; }
|
||||
radio.param->modulationParams.Params.Gfsk.BitrateBandwidth = (RadioGfskBleBitrates_t)val;
|
||||
}
|
||||
else if (strcasecmp(arg2, "modindex") == 0) {
|
||||
if (val > 15) { snprintf(pcWriteBuffer, xWriteBufferLen, "Invalid modindex value for GFSK\r\n"); return pdFALSE; }
|
||||
radio.param->modulationParams.Params.Gfsk.ModulationIndex = (RadioGfskBleModIndexes_t)val;
|
||||
}
|
||||
else if (strcasecmp(arg2, "shaping") == 0) {
|
||||
if (val != 0x00 && val != 0x10 && val != 0x20) { snprintf(pcWriteBuffer, xWriteBufferLen, "Invalid shaping value for GFSK\r\n"); return pdFALSE; }
|
||||
radio.param->modulationParams.Params.Gfsk.ModulationShaping = (RadioModShapings_t)val;
|
||||
}
|
||||
else { snprintf(pcWriteBuffer, xWriteBufferLen, "Unknown modulation field\r\n"); return pdFALSE; }
|
||||
break;
|
||||
case PACKET_TYPE_LORA:
|
||||
if (strcasecmp(arg2, "sf") == 0) {
|
||||
if (val != 0x50 && val != 0x60 && val != 0x70 && val != 0x80 && val != 0x90 && val != 0xA0 && val != 0xB0 && val != 0xC0) {
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "Invalid sf value for LORA\r\n"); return pdFALSE;
|
||||
}
|
||||
radio.param->modulationParams.Params.LoRa.SpreadingFactor = (RadioLoRaSpreadingFactors_t)val;
|
||||
}
|
||||
else if (strcasecmp(arg2, "bw") == 0) {
|
||||
if (val != 0x34 && val != 0x26 && val != 0x18 && val != 0x0A) { snprintf(pcWriteBuffer, xWriteBufferLen, "Invalid bw value for LORA\r\n"); return pdFALSE; }
|
||||
radio.param->modulationParams.Params.LoRa.Bandwidth = (RadioLoRaBandwidths_t)val;
|
||||
}
|
||||
else if (strcasecmp(arg2, "cr") == 0) {
|
||||
if (val < 0x01 || val > 0x07) { snprintf(pcWriteBuffer, xWriteBufferLen, "Invalid cr value for LORA\r\n"); return pdFALSE; }
|
||||
radio.param->modulationParams.Params.LoRa.CodingRate = (RadioLoRaCodingRates_t)val;
|
||||
}
|
||||
else { snprintf(pcWriteBuffer, xWriteBufferLen, "Unknown modulation field\r\n"); return pdFALSE; }
|
||||
break;
|
||||
case PACKET_TYPE_FLRC:
|
||||
if (strcasecmp(arg2, "br_bw") == 0) {
|
||||
if (val != 0x04 && val != 0x28 && val != 0x45 && val != 0x69 && val != 0x86 && val != 0xAA && val != 0xC7 && val != 0xEB) {
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "Invalid br_bw value for FLRC\r\n"); return pdFALSE;
|
||||
}
|
||||
radio.param->modulationParams.Params.Flrc.BitrateBandwidth = (RadioFlrcBitrates_t)val;
|
||||
}
|
||||
else if (strcasecmp(arg2, "cr") == 0) {
|
||||
if (val != 0x00 && val != 0x02 && val != 0x04) { snprintf(pcWriteBuffer, xWriteBufferLen, "Invalid cr value for FLRC\r\n"); return pdFALSE; }
|
||||
radio.param->modulationParams.Params.Flrc.CodingRate = (RadioFlrcCodingRates_t)val;
|
||||
}
|
||||
else if (strcasecmp(arg2, "shaping") == 0) {
|
||||
if (val != 0x00 && val != 0x10 && val != 0x20) { snprintf(pcWriteBuffer, xWriteBufferLen, "Invalid shaping value for FLRC\r\n"); return pdFALSE; }
|
||||
radio.param->modulationParams.Params.Flrc.ModulationShaping = (RadioModShapings_t)val;
|
||||
}
|
||||
else { snprintf(pcWriteBuffer, xWriteBufferLen, "Unknown modulation field\r\n"); return pdFALSE; }
|
||||
break;
|
||||
default:
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "Unknown current packet type\r\n");
|
||||
return pdFALSE;
|
||||
}
|
||||
Radio.SetModulationParams(&radio.param->modulationParams);
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "Modulation updated\r\n");
|
||||
} else if (strcasecmp(arg1, "packet") == 0) {
|
||||
/* packet <proto> <field> <value>
|
||||
fields examples: payload | preamble | header | crc | whitening
|
||||
*/
|
||||
/* 根据当前 packet type 设置对应字段 */
|
||||
switch (radio.param->packetParams.PacketType) {
|
||||
|
||||
case PACKET_TYPE_BLE:
|
||||
/* BLE 使用 Ble 子结构 */
|
||||
if (strcasecmp(arg2, "ConnectionState") == 0) {
|
||||
radio.param->packetParams.Params.Ble.ConnectionState = (RadioBleConnectionStates_t)val;
|
||||
} else if (strcasecmp(arg2, "CrcField") == 0) {
|
||||
radio.param->packetParams.Params.Ble.CrcField = (RadioBleCrcFields_t)val;
|
||||
} else if (strcasecmp(arg2, "BlePacketType") == 0) {
|
||||
radio.param->packetParams.Params.Ble.BlePacketType = (RadioBlePacketTypes_t)val;
|
||||
} else if (strcasecmp(arg2, "Whitening") == 0) {
|
||||
radio.param->packetParams.Params.Ble.Whitening = (RadioWhiteningModes_t)val;
|
||||
} else {
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "Unknown BLE packet field\r\n");
|
||||
return pdFALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case PACKET_TYPE_GFSK:
|
||||
/* GFSK 子结构 */
|
||||
if (strcasecmp(arg2, "Preamble") == 0) {
|
||||
radio.param->packetParams.Params.Gfsk.PreambleLength = (RadioPreambleLengths_t)val;
|
||||
} else if (strcasecmp(arg2, "SyncWordLength") == 0) {
|
||||
radio.param->packetParams.Params.Gfsk.SyncWordLength = (RadioSyncWordLengths_t)val;
|
||||
} else if (strcasecmp(arg2, "SyncWordMatch") == 0) {
|
||||
radio.param->packetParams.Params.Gfsk.SyncWordMatch = (RadioSyncWordRxMatchs_t)val;
|
||||
} else if (strcasecmp(arg2, "Header") == 0) {
|
||||
radio.param->packetParams.Params.Gfsk.HeaderType = (RadioPacketLengthModes_t)val;
|
||||
} else if (strcasecmp(arg2, "Payload") == 0) {
|
||||
radio.param->packetParams.Params.Gfsk.PayloadLength = (uint8_t)val;
|
||||
} else if (strcasecmp(arg2, "Crc") == 0) {
|
||||
radio.param->packetParams.Params.Gfsk.CrcLength = (RadioCrcTypes_t)val;
|
||||
} else if (strcasecmp(arg2, "Whitening") == 0) {
|
||||
radio.param->packetParams.Params.Gfsk.Whitening = (RadioWhiteningModes_t)val;
|
||||
} else {
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "Unknown GFSK packet field\r\n");
|
||||
return pdFALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case PACKET_TYPE_LORA:
|
||||
/* LoRa 子结构 */
|
||||
if (strcasecmp(arg2, "Preamble") == 0) {
|
||||
radio.param->packetParams.Params.LoRa.PreambleLength = (uint8_t)val;
|
||||
} else if (strcasecmp(arg2, "Header") == 0) {
|
||||
radio.param->packetParams.Params.LoRa.HeaderType = (RadioLoRaPacketLengthsModes_t)val;
|
||||
} else if (strcasecmp(arg2, "Payload") == 0) {
|
||||
radio.param->packetParams.Params.LoRa.PayloadLength = (uint8_t)val;
|
||||
} else if (strcasecmp(arg2, "Crc") == 0) {
|
||||
radio.param->packetParams.Params.LoRa.CrcMode = (RadioLoRaCrcModes_t)val;
|
||||
} else if (strcasecmp(arg2, "InvertIQ") == 0) {
|
||||
radio.param->packetParams.Params.LoRa.InvertIQ = (RadioLoRaIQModes_t)val;
|
||||
} else {
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "Unknown LoRa packet field\r\n");
|
||||
return pdFALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case PACKET_TYPE_FLRC:
|
||||
/* FLRC 子结构 */
|
||||
if (strcasecmp(arg2, "Preamble") == 0) {
|
||||
radio.param->packetParams.Params.Flrc.PreambleLength = (RadioPreambleLengths_t)val;
|
||||
} else if (strcasecmp(arg2, "SyncWordLength") == 0) {
|
||||
radio.param->packetParams.Params.Flrc.SyncWordLength = (RadioFlrcSyncWordLengths_t)val;
|
||||
} else if (strcasecmp(arg2, "SyncWordMatch") == 0) {
|
||||
radio.param->packetParams.Params.Flrc.SyncWordMatch = (RadioSyncWordRxMatchs_t)val;
|
||||
} else if (strcasecmp(arg2, "Header") == 0) {
|
||||
radio.param->packetParams.Params.Flrc.HeaderType = (RadioPacketLengthModes_t)val;
|
||||
} else if (strcasecmp(arg2, "Payload") == 0) {
|
||||
radio.param->packetParams.Params.Flrc.PayloadLength = (uint8_t)val;
|
||||
} else if (strcasecmp(arg2, "Crc") == 0) {
|
||||
radio.param->packetParams.Params.Flrc.CrcLength = (RadioCrcTypes_t)val;
|
||||
} else if (strcasecmp(arg2, "Whitening") == 0) {
|
||||
radio.param->packetParams.Params.Flrc.Whitening = (RadioWhiteningModes_t)val;
|
||||
} else {
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "Unknown FLRC packet field\r\n");
|
||||
return pdFALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "Unknown current packet type\r\n");
|
||||
return pdFALSE;
|
||||
}
|
||||
|
||||
/* 应用并返回 */
|
||||
Radio.SetPacketParams(&radio.param->packetParams);
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "Packet parameters updated\r\n");
|
||||
} else if (strcasecmp(arg1, "baudrate") == 0) {
|
||||
/* baudrate <proto> <value> */
|
||||
SX1281_RadioMode_t proto;
|
||||
int8_t ret = -1;
|
||||
if (strcasecmp(arg2, "BLE") == 0) {
|
||||
radio.param->baudrate.ble = (SX1281_BLEBaudrate_t)val;
|
||||
ret = SX1281_SetBLEBaudrate(&radio, radio.param->baudrate.ble);
|
||||
} else if (strcasecmp(arg2, "LORA") == 0) {
|
||||
radio.param->baudrate.lora = (SX1281_LORABaudrate_t)val;
|
||||
ret = SX1281_SetLORABaudrate(&radio, radio.param->baudrate.lora);
|
||||
} else if (strcasecmp(arg2, "GFSK") == 0) {
|
||||
radio.param->baudrate.gfks = (SX1281_GFKSBaudrate_t)val;
|
||||
ret = SX1281_SetGFSKBaudrate(&radio, radio.param->baudrate.gfks);
|
||||
} else if (strcasecmp(arg2, "FLRC") == 0) {
|
||||
radio.param->baudrate.flrc = (SX1281_FLRCBaudrate_t)val;
|
||||
ret = SX1281_SetFLRCBaudrate(&radio, radio.param->baudrate.flrc);
|
||||
} else {
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "Unknown proto: %s\r\n", arg2);
|
||||
return pdFALSE;
|
||||
}
|
||||
if (ret == DEVICE_OK) {
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "Baudrate updated for %s -> %lu\r\n", arg2, (unsigned long)val);
|
||||
} else {
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "Failed to update baudrate for %s\r\n", arg2);
|
||||
}
|
||||
} else if (strcasecmp(arg1, "power") == 0) {
|
||||
/* power <value> */
|
||||
int8_t p = (int8_t)val;
|
||||
radio.param->txOutputPower = p;
|
||||
Radio.SetTxParams(radio.param->txOutputPower, radio.param->rampTime);
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "TX power set to %d dBm\r\n", p);
|
||||
} else if (strcasecmp(arg1, "ramptime") == 0) {
|
||||
/* ramptime <us> - accepts 2/4/6/8/10/12/16/20 */
|
||||
RadioRampTimes_t rt = RADIO_RAMP_02_US;
|
||||
unsigned long us = val;
|
||||
switch (us) {
|
||||
case 2: rt = RADIO_RAMP_02_US; break;
|
||||
case 4: rt = RADIO_RAMP_04_US; break;
|
||||
case 6: rt = RADIO_RAMP_06_US; break;
|
||||
case 8: rt = RADIO_RAMP_08_US; break;
|
||||
case 10: rt = RADIO_RAMP_10_US; break;
|
||||
case 12: rt = RADIO_RAMP_12_US; break;
|
||||
case 16: rt = RADIO_RAMP_16_US; break;
|
||||
case 20: rt = RADIO_RAMP_20_US; break;
|
||||
default: snprintf(pcWriteBuffer, xWriteBufferLen, "Invalid ramptime\r\n"); return pdFALSE;
|
||||
}
|
||||
radio.param->rampTime = rt;
|
||||
Radio.SetTxParams(radio.param->txOutputPower, radio.param->rampTime);
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "Ramp time set to %lu us\r\n", us);
|
||||
} else if (strcasecmp(arg1, "rffreq") == 0 || strcasecmp(arg1, "rffrequency") == 0) {
|
||||
/* rffreq <value in Hz> */
|
||||
uint32_t f = (uint32_t)val;
|
||||
SX1281_SetRFFrequency(&radio, f);
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "RF freq set to %lu Hz\r\n", (unsigned long)f);
|
||||
} else {
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "Got: %s %s\r\n", arg1, arg2);
|
||||
snprintf(pcWriteBuffer, xWriteBufferLen, "Unknown radio command\r\n");
|
||||
}
|
||||
|
||||
return pdFALSE;
|
||||
@ -340,10 +727,10 @@ int8_t MR16_CLI_Init() {
|
||||
-1 // 可变参数数量
|
||||
};
|
||||
static const CLI_Command_Definition_t radioCommand = {
|
||||
"radio", // 命令名
|
||||
"radio <mode|modulation|packet|baudrate|power|ramptime|rffreq|tx|rx>\r\n", // 帮助信息
|
||||
radioCommandHandler, // 处理函数
|
||||
-1 // 可变参数数量
|
||||
"radio", // 命令名
|
||||
"radio - radio subcommands. Use 'radio help' for detailed usage.\r\n", // 帮助信息(详尽)
|
||||
radioCommandHandler, // 处理函数
|
||||
-1 // 可变参数数量
|
||||
};
|
||||
FreeRTOS_CLIRegisterCommand(&mr16Command);
|
||||
FreeRTOS_CLIRegisterCommand(&radioCommand);
|
||||
|
||||
@ -40,7 +40,7 @@ void Task_radio(void *argument) {
|
||||
uint32_t tick = osKernelGetTickCount(); /* 控制任务运行频率的计时 */
|
||||
/* USER CODE INIT BEGIN */
|
||||
__HAL_UART_ENABLE_IT(&huart2,UART_IT_IDLE);
|
||||
MR16_Init(&mr16,Config_Get()->mr16,MR16_MODE_RC, RADIOMODE_FLRC);
|
||||
MR16_Init(&mr16,&Config_Get()->mr16,MR16_MODE_RC, RADIOMODE_FLRC);
|
||||
// mr16.RX_ID[0]=0x1234;
|
||||
// BSP_Flash_ReadBytes(0x8000);
|
||||
/* USER CODE INIT END */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user