|
|
@ -127,6 +127,7 @@ int FDCAN2_Send(char *_pBuffer, uint32_t _iSize) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#ifndef CONFIG_UART_IT_IDLEDMA |
|
|
#ifndef CONFIG_UART_IT_IDLEDMA |
|
|
|
|
|
extern TComCtrl *g_ptUartCtrl; |
|
|
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) |
|
|
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) |
|
|
{ |
|
|
{ |
|
|
if (huart->Instance == USART1) |
|
|
if (huart->Instance == USART1) |
|
|
@ -139,7 +140,8 @@ void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) |
|
|
} |
|
|
} |
|
|
else if (huart->Instance == USART3) |
|
|
else if (huart->Instance == USART3) |
|
|
{ |
|
|
{ |
|
|
UART_RX_IRQHandler(g_ptRS485_2); |
|
|
//UART_RX_IRQHandler(g_ptRS485_2);
|
|
|
|
|
|
UART_RX_IRQHandler(g_ptUartCtrl); |
|
|
} |
|
|
} |
|
|
else if (huart->Instance == UART4) |
|
|
else if (huart->Instance == UART4) |
|
|
{ |
|
|
{ |
|
|
@ -160,6 +162,30 @@ void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) |
|
|
|
|
|
{ |
|
|
|
|
|
if (huart->Instance == USART1) //**RS485_1
|
|
|
|
|
|
{ |
|
|
|
|
|
HAL_GPIO_WritePin(RS485_1_DIR_GPIO_Port, RS485_1_DIR_Pin, |
|
|
|
|
|
GPIO_PIN_RESET); |
|
|
|
|
|
} |
|
|
|
|
|
else if (huart->Instance == USART3) //**RS485_2
|
|
|
|
|
|
{ |
|
|
|
|
|
HAL_GPIO_WritePin(RS485_2_DIR_GPIO_Port, RS485_2_DIR_Pin, |
|
|
|
|
|
GPIO_PIN_RESET); |
|
|
|
|
|
} |
|
|
|
|
|
else if (huart->Instance == USART6) //**RS485_3
|
|
|
|
|
|
{ |
|
|
|
|
|
HAL_GPIO_WritePin(RS485_3_DIR_GPIO_Port, |
|
|
|
|
|
RS485_3_DIR_Pin, GPIO_PIN_RESET); |
|
|
|
|
|
} |
|
|
|
|
|
else if (huart->Instance == UART7) //**RS485_4
|
|
|
|
|
|
{ |
|
|
|
|
|
HAL_GPIO_WritePin(RS485_4_DIR_GPIO_Port, |
|
|
|
|
|
RS485_4_DIR_Pin, GPIO_PIN_RESET); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void HAL_FDCAN_ErrorStatusCallback(FDCAN_HandleTypeDef *hfdcan, uint32_t ErrorStatusITs) |
|
|
void HAL_FDCAN_ErrorStatusCallback(FDCAN_HandleTypeDef *hfdcan, uint32_t ErrorStatusITs) |
|
|
{ |
|
|
{ |
|
|
if (hfdcan->Instance == FDCAN1) |
|
|
if (hfdcan->Instance == FDCAN1) |
|
|
@ -203,7 +229,8 @@ void SendAll_Task(void *argument) |
|
|
{ |
|
|
{ |
|
|
rd_ComSendProc(g_ptRS485_1); |
|
|
rd_ComSendProc(g_ptRS485_1); |
|
|
Rd_Delay(1); |
|
|
Rd_Delay(1); |
|
|
rd_ComSendProc(g_ptRS485_2); |
|
|
//rd_ComSendProc(g_ptRS485_2);
|
|
|
|
|
|
rd_ComSendProc(g_ptUartCtrl); |
|
|
Rd_Delay(1); |
|
|
Rd_Delay(1); |
|
|
rd_ComSendProc(g_ptRS485_3); |
|
|
rd_ComSendProc(g_ptRS485_3); |
|
|
Rd_Delay(1); |
|
|
Rd_Delay(1); |
|
|
@ -224,21 +251,21 @@ void SendAll_Task(void *argument) |
|
|
|
|
|
|
|
|
void Drv_InterfaceInit(void) |
|
|
void Drv_InterfaceInit(void) |
|
|
{ |
|
|
{ |
|
|
MK32_Init(); |
|
|
//MK32_Init();
|
|
|
|
|
|
|
|
|
const osThreadAttr_t Read_RS485_1_attributes = { |
|
|
const osThreadAttr_t Read_RS485_1_attributes = { |
|
|
.name = "RS485_1", |
|
|
.name = "RS485_1", |
|
|
.stack_size = 512, |
|
|
.stack_size = 512, |
|
|
.priority = (osPriority_t) osPriorityHigh7, |
|
|
.priority = (osPriority_t) osPriorityHigh6, |
|
|
}; |
|
|
}; |
|
|
(void)osThreadNew(Read_RS485_1, NULL, &Read_RS485_1_attributes); |
|
|
(void)osThreadNew(Read_RS485_1, NULL, &Read_RS485_1_attributes); |
|
|
|
|
|
|
|
|
const osThreadAttr_t send_task_attributes = { |
|
|
const osThreadAttr_t send_task_attributes = { |
|
|
.name = "send_task", |
|
|
.name = "send_task", |
|
|
.stack_size = 512, |
|
|
.stack_size = 512, |
|
|
.priority = (osPriority_t) osPriorityRealtime, |
|
|
.priority = (osPriority_t) osPriorityHigh7, |
|
|
}; |
|
|
}; |
|
|
(void)osThreadNew(SendAll_Task, NULL, &send_task_attributes); |
|
|
(void)osThreadNew(SendAll_Task, NULL, &send_task_attributes); |
|
|
|
|
|
|
|
|
MoveWheel_Init(); |
|
|
//MoveWheel_Init();
|
|
|
} |
|
|
} |
|
|
|