Compare commits

...

6 Commits

Author SHA1 Message Date
起床就犯困 c0ea36b58f no message 2024-08-05 10:36:17 +08:00
起床就犯困 465464de9f 修改堆的大小 2024-07-17 11:08:53 +08:00
起床就犯困 4ac4da35d4 串口能接收发送 2024-07-17 10:01:02 +08:00
起床就犯困 6559f0739a 串口接收的时候出现爆栈 2024-07-17 09:40:41 +08:00
起床就犯困 0bf09ca66a 0715 2024-07-15 17:22:55 +08:00
起床就犯困 9e112a4749 玄学出现网址打印,其他部分未初始化 2024-07-15 11:33:54 +08:00
64 changed files with 12548 additions and 9842 deletions

View File

@ -263,5 +263,5 @@
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo> </scannerConfigBuildInfo>
</storageModule> </storageModule>
<storageModule moduleId="refreshScope"/>
</cproject> </cproject>

View File

@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="842268059550569664" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true"> <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-148882674934750304" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/> <language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/> <language-scope id="org.eclipse.cdt.core.g++"/>
</provider> </provider>

View File

@ -7,11 +7,11 @@ Toolchain=RISC-V
Series=CH32V30X Series=CH32V30X
Description= Description=
PeripheralVersion=1.4 PeripheralVersion=1.4
Target Path=obj\CH32V303.hex Target Path=obj\CH32V303_V0.1.hex
CLKSpeed=1 CLKSpeed=1
RTOS=RT-Thread RTOS=RT-Thread
Vendor=WCH Vendor=WCH
MCU=CH32V303VCT6 MCU=CH32V303VCT6
Mcu Type=CH32V30x Mcu Type=CH32V30x
Link=WCH-Link Link=WCH-Link

View File

@ -15,7 +15,7 @@
#define J1_PWR_Ctrl 38 #define J1_PWR_Ctrl 38
void J1_485_Init(void); void J1_485_Init(uint32_t baud);
void J1_PWR_Open(void); void J1_PWR_Open(void);
void J1_PWR_Close(void); void J1_PWR_Close(void);

View File

@ -14,7 +14,7 @@
/* PE8 */ /* PE8 */
#define J2_PWR_Ctrl 39 #define J2_PWR_Ctrl 39
void J2_485_Init(void); void J2_485_Init(uint32_t baud);
void J2_PWR_Open(void); void J2_PWR_Open(void);
void J2_PWR_Close(void); void J2_PWR_Close(void);

View File

@ -15,7 +15,7 @@
/* PE9 */ /* PE9 */
#define J3_PWR_Ctrl 40 #define J3_PWR_Ctrl 40
void J3_485_Init(void); void J3_485_Init(uint32_t baud);
void J3_PWR_Open(void); void J3_PWR_Open(void);
void J3_PWR_Close(void); void J3_PWR_Close(void);

View File

@ -14,7 +14,7 @@
/* PE10 */ /* PE10 */
#define J4_PWR_Ctrl 41 #define J4_PWR_Ctrl 41
void J4_485_Init(void); void J4_485_Init(uint32_t baud);
void J4_PWR_Open(void); void J4_PWR_Open(void);
void J4_PWR_Close(void); void J4_PWR_Close(void);

View File

@ -29,14 +29,12 @@
/* PD11 */ /* PD11 */
#define TD_USART_C 58 #define TD_USART_C 58
#define USART3_buffer_len 256
void J5_0_485_Init(uint32_t baud);
void J5_0_485_Init(void);
extern void USARTx_SendByte(USART_TypeDef* pUSARTx, uint8_t data); extern void USARTx_SendByte(USART_TypeDef* pUSARTx, uint8_t data);
extern void USARTx_SendStr(USART_TypeDef* pUSARTx, char *str); extern void USARTx_SendStr(USART_TypeDef* pUSARTx, char *str);
void USART3_IRQHandler(void); //void USART3_IRQHandler(void);
void USART_CONNET_J0(void); void USART_CONNET_J0(void);
void USART_CONNET_J5(void); void USART_CONNET_J5(void);

View File

@ -38,6 +38,7 @@
void USARTx_SendByte(USART_TypeDef* pUSARTx, uint8_t data); void USARTx_SendByte(USART_TypeDef* pUSARTx, uint8_t data);
void USARTx_SendStr(USART_TypeDef* pUSARTx, char *str); void USARTx_SendStr(USART_TypeDef* pUSARTx, char *str);
void USARTx_SendByte_str(USART_TypeDef* pUSARTx, uint8_t data);
void USARTx_SendStr_Len(USART_TypeDef* pUSARTx, char *str, int len); void USARTx_SendStr_Len(USART_TypeDef* pUSARTx, char *str, int len);

18
Hardware/inc/spi.h Normal file
View File

@ -0,0 +1,18 @@
/*
* spi.h
*
* Created on: 2024725
* Author: psx
*/
#ifndef HARDWARE_INC_SPI_H_
#define HARDWARE_INC_SPI_H_
#endif /* HARDWARE_INC_SPI_H_ */

View File

@ -7,7 +7,7 @@
#include "J1_UART6.h" #include "J1_UART6.h"
void J1_485_Init(void) void J1_485_Init(uint32_t baud)
{ {
rt_pin_mode(J1_DE, PIN_MODE_OUTPUT); rt_pin_mode(J1_DE, PIN_MODE_OUTPUT);
/* 设置485状态为读 */ /* 设置485状态为读 */

View File

@ -9,7 +9,7 @@
void J2_485_Init(void) void J2_485_Init(uint32_t baud)
{ {
rt_pin_mode(J2_DE, PIN_MODE_OUTPUT); rt_pin_mode(J2_DE, PIN_MODE_OUTPUT);
/* 设置485状态为读 */ /* 设置485状态为读 */

View File

@ -8,7 +8,7 @@
void J3_485_Init(void) void J3_485_Init(uint32_t baud)
{ {
rt_pin_mode(J3_DE, PIN_MODE_OUTPUT); rt_pin_mode(J3_DE, PIN_MODE_OUTPUT);
/* 设置485状态为读 */ /* 设置485状态为读 */

View File

@ -9,7 +9,7 @@
void J4_485_Init(void) void J4_485_Init(uint32_t baud)
{ {
rt_pin_mode(J4_DE, PIN_MODE_OUTPUT); rt_pin_mode(J4_DE, PIN_MODE_OUTPUT);
/* 设置485状态为读 */ /* 设置485状态为读 */

View File

@ -5,17 +5,15 @@
* Author: 34509 * Author: 34509
*/ */
#include "J5-0_USART3.h" #include "J5-0_USART3.h"
#include "uart_dev.h"
void USART3_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast"))); void USART3_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
uint8_t USART_Rbuffer_Num = 0;
uint8_t USART_Tbuffer_Num = 0;
/* 接收缓冲区数组 */ /* 接收缓冲区数组 */
uint8_t USART_Rbuffer[USART3_buffer_len]; uint8_t USART3_Rbuffer[1] = {0x00};
/* /*
* Function Name : J5_0_485_Init * Function Name : J5_0_485_Init
@ -23,7 +21,7 @@ uint8_t USART_Rbuffer[USART3_buffer_len];
* Input : None * Input : None
* Return : None * Return : None
**/ **/
void J5_0_485_Init(void) void J5_0_485_Init(uint32_t baud)
{ {
rt_pin_mode(J5_PWR_Ctrl, PIN_MODE_OUTPUT); rt_pin_mode(J5_PWR_Ctrl, PIN_MODE_OUTPUT);
rt_pin_mode(J6_PWR_Ctrl, PIN_MODE_OUTPUT); rt_pin_mode(J6_PWR_Ctrl, PIN_MODE_OUTPUT);
@ -59,7 +57,7 @@ void J5_0_485_Init(void)
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; //设置PB11为浮空输入 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; //设置PB11为浮空输入
GPIO_Init(GPIOB, &GPIO_InitStructure); GPIO_Init(GPIOB, &GPIO_InitStructure);
USART_InitStructure.USART_BaudRate = 115200; USART_InitStructure.USART_BaudRate = baud;
USART_InitStructure.USART_WordLength = USART_WordLength_8b; USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1; USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No; USART_InitStructure.USART_Parity = USART_Parity_No;
@ -74,7 +72,7 @@ void J5_0_485_Init(void)
NVIC_Init(&NVIC_InitStructure); //中断优先级初始化 NVIC_Init(&NVIC_InitStructure); //中断优先级初始化
USART_ITConfig(USART3, USART_IT_RXNE, ENABLE); USART_ITConfig(USART3, USART_IT_RXNE, ENABLE);
USART_ITConfig(USART3, USART_IT_IDLE, ENABLE); // USART_ITConfig(USART3, USART_IT_IDLE, ENABLE);
USART_Cmd(USART3,ENABLE); USART_Cmd(USART3,ENABLE);
} }
@ -86,29 +84,35 @@ void USART3_IRQHandler(void)
if(USART_GetITStatus(USART3, USART_IT_RXNE) != RESET) //中断产生 if(USART_GetITStatus(USART3, USART_IT_RXNE) != RESET) //中断产生
{ {
// USART_ClearITPendingBit(USART3,USART_IT_RXNE); //清除中断标志 // USART_ClearITPendingBit(USART3,USART_IT_RXNE); //清除中断标志
USART_Rbuffer[USART_Rbuffer_Num] = USART_ReceiveData(USART3); //接收数据 // USART_Rbuffer[USART_Rbuffer_Num] = USART_ReceiveData(USART3); //接收数据
USART_Rbuffer_Num++; // USART_Rbuffer_Num++;
USART3_Rbuffer[0] = USART_ReceiveData(USART3); //接收数据
uint8_t c = 0;
uart_device_info *dev = (uart_device_info *)g_J50RS485_USART3_handle;
c = USART3_Rbuffer[0];
if(!RingQueueFull(&dev->uart_ring_queue))
InRingQueue(&dev->uart_ring_queue, c);
} }
if(USART_GetITStatus(USART3, USART_IT_IDLE) != RESET) //中断产生 // if(USART_GetITStatus(USART3, USART_IT_IDLE) != RESET) //中断产生
{ // {
// for(USART_Tbuffer_Num=0;USART_Tbuffer_Num < USART_Rbuffer_Num;USART_Tbuffer_Num++) //// for(USART_Tbuffer_Num=0;USART_Tbuffer_Num < USART_Rbuffer_Num;USART_Tbuffer_Num++)
// { //// {
// USARTx_SendByte(USART3, USART_Rbuffer[USART_Tbuffer_Num]); //发送数据 //// USARTx_SendByte(USART3, USART_Rbuffer[USART_Tbuffer_Num]); //发送数据
// } //// }
USARTx_SendStr_Len(USART3, USART_Rbuffer, USART_Rbuffer_Num); // USARTx_SendStr_Len(USART3, USART_Rbuffer, USART_Rbuffer_Num);
rt_kprintf("USART_Rbuffer_Num = %d \n", USART_Rbuffer_Num); // rt_kprintf("USART_Rbuffer_Num = %d \n", USART_Rbuffer_Num);
// USART3->STATR; //// USART3->STATR;
// USART3->DATAR; //// USART3->DATAR;
USART_Rbuffer_Num = 0; //初始化 // USART_Rbuffer_Num = 0; //初始化
USART_ReceiveData(USART3); //读DR // USART_ReceiveData(USART3); //读DR
} // }
//
if(USART_GetFlagStatus(USART3,USART_FLAG_ORE) == SET) //溢出 // if(USART_GetFlagStatus(USART3,USART_FLAG_ORE) == SET) //溢出
{ // {
USART_ClearFlag(USART3,USART_FLAG_ORE); //清标志 // USART_ClearFlag(USART3,USART_FLAG_ORE); //清标志
USART_ReceiveData(USART3); //读DR // USART_ReceiveData(USART3); //读DR
} // }
} }
/* /*

View File

@ -50,6 +50,7 @@ void USARTx_SendByte(USART_TypeDef* pUSARTx, uint8_t data)
} }
} }
void USARTx_SendByte_str(USART_TypeDef* pUSARTx, uint8_t data) void USARTx_SendByte_str(USART_TypeDef* pUSARTx, uint8_t data)
{ {
USART_SendData(pUSARTx, data); USART_SendData(pUSARTx, data);

8
Hardware/src/spi.c Normal file
View File

@ -0,0 +1,8 @@
/*
* spi.c
*
* Created on: 2024725
* Author: psx
*/

View File

@ -1 +1 @@
ENTRY( _start ) __stack_size = 2048; PROVIDE( _stack_size = __stack_size ); MEMORY { FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K } SECTIONS { .init : { _sinit = .; . = ALIGN(4); KEEP(*(SORT_NONE(.init))) . = ALIGN(4); _einit = .; } >FLASH AT>FLASH .vector : { *(.vector); . = ALIGN(64); } >FLASH AT>FLASH .text : { . = ALIGN(4); *(.text) *(.text.*) *(.rodata) *(.rodata*) *(.gnu.linkonce.t.*) /* section information for finsh shell */ . = ALIGN(4); __fsymtab_start = .; KEEP(*(FSymTab)) __fsymtab_end = .; . = ALIGN(4); __vsymtab_start = .; KEEP(*(VSymTab)) __vsymtab_end = .; . = ALIGN(4); /* section information for initial. */ . = ALIGN(4); __rt_init_start = .; KEEP(*(SORT(.rti_fn*))) __rt_init_end = .; . = ALIGN(4); /* section information for modules */ . = ALIGN(4); __rtmsymtab_start = .; KEEP(*(RTMSymTab)) __rtmsymtab_end = .; . = ALIGN(4); } >FLASH AT>FLASH .fini : { KEEP(*(SORT_NONE(.fini))) . = ALIGN(4); } >FLASH AT>FLASH PROVIDE( _etext = . ); PROVIDE( _eitcm = . ); .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); } >FLASH AT>FLASH .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors)) PROVIDE_HIDDEN (__init_array_end = .); } >FLASH AT>FLASH .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*))) KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors)) PROVIDE_HIDDEN (__fini_array_end = .); } >FLASH AT>FLASH .ctors : { /* gcc uses crtbegin.o to find the start of the constructors, so we make sure it is first. Because this is a wildcard, it doesn't matter if the user does not actually link against crtbegin.o; the linker won't look for a file to match a wildcard. The wildcard also means that it doesn't matter which directory crtbegin.o is in. */ KEEP (*crtbegin.o(.ctors)) KEEP (*crtbegin?.o(.ctors)) /* We don't want to include the .ctor section from the crtend.o file until after the sorted ctors. The .ctor section from the crtend file contains the end of ctors marker and it must be last */ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) } >FLASH AT>FLASH .dtors : { KEEP (*crtbegin.o(.dtors)) KEEP (*crtbegin?.o(.dtors)) KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) } >FLASH AT>FLASH .dalign : { . = ALIGN(4); PROVIDE(_data_vma = .); } >RAM AT>FLASH .dlalign : { . = ALIGN(4); PROVIDE(_data_lma = .); } >FLASH AT>FLASH .data : { *(.gnu.linkonce.r.*) *(.data .data.*) *(.gnu.linkonce.d.*) . = ALIGN(8); PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.*) *(.sdata2.*) *(.gnu.linkonce.s.*) . = ALIGN(8); *(.srodata.cst16) *(.srodata.cst8) *(.srodata.cst4) *(.srodata.cst2) *(.srodata .srodata.*) . = ALIGN(4); PROVIDE( _edata = .); } >RAM AT>FLASH .bss : { . = ALIGN(4); PROVIDE( _sbss = .); *(.sbss*) *(.gnu.linkonce.sb.*) *(.bss*) *(.gnu.linkonce.b.*) *(COMMON*) . = ALIGN(4); PROVIDE( _ebss = .); } >RAM AT>FLASH PROVIDE( _end = _ebss); PROVIDE( end = . ); .stack ORIGIN(RAM) + LENGTH(RAM) - __stack_size : { PROVIDE( _heap_end = . ); . = ALIGN(4); PROVIDE(_susrstack = . ); . = . + __stack_size; PROVIDE( _eusrstack = .); } >RAM } ENTRY( _start ) __stack_size = 32768; PROVIDE( _stack_size = __stack_size ); MEMORY { FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K } SECTIONS { .init : { _sinit = .; . = ALIGN(4); KEEP(*(SORT_NONE(.init))) . = ALIGN(4); _einit = .; } >FLASH AT>FLASH .vector : { *(.vector); . = ALIGN(64); } >FLASH AT>FLASH .text : { . = ALIGN(4); *(.text) *(.text.*) *(.rodata) *(.rodata*) *(.gnu.linkonce.t.*) /* section information for finsh shell */ . = ALIGN(4); __fsymtab_start = .; KEEP(*(FSymTab)) __fsymtab_end = .; . = ALIGN(4); __vsymtab_start = .; KEEP(*(VSymTab)) __vsymtab_end = .; . = ALIGN(4); /* section information for initial. */ . = ALIGN(4); __rt_init_start = .; KEEP(*(SORT(.rti_fn*))) __rt_init_end = .; . = ALIGN(4); /* section information for modules */ . = ALIGN(4); __rtmsymtab_start = .; KEEP(*(RTMSymTab)) __rtmsymtab_end = .; . = ALIGN(4); } >FLASH AT>FLASH .fini : { KEEP(*(SORT_NONE(.fini))) . = ALIGN(4); } >FLASH AT>FLASH PROVIDE( _etext = . ); PROVIDE( _eitcm = . ); .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); } >FLASH AT>FLASH .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors)) PROVIDE_HIDDEN (__init_array_end = .); } >FLASH AT>FLASH .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*))) KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors)) PROVIDE_HIDDEN (__fini_array_end = .); } >FLASH AT>FLASH .ctors : { /* gcc uses crtbegin.o to find the start of the constructors, so we make sure it is first. Because this is a wildcard, it doesn't matter if the user does not actually link against crtbegin.o; the linker won't look for a file to match a wildcard. The wildcard also means that it doesn't matter which directory crtbegin.o is in. */ KEEP (*crtbegin.o(.ctors)) KEEP (*crtbegin?.o(.ctors)) /* We don't want to include the .ctor section from the crtend.o file until after the sorted ctors. The .ctor section from the crtend file contains the end of ctors marker and it must be last */ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) } >FLASH AT>FLASH .dtors : { KEEP (*crtbegin.o(.dtors)) KEEP (*crtbegin?.o(.dtors)) KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) } >FLASH AT>FLASH .dalign : { . = ALIGN(4); PROVIDE(_data_vma = .); } >RAM AT>FLASH .dlalign : { . = ALIGN(4); PROVIDE(_data_lma = .); } >FLASH AT>FLASH .data : { *(.gnu.linkonce.r.*) *(.data .data.*) *(.gnu.linkonce.d.*) . = ALIGN(8); PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.*) *(.sdata2.*) *(.gnu.linkonce.s.*) . = ALIGN(8); *(.srodata.cst16) *(.srodata.cst8) *(.srodata.cst4) *(.srodata.cst2) *(.srodata .srodata.*) . = ALIGN(4); PROVIDE( _edata = .); } >RAM AT>FLASH .bss : { . = ALIGN(4); PROVIDE( _sbss = .); *(.sbss*) *(.gnu.linkonce.sb.*) *(.bss*) *(.gnu.linkonce.b.*) *(COMMON*) . = ALIGN(4); PROVIDE( _ebss = .); } >RAM AT>FLASH PROVIDE( _end = _ebss); PROVIDE( end = . ); .stack ORIGIN(RAM) + LENGTH(RAM) - __stack_size : { PROVIDE( _heap_end = . ); . = ALIGN(4); PROVIDE(_susrstack = . ); . = . + __stack_size; PROVIDE( _eusrstack = .); } >RAM }

View File

@ -9,6 +9,8 @@
#define SOFTWARE_PROTOCOL_COMMUNICATION_PROTOCOL_H_ #define SOFTWARE_PROTOCOL_COMMUNICATION_PROTOCOL_H_
#include "inc/UART.h" #include "inc/UART.h"
#include "uart_dev.h"
/* 功能码 */ /* 功能码 */
typedef enum typedef enum
@ -19,11 +21,159 @@ typedef enum
SL_Function_Code_Registration_request = 0xA1, /* 注册请求 */ SL_Function_Code_Registration_request = 0xA1, /* 注册请求 */
}SL_MsgFunctionCode; }SL_MsgFunctionCode;
/* 寄存器地址 */
typedef enum
{
SL_Register_Registration_Status = 0x0000, /* 注册状态 */
SL_Register_address = 0x0001, /* 地址 */
SL_Register_Access_Node_Type = 0x0002, /* 接入节点类型 */
SL_Register_Communication_Methods = 0x0003, /* 通信方式 */
SL_Register_Battery_Voltage = 0x0100, /* 电池电压 */
SL_Register_Battery_temperature = 0x0101, /* 电池温度 */
SL_Register_Remaining_Battery_Bower = 0x0102, /* 电池剩余电量 */
SL_Register_Solar_Open_Circuit_Voltage1 = 0x0103, /* 太阳能开路电压1 */
SL_Register_Solar_Open_Circuit_Voltage2 = 0x0104, /* 太阳能开路电压2 */
SL_Register_Ambient_Temperature = 0x0200, /* 环境温度 */
SL_Register_Ambient_Humidity = 0x0201, /* 环境湿度 */
SL_Register_Barometric_Pressure = 0x0202, /* 大气压 */
SL_Register_Wind_Speed = 0x0203, /* 风速 */
SL_Register_Wind_Direction = 0x0204, /* 风向 */
SL_Register_Rainfall = 0x0205, /* 雨量 */
SL_Register_Optical_Radiation = 0x0206, /* 光辐射 */
SL_Register_Leakage_Current_Value = 0x0220, /* 泄漏电流值 */
SL_Register_Leakage_Current_MaxValue = 0x0221, /* 最大泄漏电流值 */
SL_Register_Pulse_Frequency = 0x0222, /* 脉冲次数 */
SL_Register_Zero_Leakage_Current_MaxValue_Statistics = 0x0223, /* 清零最大泄漏电流值统计 */
SL_Register_Zero_Pulse_Frequency_Statistics = 0x0224, /* 清零脉冲次数统计 */
SL_Register_Inclination_AngleX = 0x0230, /* X轴倾角 */
SL_Register_Inclination_AngleY = 0x0231, /* Y轴倾角 */
SL_Register_Zero_Inclination_Angle = 0x0232, /* 校零倾角 */
}SL_MsgRegister;
/* 注册状态 */
typedef enum
{
UNREGISTER = 0, /* 未注册 */
REGISTER_FAIL = 1, /* 注册失败 */
REGISTER_SUCCESS = 2, /* 注册成功 */
}SL_REGISTERSTATUS;
/* 接入节点类型 */
typedef enum
{
POWERBOX = 1, /* 电源箱子 */
MICROMETEOROLOGY = 2, /* 微气象 */
}SL_ACCESSNODETYPE;
/* 通信方式 */
typedef enum
{
RS485 = 1,
RJ45 = 2,
}SL_COMMUNICATIONMETHODS;
/* 指定对齐方式为1字节 */
#pragma pack(push,1)
/* 读时发送的帧格式(汇聚网关->接入节点) */
typedef struct _SL_Mppt_Rorecv_pack{
uint8_t start_Flag[2]; /* 起始标志 */
uint8_t address[7]; /* 地址 */
uint8_t function_Code; /* 功能码 */
uint8_t read_Register_Start_Address_H; /* 读取寄存器起始地址高8位 */
uint8_t read_Register_Start_Address_L; /* 读取寄存器起始地址低八位 */
uint8_t read_Register_Number_H; /* 读取寄存器个数高八位 */
uint8_t read_Register_Number_L; /* 读取寄存器个数低八位 */
uint8_t check_Bit_H; /* 校验位高八位 */
uint8_t check_Bit_L; /* 校验位低八位 */
uint8_t end_Flag; /* 结束标志 */
}SL_Mppt_Rorecv_pack;
#define SL_MPPT_RORECV_PACK_SIZE (sizeof(SL_Mppt_Rorecv_pack))
/* 读时接收到的回复帧格式(接入节点->汇聚网关) */
typedef struct _SL_Mppt_ROReply_pack{
uint8_t start_Flag[2]; /* 起始标志 */
uint8_t address[7]; /* 地址 */
uint8_t function_Code; /* 功能码 */
uint8_t reply_Register_Number_H; /* 回复字节数长度高八位 */
uint8_t reply_Register_Number_L; /* 回复字节数长度低八位 */
uint8_t *content; /* 回复数据内容 */
uint8_t check_Bit_H; /* 校验位高八位 */
uint8_t check_Bit_L; /* 校验位低八位 */
uint8_t end_Flag; /* 结束标志 */
}SL_Mppt_ROReply_pack;
#define SL_MPPT_ROReply_PACK_SIZE (sizeof(SL_Mppt_ROReply_pack))
/* 扫描广播帧F1汇聚网关->接入节点) */
typedef struct _SL_Mppt_ScanBroadcast_pack{
uint8_t start_Flag[2]; /* 起始标志 */
uint8_t address[7]; /* 地址 */
uint8_t function_Code; /* 功能码 */
uint8_t check_Bit_H; /* 校验位高八位 */
uint8_t check_Bit_L; /* 校验位低八位 */
uint8_t end_Flag; /* 结束标志 */
}SL_Mppt_Scan_Broadcast_pack;
#define SL_MPPT_SCAN_BROADCAST_PACK_SIZE (sizeof(SL_Mppt_Scan_Broadcast_pack))
/* 注册请求帧F2接入节点->汇聚网关) */
typedef struct _SL_Mppt_RegistrationRequest_pack{
uint8_t start_Flag[2]; /* 起始标志 */
uint8_t address[7]; /* 地址 */
uint8_t function_Code; /* 功能码 */
uint8_t register_Length_H; /* 寄存器长度高八位 */
uint8_t register_Length_L; /* 寄存器长度低八位 */
uint8_t registration_Status_H; /* 注册状态高八位 */
uint8_t registration_Status_L; /* 注册状态低八位 */
uint8_t access_Node_ID[7]; /* 接入节点ID */
uint8_t access_Node_Type_H; /* 接入节点类型高八位 */
uint8_t access_Node_Type_L; /* 接入节点类型低八位 */
uint8_t check_Bit_H; /* 校验位高八位 */
uint8_t check_Bit_L; /* 校验位低八位 */
uint8_t end_Flag; /* 结束标志 */
}SL_Mppt_RegistrationRequest_pack;
#define SL_MPPT_REGISTRATIONREQUEST_PACK_SIZE (sizeof(SL_Mppt_RegistrationRequest_pack))
/* 注册回复帧F3汇聚网关->接入节点) */
typedef struct _SL_Mppt_RegistrationReply_pack{
uint8_t start_Flag[2]; /* 起始标志 */
uint8_t address[7]; /* 地址 */
uint8_t function_Code; /* 功能码 */
uint8_t register_Length_H; /* 寄存器长度高八位 */
uint8_t register_Length_L; /* 寄存器长度低八位 */
uint8_t registration_Status_H; /* 注册状态高八位 */
uint8_t registration_Status_L; /* 注册状态低八位 */
uint8_t check_Bit_H; /* 校验位高八位 */
uint8_t check_Bit_L; /* 校验位低八位 */
uint8_t end_Flag; /* 结束标志 */
}SL_Mppt_RegistrationReply_pack;
#define SL_MPPT_REGISTRATIONREPLY_PACK_SIZE (sizeof(SL_Mppt_RegistrationReply_pack))
/* */
#define RECV_LENGTH 20
typedef struct _SL_Mppt_Recv_pack{
uint8_t start_Flag[2]; /* 起始标志 */
uint8_t address[7]; /* 地址 */
uint8_t function_Code; /* 功能码 */
uint8_t recv_Data[RECV_LENGTH]; /* 其他部分 */
}SL_Mppt_Recv_pack;
/* 功能码处理函数 */
typedef void (*MsgProcFunc)(device_handle device, void*, uint32_t MsgLen);
typedef struct _SL_FunctionMsgProcTable{
u_int32_t msgId;
MsgProcFunc pMsgProc;
}SL_FuncionMsgProcTable;
/* 恢复默认的对齐设置 */
#pragma pack(pop)
extern SL_Mppt_Scan_Broadcast_pack g_Scan_Broadcast_pack;
void read_and_process_uart_data(device_handle device);
void send_data(uint8_t *buff);
#endif /* SOFTWARE_PROTOCOL_COMMUNICATION_PROTOCOL_H_ */ #endif /* SOFTWARE_PROTOCOL_COMMUNICATION_PROTOCOL_H_ */

35
Software/inc/inflash.h Normal file
View File

@ -0,0 +1,35 @@
/*
* inflash.h
*
* Created on: 2024624
* Author: psx
*/
#ifndef APP_INC_INFLASH_H_
#define APP_INC_INFLASH_H_
#include "debug.h"
#pragma pack(push,1)
typedef struct _config_info{
uint8_t start_Flag[2]; /* 起始标志 */
uint8_t address[7]; /* 地址 */
uint8_t end_Flag; /* 结束标志 */
uint16_t Access_Node_Type; /* 接入节点类型 */
uint16_t Communication_Methods; /* 通信方式 */
uint32_t bat485_Baud; /* 串口波特率 */
uint32_t gw485_Baud; /* 串口波特率 */
}config_info;
#define CONFIG_INFO_SIZE (sizeof(config_info))
#pragma pack(pop)
extern config_info g_slConfigInfo;
#define FLASH_SAVE_ADDR_BEGIN (0x00)
#define FLASH_SAVE_ADDR_END (0x00 + CONFIG_INFO_SIZE)
void save_config_info(config_info save_config_info);
uint8_t read_config_info(void);
#endif /* APP_INC_INFLASH_H_ */

View File

@ -1,20 +0,0 @@
/*
* mutex.h
*
* Created on: 2024518
* Author: 34509
*/
#ifndef SOFTWARE_THREAD_COMMUNICATION_MUTEX_H_
#define SOFTWARE_THREAD_COMMUNICATION_MUTEX_H_
#include "rtthread.h"
/* 定义互斥量控制块 */
/* Rs485数组互斥量 */
static rt_mutex_t protocol_mux = RT_NULL;
void mutex_Init(void);
#endif /* SOFTWARE_THREAD_COMMUNICATION_MUTEX_H_ */

View File

@ -11,7 +11,9 @@
#include "communication_protocol.h" #include "communication_protocol.h"
void Rs485_thread_Init(void); void Recv_thread_Init(void);
void Send_thread_Init(void);
#endif /* SOFTWARE_THREAD_RS485_H_ */ #endif /* SOFTWARE_THREAD_RS485_H_ */

View File

@ -0,0 +1,38 @@
/*
* mutex.h
*
* Created on: 2024518
* Author: 34509
*/
#ifndef SOFTWARE_THREAD_COMMUNICATION_MUTEX_H_
#define SOFTWARE_THREAD_COMMUNICATION_MUTEX_H_
#include "rtthread.h"
#include "uart_dev.h"
/* UartSend队列的格式 */
#define UART_MQ_SEND_LENGTH 20
typedef struct _SL_UartSend_pack{
device_handle device; /* 串口 */
rt_uint8_t direction; /* 方向 */
rt_uint8_t len; /* 长度 */
rt_uint8_t recv_Data[UART_MQ_SEND_LENGTH]; /* 其他部分 */
}SL_UartSend_pack;
typedef enum{
up = 0, /* 往智能模块传传输数据 */
down = 1, /* 向下往传感器传输数据 */
}UartSend_pack_direction;
extern SL_UartSend_pack MqUartSend_pack;
extern rt_mq_t mqSend;
rt_uint8_t Send_mq_Init(void);
#endif /* SOFTWARE_THREAD_COMMUNICATION_MUTEX_H_ */

View File

@ -11,8 +11,7 @@
#include "ch32v30x.h" #include "ch32v30x.h"
#include <rtthread.h> #include <rtthread.h>
#include <rthw.h> #include <rthw.h>
#include "ring_queue.h" #include "RingQueue/ring_queue.h"
#include "rs485.h"
#define ASCII_CHAR_BACKSPACE 0x08 /* '\b' */ #define ASCII_CHAR_BACKSPACE 0x08 /* '\b' */
#define ASCII_CHAR_CHARACTER_TABULATION 0x09 /* '\t' */ #define ASCII_CHAR_CHARACTER_TABULATION 0x09 /* '\t' */
@ -21,29 +20,46 @@
#define ASCII_CHAR_FORM_FEED 0x0C /* '\f' */ #define ASCII_CHAR_FORM_FEED 0x0C /* '\f' */
#define ASCII_CHAR_CARRIAGE_RETURN 0x0D /* '\r' */ #define ASCII_CHAR_CARRIAGE_RETURN 0x0D /* '\r' */
#define RS485_MAX_PACK_DATA_LEN 30 //#define RS485_MAX_PACK_DATA_LEN 30
typedef uint32_t device_handle; typedef uint32_t device_handle;
extern device_handle g_J1RS485_UART6_handle;
extern device_handle g_J2RS485_UART7_handle;
extern device_handle g_J3RS485_USART2_handle;
extern device_handle g_J4RS485_UART8_handle;
extern device_handle g_J50RS485_USART3_handle;
extern device_handle g_LORA_UART5_handle;
//typedef enum{
// J1RS485_UART6 = UART6,
// J2RS485_UART7 = 7,
// J3RS485_USART2 = 2,
// J4RS485_UART8 = 8,
// J50RS485_USART3 = 3,
// LORA_UART5 = 5,
//}uartIndex_e;
typedef enum{ typedef enum{
J1RS485_UART6 = 0, ONLYONE = 1,
J2RS485_UART7, J0RS485 = 0,
J3RS485_USART2, J5RS485 = 5,
J4RS485_UART8, J6RS485 = 6,
J50RS485_USART3, J7RS485 = 7,
LORA_UART5, J8RS485 = 8,
}uartIndex_e; J9RS485 = 9,
}uartNum_e;
/* UART 驱动数据结构对应一个uart设备 */ /* UART 驱动数据结构对应一个uart设备 */
typedef struct _uart_device_info{ typedef struct _uart_device_info{
uint8_t init; uint8_t init;
uartIndex_e uart_index; USART_TypeDef *uart_index;
uint32_t uart_baudrate; uint32_t uart_baudrate;
RingQueue uart_ring_queue; RingQueue uart_ring_queue;
uartNum_e uart_num;
}uart_device_info; }uart_device_info;
//device_handle uart_dev_init(uartIndex_e uart_index, uint8_t *buff, int buff_size); //device_handle uart_dev_init(uartIndex_e uart_index, uint8_t *buff, int buff_size);
//device_handle uart_dev_init(uart_device_info *uart_device, uint8_t *buff, int buff_size);
device_handle uart_dev_init(void); device_handle uart_dev_init(void);
void uart_sendstr(device_handle device,char *str); void uart_sendstr(device_handle device,char *str);
void uart_dev_write(device_handle device, void *data, int len); void uart_dev_write(device_handle device, void *data, int len);

View File

@ -1,46 +0,0 @@
/*
* Rs485.c
*
* Created on: 2024518
* Author: 34509
*/
#include "Rs485.h"
/* 定义线程控制块指针 */
static rt_thread_t Rs485_thread = RT_NULL;
/* 函数声明 */
static void Rs485_thread_entry(void* parameter);
void Rs485_thread_Init(void)
{
Rs485_thread = /* 线程控制块指针 */
rt_thread_create( "led", /* 线程名字 */
Rs485_thread_entry, /* 线程入口函数 */
RT_NULL, /* 线程入口函数参数 */
512, /* 线程栈大小 */
10, /* 线程的优先级 */
20); /* 线程时间片 */
/* 启动线程,开启调度 */
if (Rs485_thread != RT_NULL)
rt_thread_startup(Rs485_thread);
else
return;
}
void Rs485_thread_entry(void* parameter)
{
while (1) {
rt_thread_mdelay(3000);
}
}

View File

@ -6,7 +6,363 @@
*/ */
#include <communication_protocol.h> #include <communication_protocol.h>
#include "inflash.h"
#include <string.h>
#include "thread_communication.h"
SL_Mppt_Scan_Broadcast_pack g_Scan_Broadcast_pack = {
.start_Flag = "SL",
.address = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
.function_Code = SL_Function_Code_Broadcast_Scan,
.check_Bit_H = 0x36,
.check_Bit_L = 0xE6,
.end_Flag = 0x16,
};
/* 读取串口数据时用该数组解析 */
static uint8_t uart_buff[50]={0x00};
/* 静态函数申明 */
static void SL_MsgProcFunc_Read_Register(device_handle device, void *pMsg, uint32_t MsgLen);
static void SL_MsgProcFunc_Registration_request(device_handle device, void *pMsg, uint32_t MsgLen);
/* 功能码处理表 */
SL_FuncionMsgProcTable g_MsgTbl[] =
{
{SL_Function_Code_Read_Register, SL_MsgProcFunc_Read_Register},
{SL_Function_Code_Registration_request, SL_MsgProcFunc_Registration_request},
};
/**
* @brief
* @param
* @retval
*/
uint16_t CheckFunc(uint8_t *arr_buff, uint8_t len)
{
uint16_t crc = 0xFFFF;
uint16_t i, j;
for (j = 0; j < len; ++j) {
crc = crc ^ (*arr_buff++);
for (i = 0; i < 8; ++i) {
if ((crc&0x0001) > 0) {
crc = crc >> 1;
crc = crc ^ 0xa001;
}
else {
crc = crc >> 1;
}
}
}
return crc;
}
/**
* @brief 485线
* @param
* @retval 1
* 0
*/
uint8_t Check_485_bus_busy(device_handle device)
{
uart_device_info *device_info = (uart_device_info *)device;
if((!device) || (!device_info->init))
return 0;
USART_ITConfig(device_info->uart_index, USART_IT_RXNE, ENABLE);
uint16_t num_ago = ring_queue_length(device);
Delay_Ms(2);
uint16_t num_now = ring_queue_length(device);
USART_ITConfig(device_info->uart_index, USART_IT_RXNE, DISABLE);
if (num_now == num_ago) {
return 0;
}
return 1;
}
void SL_MsgProcFunc_Read_Register(device_handle device, void *pMsg, uint32_t MsgLen)
{
memset(&MqUartSend_pack, 0, sizeof(MqUartSend_pack));
MqUartSend_pack.device = device;
MqUartSend_pack.direction = up;
MqUartSend_pack.len = MsgLen;
uint8_t *buf = (uint8_t *)pMsg;
for (uint8_t var = 0; var < MsgLen; ++var) {
MqUartSend_pack.recv_Data[var] = buf[var];
}
/* 发 送 消 息 到 消 息 队 列 中 */
if (rt_mq_send(mqSend, &MqUartSend_pack, MsgLen) != RT_EOK) {
rt_kprintf("rt_mq_send ERR\n");
}
}
void SL_MsgProcFunc_Registration_request(device_handle device, void *pMsg, uint32_t MsgLen)
{
memset(&MqUartSend_pack, 0, sizeof(MqUartSend_pack));
MqUartSend_pack.device = device;
MqUartSend_pack.direction = down;
MqUartSend_pack.len = SL_MPPT_REGISTRATIONREPLY_PACK_SIZE;
// uint8_t *buf = (uint8_t *)pMsg;
// for (uint8_t var = 0; var < MsgLen; ++var) {
// MqUartSend_pack.recv_Data[var] = buf[var];
// }
SL_Mppt_RegistrationReply_pack *rrpack = (SL_Mppt_RegistrationReply_pack *)MqUartSend_pack.recv_Data;
SL_Mppt_RegistrationRequest_pack *rpack = (SL_Mppt_RegistrationRequest_pack *)pMsg;
rrpack->start_Flag[0] = rpack->start_Flag[0];
rrpack->start_Flag[1] = rpack->start_Flag[1];
rrpack->address[0] = rpack->access_Node_ID[0];
rrpack->address[1] = rpack->access_Node_ID[1];
rrpack->address[2] = rpack->access_Node_ID[2];
rrpack->address[3] = rpack->access_Node_ID[3];
rrpack->address[4] = rpack->access_Node_ID[4];
rrpack->address[5] = rpack->access_Node_ID[5];
rrpack->address[6] = rpack->access_Node_ID[6];
rrpack->address[7] = rpack->access_Node_ID[7];
rrpack->function_Code = rpack->function_Code;
rrpack->register_Length_H = rpack->register_Length_H;
rrpack->register_Length_L = rpack->register_Length_L;
rrpack->registration_Status_H = 0x00;
rrpack->registration_Status_L = 0x02;
uint16_t crc_16 = CheckFunc(MqUartSend_pack.recv_Data, SL_MPPT_REGISTRATIONREPLY_PACK_SIZE - 3);
rrpack->check_Bit_H = crc_16 >> 8;
rrpack->check_Bit_L = crc_16;
rrpack->end_Flag = 0x16;
/* 发 送 消 息 到 消 息 队 列 中 */
if (rt_mq_send(mqSend, &MqUartSend_pack, sizeof(MqUartSend_pack)) != RT_EOK) {
rt_kprintf("rt_mq_send ERR\n");
}
}
/**
* @brief "SL"
* @param start_buff
* @retval 1
* 0
*/
static int Match_Startflag(uint8_t start_buff[2])
{
if ((start_buff[0] == g_slConfigInfo.start_Flag[0]) && \
(start_buff[1] == g_slConfigInfo.start_Flag[1])) {
return 1;
}
return 0;
}
///**
// * @brief 匹配广播地址
// * @param address 地址
// * @retval 1 匹配成功
// * 0 匹配失败
// */
//static int Match_Broadcastaddress(uint8_t address[7])
//{
// if (address[0] == 0xFF && \
// address[1] == 0xFF && \
// address[2] == 0xFF && \
// address[3] == 0xFF && \
// address[4] == 0xFF && \
// address[5] == 0xFF && \
// address[6] == 0xFF) {
//
// return 1;
// }
// return 0;
//}
/**
* @brief
* @param uart_handle
* @param buff
* @param buff_size
* @retval
*/
static int uart_read_climate_pack(device_handle uart_handle,uint8_t *buff, uint32_t buff_size)
{
SL_Mppt_Recv_pack *pack = (SL_Mppt_Recv_pack *)buff;
uint32_t offset = 0;
uint32_t len = 0;
uint8_t r_Flag = 0; /* 读的标志位 */
uint8_t flag_run = 0;
char c = 0;
buff_size--; //预留一个'\0'位置
for (; offset < buff_size;){
if (ring_queue_length(uart_handle) == 0) {
break;
}
c = uart_dev_in_char(uart_handle);
buff[offset++] = c;
/* 匹配起始标志位 */
if (offset == sizeof(pack->start_Flag) || (flag_run > 0)) {
if (!Match_Startflag(pack->start_Flag)) {
memcpy(buff, buff+1, offset-1);
offset--;
continue;
}
}
// /* 匹配地址 */
// if (offset == (sizeof(pack->start_Flag) + sizeof(pack->address)) || (flag_run > 1)) {
// /* 匹配广播地址,设备地址不做匹配 */
// if (Match_Broadcastaddress(pack->address)) {
// b_Flag = 1;
// }
//
// }
/* 匹配功能码 */
if ((offset == (sizeof(pack->start_Flag) + sizeof(pack->address) + sizeof(pack->function_Code))) || (flag_run > 2)) {
/* 读寄存器数据 */
if (pack->function_Code == SL_Function_Code_Read_Register) {
r_Flag = 1;
}
/* 注册请求 */
else if ((pack->function_Code == SL_Function_Code_Registration_request)) {
len = SL_MPPT_REGISTRATIONREQUEST_PACK_SIZE;
r_Flag = 0;
}
else {
if (flag_run < 2) {
flag_run = 2;
}
r_Flag = 0;
memcpy(buff, buff+1, offset-1);
offset--;
continue;
}
}
if ((1 == r_Flag) && (offset == 12)) {
SL_Mppt_ROReply_pack *rpack = (SL_Mppt_ROReply_pack *)buff;
uint8_t Register_Number = (rpack->reply_Register_Number_H << 8) | rpack->reply_Register_Number_L;
len = Register_Number * 2 + SL_MPPT_ROReply_PACK_SIZE - 4;
continue;
}
if (offset == len) {
/* 读寄存器数据 */
if (pack->function_Code == SL_Function_Code_Read_Register) {
uint16_t crc_16 = buff[offset - 2] | (buff[offset - 3] << 8);
if ((CheckFunc(buff, offset - 3) != crc_16) || (buff[offset - 1] != 0x16)) {
if (flag_run < 3) {
flag_run = 3;
}
memcpy(buff, buff+1, offset-1);
offset--;
} else {
return offset;
}
}
else {
SL_Mppt_RegistrationRequest_pack *rpack = (SL_Mppt_RegistrationRequest_pack *)buff;
uint16_t crc_16 = rpack->check_Bit_L | (rpack->check_Bit_H << 8);
if ((CheckFunc(buff, offset - 3) != crc_16) || (buff[offset - 1] != 0x16)) {
if (flag_run < 3) {
flag_run = 3;
}
memcpy(buff, buff+1, offset-1);
offset--;
} else {
return offset;
}
}
}
}
return 0;
}
/**
* @brief
* @param
* @retval
*/
void FRT_MsgHandler(device_handle device, uint8_t *pMsg, uint32_t MsgLen)
{
SL_Mppt_Recv_pack *pack = (SL_Mppt_Recv_pack *)pMsg;
for (u_int16_t i = 0; i < sizeof(g_MsgTbl) / sizeof(SL_FuncionMsgProcTable); i++) {
if (pack->function_Code == g_MsgTbl[i].msgId) {
g_MsgTbl[i].pMsgProc(device, pMsg, MsgLen);
}
}
}
/**
* @brief
* @param
* @retval
*/
void read_and_process_uart_data(device_handle device)
{
if (uart_dev_char_present(device)) {
rt_thread_mdelay(30);
rt_kprintf("ring_queue_length = %d \n", ring_queue_length(device));
memset(uart_buff, 0, sizeof(uart_buff));
int ret = uart_read_climate_pack(device, uart_buff, sizeof(uart_buff));
if(ret > 0){
FRT_MsgHandler(device, uart_buff, ret);
}
}
}
/**
* @brief
* @param
* @retval
*/
static void send_uart_data(uint8_t *buff)
{
SL_UartSend_pack *upack = (SL_UartSend_pack *)buff;
uart_dev_write(upack->device, upack->recv_Data, upack->len + 1);
}
/**
* @brief
* @param
* @retval
*/
void send_data(uint8_t *buff)
{
SL_UartSend_pack *upack = (SL_UartSend_pack *)buff;
if (upack->direction == down) {
send_uart_data(buff);
}
}

48
Software/src/inflash.c Normal file
View File

@ -0,0 +1,48 @@
/*
* inflash.c
*
* Created on: 2024624
* Author: psx
*/
#include "inflash.h"
#include "flash.h"
config_info g_slConfigInfo = {
.start_Flag = {'S', 'L'},
.end_Flag = 0x16,
};
/**
* @brief
* @param save_config_info
* @retval
*/
void save_config_info(config_info save_config_info)
{
SPI_Flash_Write((uint8_t *)&save_config_info, FLASH_SAVE_ADDR_BEGIN, CONFIG_INFO_SIZE);
}
/**
* @brief
* @param read_config_info
* @retval 0 flash中读取配置失败
* 1 flash中读取配置成功
*/
uint8_t read_config_info(void)
{
config_info temp_config_info;
SPI_Flash_Read((uint8_t *)&temp_config_info, FLASH_SAVE_ADDR_BEGIN, CONFIG_INFO_SIZE);
if (temp_config_info.start_Flag[0] == 'S') {
g_slConfigInfo = temp_config_info;
return 1;
}
return 0;
}

View File

@ -1,21 +0,0 @@
/*
* mutex.c
*
* Created on: 2024518
* Author: 34509
*/
#include "mutex.h"
void mutex_Init(void)
{
/* 创建一个互斥量 */
protocol_mux = rt_mutex_create("test_mux",RT_IPC_FLAG_PRIO);
if (protocol_mux != RT_NULL){
rt_kprintf("互斥量创建成功!\n\n");
}
}

92
Software/src/thread.c Normal file
View File

@ -0,0 +1,92 @@
/*
* Rs485.c
*
* Created on: 2024518
* Author: 34509
*/
#include <thread.h>
#include "uart_dev.h"
#include "thread_communication.h"
#include <string.h>
/* 定义线程控制块指针 */
/* 接收线程控制块指针 */
static rt_thread_t Recv_thread = RT_NULL;
/* 发送线程控制块指针 */
static rt_thread_t Send_thread = RT_NULL;
/* 函数声明 */
/* 接收线程函数 */
static void Recv_thread_entry(void* parameter);
/* 发送线程函数 */
static void Send_thread_entry(void* parameter);
/**
* @brief 线
* @param
* @retval
*/
void Recv_thread_Init(void)
{
Recv_thread = /* 线程控制块指针 */
rt_thread_create( "Recv", /* 线程名字 */
Recv_thread_entry, /* 线程入口函数 */
RT_NULL, /* 线程入口函数参数 */
512, /* 线程栈大小 */
2, /* 线程的优先级 */
20); /* 线程时间片 */
/* 启动线程,开启调度 */
if (Recv_thread != RT_NULL) {
rt_thread_startup(Recv_thread);
}
else
return;
}
/**
* @brief 线
* @param
* @retval
*/
void Send_thread_Init(void)
{
Send_thread = /* 线程控制块指针 */
rt_thread_create( "send", /* 线程名字 */
Send_thread_entry, /* 线程入口函数 */
RT_NULL, /* 线程入口函数参数 */
512, /* 线程栈大小 */
3, /* 线程的优先级 */
20); /* 线程时间片 */
/* 启动线程,开启调度 */
if (Send_thread != RT_NULL) {
rt_thread_startup(Send_thread);
}
else
return;
}
void Recv_thread_entry(void* parameter)
{
rt_kprintf("\n Recv \n");
while (1) {
read_and_process_uart_data(g_J50RS485_USART3_handle);
rt_thread_mdelay(100);
}
}
void Send_thread_entry(void* parameter)
{
uint8_t buff[100];
rt_kprintf("\n Send \n");
while (1) {
memset(buff, 0, sizeof(buff));
rt_mq_recv(mqSend, buff, sizeof(buff), RT_WAITING_FOREVER);
rt_kprintf("\n Send buff \n");
send_data(buff);
}
}

View File

@ -0,0 +1,45 @@
/*
* mutex.c
*
* Created on: 2024518
* Author: 34509
*/
#include <thread_communication.h>
SL_UartSend_pack MqUartSend_pack;
/* 定义消息队列控制块 */
rt_mq_t mqSend = RT_NULL;
/**
* @brief
* @param
* @retval 1
* 0
*/
rt_uint8_t Send_mq_Init(void)
{
mqSend = rt_mq_create("Send_mq",/* 消息队列名字 */
100, /* 消息的最大长度 */
20, /* 消息队列的最大容量 */
RT_IPC_FLAG_FIFO);/* 队列模式 FIFO(0x00)*/
if (mqSend != RT_NULL)
return 1;
return 0;
}

View File

@ -6,38 +6,80 @@
*/ */
#include "uart_dev.h" #include "uart_dev.h"
#include "J1_UART6.h"
#include "J2_UART7.h"
#include "J3_USART2.h"
#include "J4_UART8.h"
#include "J5-0_USART3.h"
/* 使能485发送 */ /* 使能485发送 */
//#define rs485_send_enable 1 #define rs485_send_enable 1
static void uart_init(uartIndex_e uart_index, int baud); //static void uart_init(uartIndex_e uart_index, int baud);
static void uart_init(uart_device_info *uart_device, int baud);
static uint8_t uart_putchar(device_handle device, char ch); static uint8_t uart_putchar(device_handle device, char ch);
//device_handle g_bat485_uart3_handle; device_handle g_J1RS485_UART6_handle;
//device_handle g_gw485_uart4_handle; device_handle g_J2RS485_UART7_handle;
// device_handle g_J3RS485_USART2_handle;
//static uint8_t bat485_in_buff[200]; device_handle g_J4RS485_UART8_handle;
//static uint8_t gw485_in_buff[300]; device_handle g_J50RS485_USART3_handle;
// device_handle g_LORA_UART5_handle;
#define IN_BUFF_SIZE 128
static uint8_t J1RS485_in_buff[IN_BUFF_SIZE];
static uint8_t J2RS485_in_buff[IN_BUFF_SIZE];
static uint8_t J3RS485_in_buff[IN_BUFF_SIZE];
static uint8_t J4RS485_in_buff[IN_BUFF_SIZE];
static uint8_t J50RS485_in_buff[IN_BUFF_SIZE];
static uint8_t LORA_in_buff[IN_BUFF_SIZE];
//uint8_t J1RS485_in_buff[IN_BUFF_SIZE];
//uint8_t J2RS485_in_buff[IN_BUFF_SIZE];
//uint8_t J3RS485_in_buff[IN_BUFF_SIZE];
//uint8_t J4RS485_in_buff[IN_BUFF_SIZE];
//uint8_t J50RS485_in_buff[IN_BUFF_SIZE];
//uint8_t LORA_in_buff[IN_BUFF_SIZE];
//uint8_t rs485_out_buff[100]; //uint8_t rs485_out_buff[100];
/** /**
* @brief . * @brief .
* @param uart_index * @param uart_index
* @param uart_baudrate * @param uart_baudrate
*/ */
uart_device_info uart_devices[]={ uart_device_info uart_devices[]={
// [0] = { [0] = {
// .init = 0, .init = 0,
// .uart_index = BAT485_UART_INDEX, .uart_index = UART6,
// .uart_baudrate = 9600, .uart_num = ONLYONE,
// }, },
// [1] = { [1] = {
// .init = 0, .init = 0,
// .uart_index = GW485_UART_INDEX, .uart_index = UART7,
// .uart_baudrate = 9600, .uart_num = ONLYONE,
// }, },
[2] = {
.init = 0,
.uart_index = USART2,
.uart_num = ONLYONE,
},
[3] = {
.init = 0,
.uart_index = UART8,
.uart_num = ONLYONE,
},
[4] = {
.init = 0,
.uart_index = USART3,
.uart_num = J0RS485,
},
[5] = {
.init = 0,
.uart_index = UART5,
.uart_num = ONLYONE,
},
}; };
/** /**
@ -64,29 +106,55 @@ uart_device_info uart_devices[]={
// } // }
// return 0; // return 0;
//} //}
//device_handle uart_dev_init(uart_device_info *uart_device, uint8_t *buff, int buff_size)
//{
// int i = 0;
// for(; i < ELEMENT_OF(uart_devices); i++){
// if(uart_devices[i].uart_index == uart_device->uart_index){
// if(!uart_devices[i].init){
// InitRingQueue(&uart_devices[i].uart_ring_queue, buff, buff_size);
// uart_init(uart_device, uart_devices[i].uart_baudrate);
//
// uart_devices[i].init = 1;
// }
// return (device_handle)(&uart_devices[i]);
// }
// }
// return 0;
//}
device_handle uart_dev_init(void) device_handle uart_dev_init(void)
{ {
// int i = 0; InitRingQueue(&uart_devices[0].uart_ring_queue, J1RS485_in_buff, sizeof(J1RS485_in_buff));
// for(; i < ELEMENT_OF(uart_devices); i++){ uart_init(&uart_devices[0], 9600);
// if(uart_devices[i].uart_index == uart_index){ uart_devices[0].init = 1;
// if(!uart_devices[i].init){ g_J1RS485_UART6_handle = (device_handle)(&uart_devices[0]);
// InitRingQueue(&uart_devices[i].uart_ring_queue, buff, buff_size);
// uart_init(uart_index, uart_devices[i].uart_baudrate); InitRingQueue(&uart_devices[1].uart_ring_queue, J2RS485_in_buff, sizeof(J2RS485_in_buff));
// uart_init(&uart_devices[1], 9600);
// uart_devices[i].init = 1; uart_devices[1].init = 1;
// } g_J2RS485_UART7_handle = (device_handle)(&uart_devices[1]);
// return (device_handle)(&uart_devices[i]);
// }
// } InitRingQueue(&uart_devices[2].uart_ring_queue, J3RS485_in_buff, sizeof(J3RS485_in_buff));
// InitRingQueue(&uart_devices[0].uart_ring_queue, bat485_in_buff, sizeof(bat485_in_buff)); uart_init(&uart_devices[2], 9600);
// uart_init(BAT485_UART_INDEX, g_slConfigInfo.bat485_Baud); uart_devices[2].init = 1;
// uart_devices[0].init = 1; g_J3RS485_USART2_handle = (device_handle)(&uart_devices[2]);
// g_bat485_uart3_handle = (device_handle)(&uart_devices[0]);
// InitRingQueue(&uart_devices[3].uart_ring_queue, J4RS485_in_buff, sizeof(J4RS485_in_buff));
// InitRingQueue(&uart_devices[1].uart_ring_queue, gw485_in_buff, sizeof(gw485_in_buff)); uart_init(&uart_devices[3], 9600);
// uart_init(GW485_UART_INDEX, g_slConfigInfo.gw485_Baud); uart_devices[3].init = 1;
// uart_devices[1].init = 1; g_J4RS485_UART8_handle = (device_handle)(&uart_devices[3]);
// g_gw485_uart4_handle = (device_handle)(&uart_devices[1]);
InitRingQueue(&uart_devices[4].uart_ring_queue, J50RS485_in_buff, sizeof(J50RS485_in_buff));
uart_init(&uart_devices[4], 9600);
uart_devices[4].init = 1;
g_J50RS485_USART3_handle = (device_handle)(&uart_devices[4]);
InitRingQueue(&uart_devices[5].uart_ring_queue, LORA_in_buff, sizeof(LORA_in_buff));
uart_init(&uart_devices[5], 9600);
uart_devices[5].init = 1;
g_LORA_UART5_handle = (device_handle)(&uart_devices[5]);
return 0; return 0;
} }
@ -98,13 +166,35 @@ device_handle uart_dev_init(void)
* @param baud * @param baud
* @retval None * @retval None
*/ */
void uart_init(uartIndex_e uart_index, int baud) void uart_init(uart_device_info *uart_device, int baud)
{ {
// if (uart_index == BAT485_UART_INDEX) { uart_device->uart_baudrate = baud;
// BAT_485_Init(uart_devices[0].uart_baudrate); if (uart_device->uart_index == UART6) {
// } else if (uart_index == GW485_UART_INDEX) { J1_485_Init(baud);
// GW_485_Init(uart_devices[1].uart_baudrate); } else if (uart_device->uart_index == UART7) {
// } J2_485_Init(baud);
} else if (uart_device->uart_index == USART2) {
J3_485_Init(baud);
} else if (uart_device->uart_index == UART8) {
J4_485_Init(baud);
} else if (uart_device->uart_index == USART3) {
J5_0_485_Init(baud);
if (uart_device->uart_num == J0RS485) {
USART_CONNET_J0();
} else if (uart_device->uart_num == J5RS485) {
USART_CONNET_J5();
} else if (uart_device->uart_num == J6RS485) {
USART_CONNET_J6();
} else if (uart_device->uart_num == J7RS485) {
USART_CONNET_J7();
} else if (uart_device->uart_num == J8RS485) {
USART_CONNET_J8();
} else if (uart_device->uart_num == J9RS485) {
USART_CONNET_J9();
}
} else if (uart_device->uart_index == UART5) {
;
}
} }
/** /**
@ -119,53 +209,108 @@ uint8_t uart_putchar(device_handle device, char ch)
if((!device) || (!device_info->init)) if((!device) || (!device_info->init))
return 0; return 0;
// if (device_info->uart_index == BAT485_UART_INDEX) { USARTx_SendByte_str(device_info->uart_index, ch);
// USARTx_SendByte(BAT_485, ch);
// } else if(device_info->uart_index == GW485_UART_INDEX) {
// USARTx_SendByte(GW_485, ch);
// }
return 1; return 1;
} }
/** /**
* @brief bat485发送使能. * @brief J1RS485发送使能.
* @param * @param
* @retval * @retval
*/ */
void bat485_tx_enabla(void) void J1RS485_tx_enabla(void)
{ {
// GPIO_WriteBit(GPIO_BAT_485_RDE, Pin_BAT_485_RDE, write); rt_pin_write(J1_DE, write);
} }
/** /**
* @brief bat485发送关闭. * @brief J1RS485发送关闭.
* @param * @param
* @retval * @retval
*/ */
void bat485_tx_disenabla(void) void J1RS485_tx_disenabla(void)
{ {
// GPIO_WriteBit(GPIO_BAT_485_RDE, Pin_BAT_485_RDE, read); rt_pin_write(J1_DE, read);
} }
/** /**
* @brief gw485发送使能. * @brief J2RS485发送使能.
* @param * @param
* @retval * @retval
*/ */
void gw485_tx_enabla(void) void J2RS485_tx_enabla(void)
{ {
// GPIO_WriteBit(GPIO_GW_485_RDE, Pin_GW_485_RDE, write); rt_pin_write(J2_DE, write);
} }
/** /**
* @brief gw485发送关闭. * @brief J2RS485发送关闭.
* @param * @param
* @retval * @retval
*/ */
void gw485_tx_disenabla(void) void J2RS485_tx_disenabla(void)
{ {
// GPIO_WriteBit(GPIO_GW_485_RDE, Pin_GW_485_RDE, read); rt_pin_write(J2_DE, read);
}
/**
* @brief J3RS485发送使能.
* @param
* @retval
*/
void J3RS485_tx_enabla(void)
{
rt_pin_write(J3_DE, write);
}
/**
* @brief J3RS485发送关闭.
* @param
* @retval
*/
void J3RS485_tx_disenabla(void)
{
rt_pin_write(J3_DE, read);
}
/**
* @brief J4RS485发送使能.
* @param
* @retval
*/
void J4RS485_tx_enabla(void)
{
rt_pin_write(J4_DE, write);
}
/**
* @brief J4RS485发送关闭.
* @param
* @retval
*/
void J4RS485_tx_disenabla(void)
{
rt_pin_write(J4_DE, read);
}
/**
* @brief J50RS485发送使能.
* @param
* @retval
*/
void J50RS485_tx_enabla(void)
{
rt_pin_write(USART3_DE, write);
}
/**
* @brief J50RS485发送关闭.
* @param
* @retval
*/
void J50RS485_tx_disenabla(void)
{
rt_pin_write(USART3_DE, read);
} }
/** /**
@ -177,11 +322,16 @@ void gw485_tx_disenabla(void)
void uart_sendstr(device_handle device,char *str) void uart_sendstr(device_handle device,char *str)
{ {
#if rs485_send_enable #if rs485_send_enable
if(device == g_bat485_uart3_handle){ if(device == g_J1RS485_UART6_handle){
bat485_tx_enabla(); J1RS485_tx_enabla();
} } else if (device == g_J2RS485_UART7_handle) {
else if (device == g_gw485_uart4_handle) { J2RS485_tx_enabla();
gw485_tx_enabla(); } else if (device == g_J3RS485_USART2_handle) {
J3RS485_tx_enabla();
} else if (device == g_J4RS485_UART8_handle) {
J4RS485_tx_enabla();
} else if (device == g_J50RS485_USART3_handle) {
J50RS485_tx_enabla();
} }
#endif #endif
@ -196,12 +346,17 @@ void uart_sendstr(device_handle device,char *str)
} }
#if rs485_send_enable #if rs485_send_enable
if(device == g_bat485_uart3_handle){ if(device == g_J1RS485_UART6_handle){
bat485_tx_disenabla(); J1RS485_tx_disenabla();
} } else if (device == g_J2RS485_UART7_handle) {
else if (device == g_gw485_uart4_handle) { J2RS485_tx_disenabla();
gw485_tx_disenabla(); } else if (device == g_J3RS485_USART2_handle) {
} J3RS485_tx_disenabla();
} else if (device == g_J4RS485_UART8_handle) {
J4RS485_tx_disenabla();
} else if (device == g_J50RS485_USART3_handle) {
J50RS485_tx_disenabla();
}
#endif #endif
} }
@ -217,11 +372,16 @@ void uart_sendstr(device_handle device,char *str)
void uart_dev_write(device_handle device, void *data, int len) void uart_dev_write(device_handle device, void *data, int len)
{ {
#if rs485_send_enable #if rs485_send_enable
if(device == g_bat485_uart3_handle){ if(device == g_J1RS485_UART6_handle){
bat485_tx_enabla(); J1RS485_tx_enabla();
} } else if (device == g_J2RS485_UART7_handle) {
else if (device == g_gw485_uart4_handle) { J2RS485_tx_enabla();
gw485_tx_enabla(); } else if (device == g_J3RS485_USART2_handle) {
J3RS485_tx_enabla();
} else if (device == g_J4RS485_UART8_handle) {
J4RS485_tx_enabla();
} else if (device == g_J50RS485_USART3_handle) {
J50RS485_tx_enabla();
} }
#endif #endif
@ -230,12 +390,17 @@ void uart_dev_write(device_handle device, void *data, int len)
} }
#if rs485_send_enable #if rs485_send_enable
if(device == g_bat485_uart3_handle){ if(device == g_J1RS485_UART6_handle){
bat485_tx_disenabla(); J1RS485_tx_disenabla();
} } else if (device == g_J2RS485_UART7_handle) {
else if (device == g_gw485_uart4_handle) { J2RS485_tx_disenabla();
gw485_tx_disenabla(); } else if (device == g_J3RS485_USART2_handle) {
} J3RS485_tx_disenabla();
} else if (device == g_J4RS485_UART8_handle) {
J4RS485_tx_disenabla();
} else if (device == g_J50RS485_USART3_handle) {
J50RS485_tx_disenabla();
}
#endif #endif
} }

View File

@ -1,12 +1,17 @@
#include <start.h> #include <start.h>
#include "inc/Android.h"
#include "inc/Android.h"
#include "inc/Flash.h" #include "inc/Flash.h"
#include "inc/UART.h" #include "inc/UART.h"
#include "inc/J5-0_USART3.h"
#include <inc/communication_protocol.h> #include <inc/communication_protocol.h>
#include "inc/Rs485.h" #include <inc/thread.h>
#include "inc/uart_dev.h"
#include "inc/thread_communication.h"
/* /*
* *
* *
@ -18,12 +23,8 @@ void hareware_init()
android_PowerCtrl_Open(); android_PowerCtrl_Open();
// SPI_Flash_TEST(); // SPI_Flash_TEST();
J5_0_485_Init();
// USARTx_SendStr(J5_0_USART, "This is a test data.\n"); // USARTx_SendStr(J5_0_USART, "This is a test data.\n");
} }
/* /*
@ -33,9 +34,11 @@ void hareware_init()
*/ */
void software_init() void software_init()
{ {
Rs485_thread_Init(); uart_dev_init();
Send_mq_Init();
Recv_thread_Init();
Send_thread_Init();
while (1);
} }
/* /*

Binary file not shown.

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -48,7 +48,9 @@ Hardware/src/J5-0_USART3.o: ../Hardware/src/J5-0_USART3.c \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/pipe.h \ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/pipe.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/poll.h \ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/poll.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/serial.h \ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/serial.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h \
D:\psx\su806\git\CH32V303_V0.1\Software\inc/uart_dev.h \
D:\psx\su806\git\CH32V303_V0.1\drivers/RingQueue/ring_queue.h
D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/J5-0_USART3.h: D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/J5-0_USART3.h:
@ -149,3 +151,7 @@ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/poll.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/serial.h: D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/serial.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h: D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h:
D:\psx\su806\git\CH32V303_V0.1\Software\inc/uart_dev.h:
D:\psx\su806\git\CH32V303_V0.1\drivers/RingQueue/ring_queue.h:

Binary file not shown.

Binary file not shown.

1
obj/Hardware/src/spi.d Normal file
View File

@ -0,0 +1 @@
Hardware/src/spi.o: ../Hardware/src/spi.c

BIN
obj/Hardware/src/spi.o Normal file

Binary file not shown.

View File

@ -12,7 +12,8 @@ C_SRCS += \
../Hardware/src/J3_USART2.c \ ../Hardware/src/J3_USART2.c \
../Hardware/src/J4_UART8.c \ ../Hardware/src/J4_UART8.c \
../Hardware/src/J5-0_USART3.c \ ../Hardware/src/J5-0_USART3.c \
../Hardware/src/UART.c ../Hardware/src/UART.c \
../Hardware/src/spi.c
OBJS += \ OBJS += \
./Hardware/src/Android.o \ ./Hardware/src/Android.o \
@ -22,7 +23,8 @@ OBJS += \
./Hardware/src/J3_USART2.o \ ./Hardware/src/J3_USART2.o \
./Hardware/src/J4_UART8.o \ ./Hardware/src/J4_UART8.o \
./Hardware/src/J5-0_USART3.o \ ./Hardware/src/J5-0_USART3.o \
./Hardware/src/UART.o ./Hardware/src/UART.o \
./Hardware/src/spi.o
C_DEPS += \ C_DEPS += \
./Hardware/src/Android.d \ ./Hardware/src/Android.d \
@ -32,7 +34,8 @@ C_DEPS += \
./Hardware/src/J3_USART2.d \ ./Hardware/src/J3_USART2.d \
./Hardware/src/J4_UART8.d \ ./Hardware/src/J4_UART8.d \
./Hardware/src/J5-0_USART3.d \ ./Hardware/src/J5-0_USART3.d \
./Hardware/src/UART.d ./Hardware/src/UART.d \
./Hardware/src/spi.d
# Each subdirectory must supply rules for building sources it contributes # Each subdirectory must supply rules for building sources it contributes

Binary file not shown.

View File

@ -49,7 +49,11 @@ Software/src/communication_protocol.o: \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/pipe.h \ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/pipe.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/poll.h \ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/poll.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/serial.h \ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/serial.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h \
D:\psx\su806\git\CH32V303_V0.1\Software\inc/uart_dev.h \
D:\psx\su806\git\CH32V303_V0.1\drivers/RingQueue/ring_queue.h \
D:\psx\su806\git\CH32V303_V0.1\Software\inc/inflash.h \
D:\psx\su806\git\CH32V303_V0.1\Software\inc/thread_communication.h
D:\psx\su806\git\CH32V303_V0.1\Software\inc/communication_protocol.h: D:\psx\su806\git\CH32V303_V0.1\Software\inc/communication_protocol.h:
@ -150,3 +154,11 @@ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/poll.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/serial.h: D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/serial.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h: D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h:
D:\psx\su806\git\CH32V303_V0.1\Software\inc/uart_dev.h:
D:\psx\su806\git\CH32V303_V0.1\drivers/RingQueue/ring_queue.h:
D:\psx\su806\git\CH32V303_V0.1\Software\inc/inflash.h:
D:\psx\su806\git\CH32V303_V0.1\Software\inc/thread_communication.h:

118
obj/Software/src/inflash.d Normal file
View File

@ -0,0 +1,118 @@
Software/src/inflash.o: ../Software/src/inflash.c \
D:\psx\su806\git\CH32V303_V0.1\Software\inc/inflash.h \
D:\psx\su806\git\CH32V303_V0.1\Debug/debug.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x.h \
D:\psx\su806\git\CH32V303_V0.1\Core/core_riscv.h \
D:\psx\su806\git\CH32V303_V0.1\User/system_ch32v30x.h \
D:\psx\su806\git\CH32V303_V0.1\User/ch32v30x_conf.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_adc.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_bkp.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_can.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_crc.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_dac.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_dbgmcu.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_dma.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_exti.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_flash.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_fsmc.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_gpio.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_i2c.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_iwdg.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_pwr.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_rcc.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_rtc.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_sdio.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_spi.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_tim.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_usart.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_wwdg.h \
D:\psx\su806\git\CH32V303_V0.1\User/ch32v30x_it.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_misc.h \
D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/flash.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rthw.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtthread.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread/rtconfig.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtdebug.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtdef.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtservice.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtm.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\finsh/finsh_api.h
D:\psx\su806\git\CH32V303_V0.1\Software\inc/inflash.h:
D:\psx\su806\git\CH32V303_V0.1\Debug/debug.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x.h:
D:\psx\su806\git\CH32V303_V0.1\Core/core_riscv.h:
D:\psx\su806\git\CH32V303_V0.1\User/system_ch32v30x.h:
D:\psx\su806\git\CH32V303_V0.1\User/ch32v30x_conf.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_adc.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_bkp.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_can.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_crc.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_dac.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_dbgmcu.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_dma.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_exti.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_flash.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_fsmc.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_gpio.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_i2c.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_iwdg.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_pwr.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_rcc.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_rtc.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_sdio.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_spi.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_tim.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_usart.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_wwdg.h:
D:\psx\su806\git\CH32V303_V0.1\User/ch32v30x_it.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_misc.h:
D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/flash.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rthw.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtthread.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread/rtconfig.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtdebug.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtdef.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtservice.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtm.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\finsh/finsh_api.h:

BIN
obj/Software/src/inflash.o Normal file

Binary file not shown.

View File

@ -5,21 +5,24 @@
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \ C_SRCS += \
../Software/src/Rs485.c \
../Software/src/communication_protocol.c \ ../Software/src/communication_protocol.c \
../Software/src/mutex.c \ ../Software/src/inflash.c \
../Software/src/thread.c \
../Software/src/thread_communication.c \
../Software/src/uart_dev.c ../Software/src/uart_dev.c
OBJS += \ OBJS += \
./Software/src/Rs485.o \
./Software/src/communication_protocol.o \ ./Software/src/communication_protocol.o \
./Software/src/mutex.o \ ./Software/src/inflash.o \
./Software/src/thread.o \
./Software/src/thread_communication.o \
./Software/src/uart_dev.o ./Software/src/uart_dev.o
C_DEPS += \ C_DEPS += \
./Software/src/Rs485.d \
./Software/src/communication_protocol.d \ ./Software/src/communication_protocol.d \
./Software/src/mutex.d \ ./Software/src/inflash.d \
./Software/src/thread.d \
./Software/src/thread_communication.d \
./Software/src/uart_dev.d ./Software/src/uart_dev.d

View File

@ -1,5 +1,5 @@
Software/src/Rs485.o: ../Software/src/Rs485.c \ Software/src/thread.o: ../Software/src/thread.c \
D:\psx\su806\git\CH32V303_V0.1\Software\inc/Rs485.h \ D:\psx\su806\git\CH32V303_V0.1\Software\inc/thread.h \
D:\psx\su806\git\CH32V303_V0.1\Software\inc/communication_protocol.h \ D:\psx\su806\git\CH32V303_V0.1\Software\inc/communication_protocol.h \
D:\psx\su806\git\CH32V303_V0.1\Hardware/inc/UART.h \ D:\psx\su806\git\CH32V303_V0.1\Hardware/inc/UART.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x.h \ D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x.h \
@ -49,9 +49,13 @@ Software/src/Rs485.o: ../Software/src/Rs485.c \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/pipe.h \ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/pipe.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/poll.h \ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/poll.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/serial.h \ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/serial.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h \
D:\psx\su806\git\CH32V303_V0.1\Software\inc/uart_dev.h \
D:\psx\su806\git\CH32V303_V0.1\drivers/RingQueue/ring_queue.h \
D:\psx\su806\git\CH32V303_V0.1\Software\inc/uart_dev.h \
D:\psx\su806\git\CH32V303_V0.1\Software\inc/thread_communication.h
D:\psx\su806\git\CH32V303_V0.1\Software\inc/Rs485.h: D:\psx\su806\git\CH32V303_V0.1\Software\inc/thread.h:
D:\psx\su806\git\CH32V303_V0.1\Software\inc/communication_protocol.h: D:\psx\su806\git\CH32V303_V0.1\Software\inc/communication_protocol.h:
@ -152,3 +156,11 @@ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/poll.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/serial.h: D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/serial.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h: D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h:
D:\psx\su806\git\CH32V303_V0.1\Software\inc/uart_dev.h:
D:\psx\su806\git\CH32V303_V0.1\drivers/RingQueue/ring_queue.h:
D:\psx\su806\git\CH32V303_V0.1\Software\inc/uart_dev.h:
D:\psx\su806\git\CH32V303_V0.1\Software\inc/thread_communication.h:

BIN
obj/Software/src/thread.o Normal file

Binary file not shown.

View File

@ -0,0 +1,122 @@
Software/src/thread_communication.o: \
../Software/src/thread_communication.c \
D:\psx\su806\git\CH32V303_V0.1\Software\inc/thread_communication.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtthread.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread/rtconfig.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtdebug.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtdef.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtservice.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtm.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\finsh/finsh_api.h \
D:\psx\su806\git\CH32V303_V0.1\Software\inc/uart_dev.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x.h \
D:\psx\su806\git\CH32V303_V0.1\Core/core_riscv.h \
D:\psx\su806\git\CH32V303_V0.1\User/system_ch32v30x.h \
D:\psx\su806\git\CH32V303_V0.1\User/ch32v30x_conf.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_adc.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_bkp.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_can.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_crc.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_dac.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_dbgmcu.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_dma.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_exti.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_flash.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_fsmc.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_gpio.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_i2c.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_iwdg.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_pwr.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_rcc.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_rtc.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_sdio.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_spi.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_tim.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_usart.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_wwdg.h \
D:\psx\su806\git\CH32V303_V0.1\User/ch32v30x_it.h \
D:\psx\su806\git\CH32V303_V0.1\Debug/debug.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_misc.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rthw.h \
D:\psx\su806\git\CH32V303_V0.1\drivers/RingQueue/ring_queue.h
D:\psx\su806\git\CH32V303_V0.1\Software\inc/thread_communication.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtthread.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread/rtconfig.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtdebug.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtdef.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtservice.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtm.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\finsh/finsh_api.h:
D:\psx\su806\git\CH32V303_V0.1\Software\inc/uart_dev.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x.h:
D:\psx\su806\git\CH32V303_V0.1\Core/core_riscv.h:
D:\psx\su806\git\CH32V303_V0.1\User/system_ch32v30x.h:
D:\psx\su806\git\CH32V303_V0.1\User/ch32v30x_conf.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_adc.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_bkp.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_can.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_crc.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_dac.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_dbgmcu.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_dma.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_exti.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_flash.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_fsmc.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_gpio.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_i2c.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_iwdg.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_pwr.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_rcc.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_rtc.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_sdio.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_spi.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_tim.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_usart.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_wwdg.h:
D:\psx\su806\git\CH32V303_V0.1\User/ch32v30x_it.h:
D:\psx\su806\git\CH32V303_V0.1\Debug/debug.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_misc.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rthw.h:
D:\psx\su806\git\CH32V303_V0.1\drivers/RingQueue/ring_queue.h:

Binary file not shown.

View File

@ -37,10 +37,9 @@ Software/src/uart_dev.o: ../Software/src/uart_dev.c \
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtm.h \ D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtm.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\finsh/finsh_api.h \ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\finsh/finsh_api.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rthw.h \ D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rthw.h \
D:\psx\su806\git\CH32V303_V0.1\drivers\RingQueue/ring_queue.h \ D:\psx\su806\git\CH32V303_V0.1\drivers/RingQueue/ring_queue.h \
D:\psx\su806\git\CH32V303_V0.1\Software\inc/rs485.h \ D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/J1_UART6.h \
D:\psx\su806\git\CH32V303_V0.1\Software\inc/communication_protocol.h \ D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/UART.h \
D:\psx\su806\git\CH32V303_V0.1\Hardware/inc/UART.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h \ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/rtdevice.h \ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/rtdevice.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/ringbuffer.h \ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/ringbuffer.h \
@ -51,7 +50,11 @@ Software/src/uart_dev.o: ../Software/src/uart_dev.c \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/pipe.h \ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/pipe.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/poll.h \ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/poll.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/serial.h \ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/serial.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h \
D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/J2_UART7.h \
D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/J3_USART2.h \
D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/J4_UART8.h \
D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/J5-0_USART3.h
D:\psx\su806\git\CH32V303_V0.1\Software\inc/uart_dev.h: D:\psx\su806\git\CH32V303_V0.1\Software\inc/uart_dev.h:
@ -129,13 +132,11 @@ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\finsh/finsh_api.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rthw.h: D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rthw.h:
D:\psx\su806\git\CH32V303_V0.1\drivers\RingQueue/ring_queue.h: D:\psx\su806\git\CH32V303_V0.1\drivers/RingQueue/ring_queue.h:
D:\psx\su806\git\CH32V303_V0.1\Software\inc/rs485.h: D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/J1_UART6.h:
D:\psx\su806\git\CH32V303_V0.1\Software\inc/communication_protocol.h: D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/UART.h:
D:\psx\su806\git\CH32V303_V0.1\Hardware/inc/UART.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h: D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h:
@ -158,3 +159,11 @@ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/poll.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/serial.h: D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/serial.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h: D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h:
D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/J2_UART7.h:
D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/J3_USART2.h:
D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/J4_UART8.h:
D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/J5-0_USART3.h:

Binary file not shown.

View File

@ -50,11 +50,13 @@ User/start.d: ../User/start.c D:\psx\su806\git\CH32V303_V0.1\User/start.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h \ D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h \
D:\psx\su806\git\CH32V303_V0.1\Hardware/inc/Flash.h \ D:\psx\su806\git\CH32V303_V0.1\Hardware/inc/Flash.h \
D:\psx\su806\git\CH32V303_V0.1\Hardware/inc/UART.h \ D:\psx\su806\git\CH32V303_V0.1\Hardware/inc/UART.h \
D:\psx\su806\git\CH32V303_V0.1\Hardware/inc/J5-0_USART3.h \
D:\psx\su806\git\CH32V303_V0.1\Hardware/inc/UART.h \
D:\psx\su806\git\CH32V303_V0.1\Software/inc/communication_protocol.h \ D:\psx\su806\git\CH32V303_V0.1\Software/inc/communication_protocol.h \
D:\psx\su806\git\CH32V303_V0.1\Software/inc/Rs485.h \ D:\psx\su806\git\CH32V303_V0.1\Software/inc/uart_dev.h \
D:\psx\su806\git\CH32V303_V0.1\Software/inc/communication_protocol.h D:\psx\su806\git\CH32V303_V0.1\drivers/RingQueue/ring_queue.h \
D:\psx\su806\git\CH32V303_V0.1\Software/inc/thread.h \
D:\psx\su806\git\CH32V303_V0.1\Software/inc/communication_protocol.h \
D:\psx\su806\git\CH32V303_V0.1\Software/inc/uart_dev.h \
D:\psx\su806\git\CH32V303_V0.1\Software/inc/thread_communication.h
D:\psx\su806\git\CH32V303_V0.1\User/start.h: D:\psx\su806\git\CH32V303_V0.1\User/start.h:
@ -160,12 +162,16 @@ D:\psx\su806\git\CH32V303_V0.1\Hardware/inc/Flash.h:
D:\psx\su806\git\CH32V303_V0.1\Hardware/inc/UART.h: D:\psx\su806\git\CH32V303_V0.1\Hardware/inc/UART.h:
D:\psx\su806\git\CH32V303_V0.1\Hardware/inc/J5-0_USART3.h: D:\psx\su806\git\CH32V303_V0.1\Software/inc/communication_protocol.h:
D:\psx\su806\git\CH32V303_V0.1\Hardware/inc/UART.h: D:\psx\su806\git\CH32V303_V0.1\Software/inc/uart_dev.h:
D:\psx\su806\git\CH32V303_V0.1\drivers/RingQueue/ring_queue.h:
D:\psx\su806\git\CH32V303_V0.1\Software/inc/thread.h:
D:\psx\su806\git\CH32V303_V0.1\Software/inc/communication_protocol.h: D:\psx\su806\git\CH32V303_V0.1\Software/inc/communication_protocol.h:
D:\psx\su806\git\CH32V303_V0.1\Software/inc/Rs485.h: D:\psx\su806\git\CH32V303_V0.1\Software/inc/uart_dev.h:
D:\psx\su806\git\CH32V303_V0.1\Software/inc/communication_protocol.h: D:\psx\su806\git\CH32V303_V0.1\Software/inc/thread_communication.h:

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -35,7 +35,8 @@ static uint32_t _SysTick_Config(rt_uint32_t ticks)
} }
#if defined(RT_USING_USER_MAIN) && defined(RT_USING_HEAP) #if defined(RT_USING_USER_MAIN) && defined(RT_USING_HEAP)
#define RT_HEAP_SIZE (1024) //#define RT_HEAP_SIZE (1024)
#define RT_HEAP_SIZE (4096)
static uint32_t rt_heap[RT_HEAP_SIZE]; // heap default size: 4K(1024 * 4) static uint32_t rt_heap[RT_HEAP_SIZE]; // heap default size: 4K(1024 * 4)
RT_WEAK void *rt_heap_begin_get(void) RT_WEAK void *rt_heap_begin_get(void)
{ {
@ -60,7 +61,8 @@ void rt_hw_board_init()
rt_components_board_init(); rt_components_board_init();
#endif #endif
#if defined(RT_USING_USER_MAIN) && defined(RT_USING_HEAP) #if defined(RT_USING_USER_MAIN) && defined(RT_USING_HEAP)
rt_system_heap_init(rt_heap_begin_get(), rt_heap_end_get()); // rt_system_heap_init(rt_heap_begin_get(), rt_heap_end_get());
rt_system_heap_init(HEAP_BEGIN, HEAP_END);
#endif #endif
#ifdef RT_USING_CONSOLE #ifdef RT_USING_CONSOLE

View File

@ -25,8 +25,9 @@
extern int _ebss; extern int _ebss;
#define HEAP_BEGIN ((void *)&_ebss) #define HEAP_BEGIN ((void *)&_ebss)
#define HEAP_END (SRAM_END-__stack_size) //#define __stack_size 32768
//#define HEAP_END ((void *)(SRAM_END-__stack_size))
#define HEAP_END ((void *)SRAM_END)
void rt_hw_board_init(void); void rt_hw_board_init(void);