测试:场景中延时执行、反馈灯控制,初步测试OK
场景执行基本功能都已测试通过,开关设备、插卡取电设备、温控器设备初步测试OK
This commit is contained in:
@@ -33,10 +33,10 @@ __attribute__((section(".non_0_wait"))) void UARTx_Init(UART_IDX uart_id, uint32
|
||||
|
||||
switch (uart_id) {
|
||||
case UART_0:
|
||||
/* <20><><EFBFBD>ô<EFBFBD><C3B4><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IO<EFBFBD><EFBFBD>ģʽ */
|
||||
/* <20><><EFBFBD>ô<EFBFBD><C3B4><EFBFBD>0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IO<EFBFBD><EFBFBD>ģʽ */
|
||||
UART0_BaudRateCfg(buad);
|
||||
R8_UART0_FCR = RB_FCR_FIFO_TRIG | RB_FCR_TX_FIFO_CLR | RB_FCR_RX_FIFO_CLR | RB_FCR_FIFO_EN;
|
||||
// FIFO open, trigger point 14 bytes
|
||||
R8_UART0_FCR = RB_FCR_TX_FIFO_CLR | RB_FCR_RX_FIFO_CLR | RB_FCR_FIFO_EN;
|
||||
// FIFO open, trigger point 1 bytes
|
||||
R8_UART0_LCR = RB_LCR_WORD_SZ;
|
||||
R8_UART0_IER = RB_IER_TXD_EN;
|
||||
|
||||
@@ -44,7 +44,10 @@ __attribute__((section(".non_0_wait"))) void UARTx_Init(UART_IDX uart_id, uint32
|
||||
GPIOB_ModeCfg(GPIO_Pin_9, GPIO_ModeOut_PP);
|
||||
GPIOB_ModeCfg(GPIO_Pin_8, GPIO_ModeIN_Floating);
|
||||
|
||||
GPIOB_ModeCfg(GPIO_Pin_15, GPIO_ModeOut_PP); //RS485<38><35><EFBFBD>ų<EFBFBD>ʼ<EFBFBD><CABC> - <20><>ѯ<EFBFBD>˿<EFBFBD> RS485 ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
UART0_INTCfg(ENABLE, RB_IER_RECV_RDY | RB_IER_THR_EMPTY);
|
||||
NVIC_SetPriority(UART0_IRQn, 0x80);
|
||||
NVIC_EnableIRQ(UART0_IRQn);
|
||||
|
||||
memset(&g_uart[UART_0],0,sizeof(UART_t));
|
||||
@@ -58,8 +61,8 @@ __attribute__((section(".non_0_wait"))) void UARTx_Init(UART_IDX uart_id, uint32
|
||||
case UART_1:
|
||||
/* <20><><EFBFBD>ô<EFBFBD><C3B4><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IO<49><4F>ģʽ */
|
||||
UART1_BaudRateCfg(buad);
|
||||
R8_UART1_FCR = RB_FCR_FIFO_TRIG | RB_FCR_TX_FIFO_CLR | RB_FCR_RX_FIFO_CLR | RB_FCR_FIFO_EN;
|
||||
// FIFO open, trigger point 14 bytes
|
||||
R8_UART1_FCR = RB_FCR_TX_FIFO_CLR | RB_FCR_RX_FIFO_CLR | RB_FCR_FIFO_EN;
|
||||
// FIFO open, trigger point 1 bytes
|
||||
R8_UART1_LCR = RB_LCR_WORD_SZ;
|
||||
R8_UART1_IER = RB_IER_TXD_EN;
|
||||
|
||||
@@ -68,6 +71,7 @@ __attribute__((section(".non_0_wait"))) void UARTx_Init(UART_IDX uart_id, uint32
|
||||
GPIOB_ModeCfg(GPIO_Pin_10, GPIO_ModeIN_Floating);
|
||||
|
||||
UART1_INTCfg(ENABLE, RB_IER_RECV_RDY | RB_IER_THR_EMPTY);
|
||||
NVIC_SetPriority(UART1_IRQn, 0x80);
|
||||
NVIC_EnableIRQ(UART1_IRQn);
|
||||
|
||||
memset(&g_uart[UART_1],0,sizeof(UART_t));
|
||||
@@ -80,15 +84,18 @@ __attribute__((section(".non_0_wait"))) void UARTx_Init(UART_IDX uart_id, uint32
|
||||
break;
|
||||
case UART_2:
|
||||
UART2_BaudRateCfg(buad);
|
||||
R8_UART2_FCR = RB_FCR_FIFO_TRIG | RB_FCR_TX_FIFO_CLR | RB_FCR_RX_FIFO_CLR | RB_FCR_FIFO_EN;
|
||||
// FIFO open, trigger point 14 bytes
|
||||
R8_UART2_FCR = RB_FCR_TX_FIFO_CLR | RB_FCR_RX_FIFO_CLR | RB_FCR_FIFO_EN;
|
||||
// FIFO open, trigger point 1 bytes
|
||||
R8_UART2_LCR = RB_LCR_WORD_SZ;
|
||||
R8_UART2_IER = RB_IER_TXD_EN;
|
||||
GPIO_PinRemapConfig(GPIO_PartialRemap1_UART2,ENABLE);
|
||||
GPIOB_ModeCfg(GPIO_Pin_14, GPIO_ModeOut_PP);
|
||||
GPIOB_ModeCfg(GPIO_Pin_12, GPIO_ModeIN_Floating);
|
||||
|
||||
GPIOD_ModeCfg(GPIO_Pin_21, GPIO_ModeOut_PP); //RS485<38><35><EFBFBD>ų<EFBFBD>ʼ<EFBFBD><CABC> - <20><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD> RS485 ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
UART2_INTCfg(ENABLE, RB_IER_RECV_RDY | RB_IER_THR_EMPTY);
|
||||
NVIC_SetPriority(UART2_IRQn, 0x80);
|
||||
NVIC_EnableIRQ(UART2_IRQn);
|
||||
|
||||
memset(&g_uart[UART_2],0,sizeof(UART_t));
|
||||
@@ -101,8 +108,8 @@ __attribute__((section(".non_0_wait"))) void UARTx_Init(UART_IDX uart_id, uint32
|
||||
break;
|
||||
case UART_3:
|
||||
UART3_BaudRateCfg(buad);
|
||||
R8_UART3_FCR = RB_FCR_FIFO_TRIG | RB_FCR_TX_FIFO_CLR | RB_FCR_RX_FIFO_CLR | RB_FCR_FIFO_EN;
|
||||
// FIFO open, trigger point 14 bytes
|
||||
R8_UART3_FCR = RB_FCR_TX_FIFO_CLR | RB_FCR_RX_FIFO_CLR | RB_FCR_FIFO_EN;
|
||||
// FIFO open, trigger point 1 bytes
|
||||
R8_UART3_LCR = RB_LCR_WORD_SZ;
|
||||
R8_UART3_IER = RB_IER_TXD_EN;
|
||||
GPIO_PinRemapConfig(GPIO_PartialRemap1_UART3,ENABLE);
|
||||
@@ -110,6 +117,7 @@ __attribute__((section(".non_0_wait"))) void UARTx_Init(UART_IDX uart_id, uint32
|
||||
GPIOB_ModeCfg(GPIO_Pin_18, GPIO_ModeIN_Floating);
|
||||
|
||||
UART3_INTCfg(ENABLE, RB_IER_RECV_RDY | RB_IER_THR_EMPTY);
|
||||
NVIC_SetPriority(UART3_IRQn, 0x80);
|
||||
NVIC_EnableIRQ(UART3_IRQn);
|
||||
|
||||
memset(&g_uart[UART_3],0,sizeof(UART_t));
|
||||
@@ -257,8 +265,8 @@ __attribute__((section(".non_0_wait"))) void UART0_RECEIVE(void)
|
||||
{
|
||||
g_uart[UART_0].RecvIdleTiming = SysTick_1ms;
|
||||
|
||||
Dbg_Println(DBG_BIT_SYS_STATUS_bit,"UART_0 Len %d ",g_uart[UART_0].RecvLen);
|
||||
Dbg_Print_Buff(DBG_BIT_SYS_STATUS_bit,"UART_0 Buff:", g_uart[UART_0].RecvBuffer,g_uart[UART_0].RecvLen);
|
||||
// Dbg_Println(DBG_BIT_SYS_STATUS_bit,"UART_0 Len %d ",g_uart[UART_0].RecvLen);
|
||||
// Dbg_Print_Buff(DBG_BIT_SYS_STATUS_bit,"UART_0 Buff:", g_uart[UART_0].RecvBuffer,g_uart[UART_0].RecvLen);
|
||||
|
||||
g_uart[UART_0].Receiving = 0;
|
||||
|
||||
@@ -291,8 +299,8 @@ __attribute__((section(".non_0_wait"))) void UART1_RECEIVE(void)
|
||||
{
|
||||
g_uart[UART_1].RecvIdleTiming = SysTick_1ms;
|
||||
|
||||
Dbg_Println(DBG_BIT_SYS_STATUS_bit,"UART_1 Len %d ",g_uart[UART_1].RecvLen);
|
||||
Dbg_Print_Buff(DBG_BIT_SYS_STATUS_bit,"UART_1 Buff:", g_uart[UART_1].RecvBuffer,g_uart[UART_1].RecvLen);
|
||||
// Dbg_Println(DBG_BIT_SYS_STATUS_bit,"UART_1 Len %d ",g_uart[UART_1].RecvLen);
|
||||
// Dbg_Print_Buff(DBG_BIT_SYS_STATUS_bit,"UART_1 Buff:", g_uart[UART_1].RecvBuffer,g_uart[UART_1].RecvLen);
|
||||
|
||||
g_uart[UART_1].Receiving = 0;
|
||||
|
||||
@@ -327,8 +335,8 @@ __attribute__((section(".non_0_wait"))) void UART2_RECEIVE(void)
|
||||
{
|
||||
g_uart[UART_2].RecvIdleTiming = SysTick_1ms;
|
||||
|
||||
Dbg_Println(DBG_BIT_SYS_STATUS_bit,"UART_2 Len %d ",g_uart[UART_2].RecvLen);
|
||||
Dbg_Print_Buff(DBG_BIT_SYS_STATUS_bit,"UART_2 Buff:", g_uart[UART_2].RecvBuffer,g_uart[UART_2].RecvLen);
|
||||
// Dbg_Println(DBG_BIT_SYS_STATUS_bit,"UART_2 Len %d ",g_uart[UART_2].RecvLen);
|
||||
// Dbg_Print_Buff(DBG_BIT_SYS_STATUS_bit,"UART_2 Buff:", g_uart[UART_2].RecvBuffer,g_uart[UART_2].RecvLen);
|
||||
|
||||
g_uart[UART_2].Receiving = 0;
|
||||
|
||||
@@ -693,26 +701,26 @@ __attribute__((section(".non_0_wait"))) void Uart_SendString(uint8_t uart_id,uin
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : MCU485_SendString_1
|
||||
* Description : 485_1 <20><><EFBFBD>ͺ<EFBFBD><CDBA><EFBFBD>
|
||||
* Function Name : MCU485_SendString_0
|
||||
* Description : 485_0 <20><><EFBFBD>ͺ<EFBFBD><CDBA><EFBFBD>
|
||||
* Input :
|
||||
buf - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
l - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void MCU485_SendString_1(uint8_t *buf, uint16_t len)
|
||||
__attribute__((section(".non_0_wait"))) void MCU485_SendString_0(uint8_t *buf, uint16_t len)
|
||||
{
|
||||
uint16_t delay_num = 0;
|
||||
|
||||
MCU485_EN1_H;
|
||||
|
||||
UART1_SendString(buf,len);
|
||||
UART0_SendString(buf,len);
|
||||
|
||||
//<2F>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - 50ms
|
||||
while(1)
|
||||
{
|
||||
WDT_Feed();
|
||||
if( (R8_UART1_LSR & RB_LSR_TX_ALL_EMP) != 0x00 ) break; //<2F>жϷ<D0B6><CFB7><EFBFBD>FIFOΪ<4F><CEAA>,ͬʱFIFO<46><4F><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>
|
||||
if( (R8_UART0_LSR & RB_LSR_TX_ALL_EMP) != 0x00 ) break; //<2F>жϷ<D0B6><CFB7><EFBFBD>FIFOΪ<4F><CEAA>,ͬʱFIFO<46><4F><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>
|
||||
Delay_Us(100);
|
||||
delay_num++;
|
||||
if(delay_num > 500) break;
|
||||
@@ -789,23 +797,24 @@ __attribute__((section(".non_0_wait"))) void MCU485_SendString_3(uint8_t *buf, u
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void MCU485_SendString(uint8_t uart_id,uint8_t* buff,uint16_t len)
|
||||
{
|
||||
//Dbg_Println(DBG_BIT_SYS_STATUS_bit,"%s:%d - %d",__func__,uart_id,len);
|
||||
switch(uart_id)
|
||||
{
|
||||
case UART_1:
|
||||
case Polling_Port:
|
||||
if(Poll485_Info.port_mode == Port_Monitoring_mode ) //<2F><>ѯ<EFBFBD>˿<EFBFBD>
|
||||
{
|
||||
//Udp_Internal_SeriaNet_Uploading2(Polling_Port,Poll485_Info.baud,buff,len);
|
||||
}
|
||||
MCU485_SendString_1(buff,len);
|
||||
MCU485_SendString_0(buff,len);
|
||||
break;
|
||||
case UART_2:
|
||||
case Active_Port:
|
||||
if(Act485_Info.port_mode == Port_Monitoring_mode ) //<2F><>ѯ<EFBFBD>˿<EFBFBD>
|
||||
{
|
||||
//Udp_Internal_SeriaNet_Uploading2(Active_Port,Act485_Info.baud,buff,len);
|
||||
}
|
||||
MCU485_SendString_2(buff,len);
|
||||
break;
|
||||
case UART_3:
|
||||
case Bus_port:
|
||||
if(BUS485_Info.port_mode == Port_Monitoring_mode ) //<2F><>ѯ<EFBFBD>˿<EFBFBD>
|
||||
{
|
||||
//Udp_Internal_SeriaNet_Uploading2(Bus_port,BUS485_Info.baud,buff,len);
|
||||
|
||||
Reference in New Issue
Block a user