This commit is contained in:
王绪洁 2025-03-13 16:15:26 +08:00
parent 8ee08d8ebf
commit 798941886f
13 changed files with 6229 additions and 9696 deletions

View File

@ -61,6 +61,7 @@ osThreadId dac_taskHandle;
osThreadId adc_taskHandle; osThreadId adc_taskHandle;
osThreadId gpio_di_do_taskHandle; osThreadId gpio_di_do_taskHandle;
osThreadId ec11_taskHandle; osThreadId ec11_taskHandle;
osThreadId lcd_taskHandle;
/* Private function prototypes -----------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN FunctionPrototypes */ /* USER CODE BEGIN FunctionPrototypes */
@ -80,6 +81,7 @@ void start_dac_task(void const *argument);
void start_adc_task(void const *argument); void start_adc_task(void const *argument);
void start_gpio_di_do_task(void const *argument); void start_gpio_di_do_task(void const *argument);
void start_ec11_task(void const *argument); void start_ec11_task(void const *argument);
void start_lcd_task(void const *argument);
extern void MX_LWIP_Init(void); extern void MX_LWIP_Init(void);
void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */ void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */
@ -152,6 +154,10 @@ void MX_FREERTOS_Init(void)
osThreadDef(ec11_task, start_ec11_task, osPriorityNormal, 0, 128); osThreadDef(ec11_task, start_ec11_task, osPriorityNormal, 0, 128);
ec11_taskHandle = osThreadCreate(osThread(ec11_task), NULL); ec11_taskHandle = osThreadCreate(osThread(ec11_task), NULL);
/* definition and creation of lcd_task */
osThreadDef(lcd_task, start_lcd_task, osPriorityIdle, 0, 512);
lcd_taskHandle = osThreadCreate(osThread(lcd_task), NULL);
/* USER CODE BEGIN RTOS_THREADS */ /* USER CODE BEGIN RTOS_THREADS */
/* add threads, ... */ /* add threads, ... */
/* USER CODE END RTOS_THREADS */ /* USER CODE END RTOS_THREADS */
@ -173,7 +179,7 @@ void start_tcp_task(void const *argument)
/* Infinite loop */ /* Infinite loop */
for (;;) for (;;)
{ {
uart_lcd_draw_ipaddr(); // uart_lcd_draw_ipaddr();
osThreadTerminate(NULL); osThreadTerminate(NULL);
} }
/* USER CODE END start_tcp_task */ /* USER CODE END start_tcp_task */
@ -201,7 +207,8 @@ void start_led_toggle_task(void const *argument)
ec11_data.confirm_key_flag_last++; ec11_data.confirm_key_flag_last++;
if (ec11_data.confirm_key_flag_last > 3) if (ec11_data.confirm_key_flag_last > 3)
{ {
HAL_GPIO_TogglePin(LED2_G_GPIO_Port, LED2_G_Pin); current_buff[0] = (float)uart_lcd_state.current_value[0];
current_buff[1] = (float)uart_lcd_state.current_value[1];
ec11_data.confirm_key_flag_last = 0; ec11_data.confirm_key_flag_last = 0;
ec11_data.confirm_key_flag = 0; ec11_data.confirm_key_flag = 0;
} }
@ -209,11 +216,25 @@ void start_led_toggle_task(void const *argument)
else if (ec11_data.confirm_key_flag == 2) else if (ec11_data.confirm_key_flag == 2)
{ {
ec11_data.confirm_key_flag_last = 0; ec11_data.confirm_key_flag_last = 0;
HAL_GPIO_TogglePin(LED2_R_GPIO_Port, LED2_R_Pin);
if (uart_lcd_state.key_state[0] == 1)
{
uart_lcd_state.key_state[0] = 0;
uart_lcd_state.key_state[1] = 1;
uart_lcd_state.key_state[2] = 0;
}
else if (uart_lcd_state.key_state[0] == 0)
{
uart_lcd_state.key_state[0] = 1;
uart_lcd_state.key_state[1] = 0;
uart_lcd_state.key_state[2] = 1;
}
ec11_data.confirm_key_flag = 0; ec11_data.confirm_key_flag = 0;
uart_lcd_channel_switch(uart_lcd_state.key_state[0]);
} }
vTaskDelay(1000); vTaskDelay(400);
} }
/* USER CODE END start_led_toggle_task */ /* USER CODE END start_led_toggle_task */
} }
@ -264,11 +285,11 @@ void start_adc_task(void const *argument)
// HAL_GPIO_TogglePin(LED2_Y_GPIO_Port, LED2_Y_Pin); // HAL_GPIO_TogglePin(LED2_Y_GPIO_Port, LED2_Y_Pin);
if (huart5.RxState == HAL_UART_STATE_READY) if (huart5.RxState == HAL_UART_STATE_READY)
{ {
HAL_UARTEx_ReceiveToIdle_DMA(&huart5, hart1_uart5.rx_data_temp, ARRAY_LEN(hart1_uart5.rx_data_temp)); // TODO 后续修改此处,改为输出电流电流 HAL_UARTEx_ReceiveToIdle_DMA(&huart5, hart1_uart5.rx_data_temp, ARRAY_LEN(hart1_uart5.rx_data_temp));
} }
if (huart2.RxState == HAL_UART_STATE_READY) if (huart2.RxState == HAL_UART_STATE_READY)
{ {
HAL_UARTEx_ReceiveToIdle_DMA(&huart2, hart2_uart2.rx_data_temp, ARRAY_LEN(hart2_uart2.rx_data_temp)); // TODO 后续修改此处,改为修改输出通道 HAL_UARTEx_ReceiveToIdle_DMA(&huart2, hart2_uart2.rx_data_temp, ARRAY_LEN(hart2_uart2.rx_data_temp));
} }
osThreadResume(dac_taskHandle); osThreadResume(dac_taskHandle);
vTaskDelay(10); vTaskDelay(10);
@ -295,8 +316,8 @@ void start_gpio_di_do_task(void const *argument)
uint8_t tx_data[32] = {0}; uint8_t tx_data[32] = {0};
tx_data[0] = FRAME_HEAD; // 帧头 tx_data[0] = FRAME_HEAD; // 帧头
tx_data[1] = COM_OK; // 状<>?<3F> tx_data[1] = COM_OK; // 状<>?<3F>
tx_data[2] = DEVICE_NUM; // 设备<E8AEBE>? tx_data[2] = DEVICE_NUM; // 设备<E8AEBE>??
tx_data[3] = SEND_STATE_CMD; // 命令<E591BD>? tx_data[3] = SEND_STATE_CMD; // 命令<E591BD>??
tx_data[4] = DI_MAX; // 数据长度 tx_data[4] = DI_MAX; // 数据长度
for (di_ch = 0; di_ch < DI_MAX; di_ch++) for (di_ch = 0; di_ch < DI_MAX; di_ch++)
{ {
@ -339,11 +360,78 @@ void start_ec11_task(void const *argument)
{ {
ec11_data.direction = __HAL_TIM_IS_TIM_COUNTING_DOWN(&htim1); ec11_data.direction = __HAL_TIM_IS_TIM_COUNTING_DOWN(&htim1);
ec11_data.encode_num = (short)__HAL_TIM_GET_COUNTER(&htim1); ec11_data.encode_num = (short)__HAL_TIM_GET_COUNTER(&htim1);
vTaskDelay(10); if ((ec11_data.direction == 0) && (ec11_data.encode_num > ec11_data.encode_num_last))
{
if (uart_lcd_state.key_state[0] == 0)
{
uart_lcd_state.current_value[0] += 1;
if (uart_lcd_state.current_value[0] > 20)
{
uart_lcd_state.current_value[0] = 20;
}
}
else if (uart_lcd_state.key_state[0] == 1)
{
uart_lcd_state.current_value[1] += 1;
if (uart_lcd_state.current_value[1] > 20)
{
uart_lcd_state.current_value[1] = 20;
}
}
// current_buff[0] = (float)uart_lcd_state.current_value[0];
}
if ((ec11_data.direction == 1) && (ec11_data.encode_num < ec11_data.encode_num_last))
{
if (uart_lcd_state.key_state[0] == 0)
{
if (uart_lcd_state.current_value[0] < 2)
{
uart_lcd_state.current_value[0] = 0;
}
else
{
uart_lcd_state.current_value[0] -= 1;
}
}
else if (uart_lcd_state.key_state[0] == 1)
{
if (uart_lcd_state.current_value[1] < 2)
{
uart_lcd_state.current_value[1] = 0;
}
else
{
uart_lcd_state.current_value[1] -= 1;
}
}
// current_buff[1] = (float)uart_lcd_state.current_value[1];
}
uart_lcd_current_out(uart_lcd_state.key_state[0]);
ec11_data.encode_num_last = ec11_data.encode_num;
vTaskDelay(100);
} }
/* USER CODE END start_ec11_task */ /* USER CODE END start_ec11_task */
} }
/* USER CODE BEGIN Header_start_lcd_task */
/**
* @brief Function implementing the lcd_task thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_start_lcd_task */
void start_lcd_task(void const *argument)
{
/* USER CODE BEGIN start_lcd_task */
uart_lcd_init();
/* Infinite loop */
for (;;)
{
vTaskDelay(10);
}
/* USER CODE END start_lcd_task */
}
/* Private application code --------------------------------------------------*/ /* Private application code --------------------------------------------------*/
/* USER CODE BEGIN Application */ /* USER CODE BEGIN Application */

View File

@ -87,9 +87,9 @@ extern ip4_addr_t ipaddr;
/* USER CODE END 0 */ /* USER CODE END 0 */
/** /**
* @brief The application entry point. * @brief The application entry point.
* @retval int * @retval int
*/ */
int main(void) int main(void)
{ {
/* USER CODE BEGIN 1 */ /* USER CODE BEGIN 1 */
@ -126,7 +126,7 @@ int main(void)
MX_TIM1_Init(); MX_TIM1_Init();
MX_USART1_UART_Init(); MX_USART1_UART_Init();
/* USER CODE BEGIN 2 */ /* USER CODE BEGIN 2 */
/*é…<EFBFBD>ç½®å<EFBFBD>„串å<EFBFBD>£çš„DMA接收*/ /*酝置坄串坣的DMA接收*/
// start // start
HAL_UARTEx_ReceiveToIdle_DMA(&huart4, lcd_uart4.rx_data_temp, ARRAY_LEN(lcd_uart4.rx_data_temp)); HAL_UARTEx_ReceiveToIdle_DMA(&huart4, lcd_uart4.rx_data_temp, ARRAY_LEN(lcd_uart4.rx_data_temp));
HAL_UARTEx_ReceiveToIdle_DMA(&huart6, ble1_uart6.rx_data_temp, ARRAY_LEN(ble1_uart6.rx_data_temp)); HAL_UARTEx_ReceiveToIdle_DMA(&huart6, ble1_uart6.rx_data_temp, ARRAY_LEN(ble1_uart6.rx_data_temp));
@ -137,7 +137,7 @@ int main(void)
// end // end
hart_ht1200m_reset(); // 初始化HT1200M模块 hart_ht1200m_reset(); // 初始化HT1200M模块
HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1); // PWM输出用于驱动HT1200M模块 HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1); // PWM输出用于驱动HT1200M模块
HAL_TIM_Encoder_Start(&htim1, TIM_CHANNEL_ALL); // æ—转ç¼ç <EFBFBD>器输å…? HAL_TIM_Encoder_Start(&htim1, TIM_CHANNEL_ALL); // 旋转编砝器输<EFBFBD>??
/* USER CODE END 2 */ /* USER CODE END 2 */
/* Call init function for freertos objects (in freertos.c) */ /* Call init function for freertos objects (in freertos.c) */
@ -158,22 +158,22 @@ int main(void)
} }
/** /**
* @brief System Clock Configuration * @brief System Clock Configuration
* @retval None * @retval None
*/ */
void SystemClock_Config(void) void SystemClock_Config(void)
{ {
RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
/** Configure the main internal regulator output voltage /** Configure the main internal regulator output voltage
*/ */
__HAL_RCC_PWR_CLK_ENABLE(); __HAL_RCC_PWR_CLK_ENABLE();
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
/** Initializes the RCC Oscillators according to the specified parameters /** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure. * in the RCC_OscInitTypeDef structure.
*/ */
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
@ -188,9 +188,8 @@ void SystemClock_Config(void)
} }
/** Initializes the CPU, AHB and APB buses clocks /** Initializes the CPU, AHB and APB buses clocks
*/ */
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
@ -219,7 +218,7 @@ void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
gnetif.ip_addr = ipaddr; gnetif.ip_addr = ipaddr;
if (flash_write_data(FLASH_USER_START_ADDR, usb_uart1.rx_data_temp, Size) == HAL_OK) if (flash_write_data(FLASH_USER_START_ADDR, usb_uart1.rx_data_temp, Size) == HAL_OK)
{ {
uart_lcd_draw_ipaddr(); // uart_lcd_draw_ipaddr();
} }
} }
if (huart == &huart4) if (huart == &huart4)
@ -290,23 +289,28 @@ void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
{ {
HART2_RTS_RECEIVE; HART2_RTS_RECEIVE;
} }
if (huart == &huart4)
{
HART2_RTS_RECEIVE;
}
} }
/* USER CODE END 4 */ /* USER CODE END 4 */
/** /**
* @brief Period elapsed callback in non blocking mode * @brief Period elapsed callback in non blocking mode
* @note This function is called when TIM4 interrupt took place, inside * @note This function is called when TIM4 interrupt took place, inside
* HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment * HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment
* a global variable "uwTick" used as application time base. * a global variable "uwTick" used as application time base.
* @param htim : TIM handle * @param htim : TIM handle
* @retval None * @retval None
*/ */
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{ {
/* USER CODE BEGIN Callback 0 */ /* USER CODE BEGIN Callback 0 */
/* USER CODE END Callback 0 */ /* USER CODE END Callback 0 */
if (htim->Instance == TIM4) { if (htim->Instance == TIM4)
{
HAL_IncTick(); HAL_IncTick();
} }
/* USER CODE BEGIN Callback 1 */ /* USER CODE BEGIN Callback 1 */
@ -315,9 +319,9 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
} }
/** /**
* @brief This function is executed in case of error occurrence. * @brief This function is executed in case of error occurrence.
* @retval None * @retval None
*/ */
void Error_Handler(void) void Error_Handler(void)
{ {
/* USER CODE BEGIN Error_Handler_Debug */ /* USER CODE BEGIN Error_Handler_Debug */
@ -329,14 +333,14 @@ void Error_Handler(void)
/* USER CODE END Error_Handler_Debug */ /* USER CODE END Error_Handler_Debug */
} }
#ifdef USE_FULL_ASSERT #ifdef USE_FULL_ASSERT
/** /**
* @brief Reports the name of the source file and the source line number * @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred. * where the assert_param error has occurred.
* @param file: pointer to the source file name * @param file: pointer to the source file name
* @param line: assert_param error line source number * @param line: assert_param error line source number
* @retval None * @retval None
*/ */
void assert_failed(uint8_t *file, uint32_t line) void assert_failed(uint8_t *file, uint32_t line)
{ {
/* USER CODE BEGIN 6 */ /* USER CODE BEGIN 6 */

View File

@ -92,8 +92,8 @@ extern TIM_HandleTypeDef htim4;
/* Cortex-M4 Processor Interruption and Exception Handlers */ /* Cortex-M4 Processor Interruption and Exception Handlers */
/******************************************************************************/ /******************************************************************************/
/** /**
* @brief This function handles Non maskable interrupt. * @brief This function handles Non maskable interrupt.
*/ */
void NMI_Handler(void) void NMI_Handler(void)
{ {
/* USER CODE BEGIN NonMaskableInt_IRQn 0 */ /* USER CODE BEGIN NonMaskableInt_IRQn 0 */
@ -107,8 +107,8 @@ void NMI_Handler(void)
} }
/** /**
* @brief This function handles Hard fault interrupt. * @brief This function handles Hard fault interrupt.
*/ */
void HardFault_Handler(void) void HardFault_Handler(void)
{ {
/* USER CODE BEGIN HardFault_IRQn 0 */ /* USER CODE BEGIN HardFault_IRQn 0 */
@ -122,8 +122,8 @@ void HardFault_Handler(void)
} }
/** /**
* @brief This function handles Memory management fault. * @brief This function handles Memory management fault.
*/ */
void MemManage_Handler(void) void MemManage_Handler(void)
{ {
/* USER CODE BEGIN MemoryManagement_IRQn 0 */ /* USER CODE BEGIN MemoryManagement_IRQn 0 */
@ -137,8 +137,8 @@ void MemManage_Handler(void)
} }
/** /**
* @brief This function handles Pre-fetch fault, memory access fault. * @brief This function handles Pre-fetch fault, memory access fault.
*/ */
void BusFault_Handler(void) void BusFault_Handler(void)
{ {
/* USER CODE BEGIN BusFault_IRQn 0 */ /* USER CODE BEGIN BusFault_IRQn 0 */
@ -152,8 +152,8 @@ void BusFault_Handler(void)
} }
/** /**
* @brief This function handles Undefined instruction or illegal state. * @brief This function handles Undefined instruction or illegal state.
*/ */
void UsageFault_Handler(void) void UsageFault_Handler(void)
{ {
/* USER CODE BEGIN UsageFault_IRQn 0 */ /* USER CODE BEGIN UsageFault_IRQn 0 */
@ -167,8 +167,8 @@ void UsageFault_Handler(void)
} }
/** /**
* @brief This function handles Debug monitor. * @brief This function handles Debug monitor.
*/ */
void DebugMon_Handler(void) void DebugMon_Handler(void)
{ {
/* USER CODE BEGIN DebugMonitor_IRQn 0 */ /* USER CODE BEGIN DebugMonitor_IRQn 0 */
@ -187,8 +187,8 @@ void DebugMon_Handler(void)
/******************************************************************************/ /******************************************************************************/
/** /**
* @brief This function handles EXTI line1 interrupt. * @brief This function handles EXTI line1 interrupt.
*/ */
void EXTI1_IRQHandler(void) void EXTI1_IRQHandler(void)
{ {
/* USER CODE BEGIN EXTI1_IRQn 0 */ /* USER CODE BEGIN EXTI1_IRQn 0 */
@ -201,8 +201,8 @@ void EXTI1_IRQHandler(void)
} }
/** /**
* @brief This function handles EXTI line3 interrupt. * @brief This function handles EXTI line3 interrupt.
*/ */
void EXTI3_IRQHandler(void) void EXTI3_IRQHandler(void)
{ {
/* USER CODE BEGIN EXTI3_IRQn 0 */ /* USER CODE BEGIN EXTI3_IRQn 0 */
@ -215,8 +215,8 @@ void EXTI3_IRQHandler(void)
} }
/** /**
* @brief This function handles DMA1 stream0 global interrupt. * @brief This function handles DMA1 stream0 global interrupt.
*/ */
void DMA1_Stream0_IRQHandler(void) void DMA1_Stream0_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA1_Stream0_IRQn 0 */ /* USER CODE BEGIN DMA1_Stream0_IRQn 0 */
@ -229,8 +229,8 @@ void DMA1_Stream0_IRQHandler(void)
} }
/** /**
* @brief This function handles DMA1 stream1 global interrupt. * @brief This function handles DMA1 stream1 global interrupt.
*/ */
void DMA1_Stream1_IRQHandler(void) void DMA1_Stream1_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA1_Stream1_IRQn 0 */ /* USER CODE BEGIN DMA1_Stream1_IRQn 0 */
@ -243,8 +243,8 @@ void DMA1_Stream1_IRQHandler(void)
} }
/** /**
* @brief This function handles DMA1 stream2 global interrupt. * @brief This function handles DMA1 stream2 global interrupt.
*/ */
void DMA1_Stream2_IRQHandler(void) void DMA1_Stream2_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA1_Stream2_IRQn 0 */ /* USER CODE BEGIN DMA1_Stream2_IRQn 0 */
@ -257,8 +257,8 @@ void DMA1_Stream2_IRQHandler(void)
} }
/** /**
* @brief This function handles DMA1 stream3 global interrupt. * @brief This function handles DMA1 stream3 global interrupt.
*/ */
void DMA1_Stream3_IRQHandler(void) void DMA1_Stream3_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA1_Stream3_IRQn 0 */ /* USER CODE BEGIN DMA1_Stream3_IRQn 0 */
@ -271,8 +271,8 @@ void DMA1_Stream3_IRQHandler(void)
} }
/** /**
* @brief This function handles DMA1 stream4 global interrupt. * @brief This function handles DMA1 stream4 global interrupt.
*/ */
void DMA1_Stream4_IRQHandler(void) void DMA1_Stream4_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA1_Stream4_IRQn 0 */ /* USER CODE BEGIN DMA1_Stream4_IRQn 0 */
@ -285,8 +285,8 @@ void DMA1_Stream4_IRQHandler(void)
} }
/** /**
* @brief This function handles DMA1 stream5 global interrupt. * @brief This function handles DMA1 stream5 global interrupt.
*/ */
void DMA1_Stream5_IRQHandler(void) void DMA1_Stream5_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA1_Stream5_IRQn 0 */ /* USER CODE BEGIN DMA1_Stream5_IRQn 0 */
@ -299,8 +299,8 @@ void DMA1_Stream5_IRQHandler(void)
} }
/** /**
* @brief This function handles DMA1 stream6 global interrupt. * @brief This function handles DMA1 stream6 global interrupt.
*/ */
void DMA1_Stream6_IRQHandler(void) void DMA1_Stream6_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA1_Stream6_IRQn 0 */ /* USER CODE BEGIN DMA1_Stream6_IRQn 0 */
@ -313,8 +313,8 @@ void DMA1_Stream6_IRQHandler(void)
} }
/** /**
* @brief This function handles EXTI line[9:5] interrupts. * @brief This function handles EXTI line[9:5] interrupts.
*/ */
void EXTI9_5_IRQHandler(void) void EXTI9_5_IRQHandler(void)
{ {
/* USER CODE BEGIN EXTI9_5_IRQn 0 */ /* USER CODE BEGIN EXTI9_5_IRQn 0 */
@ -334,8 +334,8 @@ void EXTI9_5_IRQHandler(void)
} }
/** /**
* @brief This function handles TIM4 global interrupt. * @brief This function handles TIM4 global interrupt.
*/ */
void TIM4_IRQHandler(void) void TIM4_IRQHandler(void)
{ {
/* USER CODE BEGIN TIM4_IRQn 0 */ /* USER CODE BEGIN TIM4_IRQn 0 */
@ -348,8 +348,8 @@ void TIM4_IRQHandler(void)
} }
/** /**
* @brief This function handles USART1 global interrupt. * @brief This function handles USART1 global interrupt.
*/ */
void USART1_IRQHandler(void) void USART1_IRQHandler(void)
{ {
/* USER CODE BEGIN USART1_IRQn 0 */ /* USER CODE BEGIN USART1_IRQn 0 */
@ -362,8 +362,8 @@ void USART1_IRQHandler(void)
} }
/** /**
* @brief This function handles USART2 global interrupt. * @brief This function handles USART2 global interrupt.
*/ */
void USART2_IRQHandler(void) void USART2_IRQHandler(void)
{ {
/* USER CODE BEGIN USART2_IRQn 0 */ /* USER CODE BEGIN USART2_IRQn 0 */
@ -375,8 +375,8 @@ void USART2_IRQHandler(void)
} }
/** /**
* @brief This function handles USART3 global interrupt. * @brief This function handles USART3 global interrupt.
*/ */
void USART3_IRQHandler(void) void USART3_IRQHandler(void)
{ {
/* USER CODE BEGIN USART3_IRQn 0 */ /* USER CODE BEGIN USART3_IRQn 0 */
@ -389,8 +389,8 @@ void USART3_IRQHandler(void)
} }
/** /**
* @brief This function handles DMA1 stream7 global interrupt. * @brief This function handles DMA1 stream7 global interrupt.
*/ */
void DMA1_Stream7_IRQHandler(void) void DMA1_Stream7_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA1_Stream7_IRQn 0 */ /* USER CODE BEGIN DMA1_Stream7_IRQn 0 */
@ -403,8 +403,8 @@ void DMA1_Stream7_IRQHandler(void)
} }
/** /**
* @brief This function handles UART4 global interrupt. * @brief This function handles UART4 global interrupt.
*/ */
void UART4_IRQHandler(void) void UART4_IRQHandler(void)
{ {
/* USER CODE BEGIN UART4_IRQn 0 */ /* USER CODE BEGIN UART4_IRQn 0 */
@ -416,8 +416,8 @@ void UART4_IRQHandler(void)
} }
/** /**
* @brief This function handles UART5 global interrupt. * @brief This function handles UART5 global interrupt.
*/ */
void UART5_IRQHandler(void) void UART5_IRQHandler(void)
{ {
/* USER CODE BEGIN UART5_IRQn 0 */ /* USER CODE BEGIN UART5_IRQn 0 */
@ -428,8 +428,8 @@ void UART5_IRQHandler(void)
} }
/** /**
* @brief This function handles DMA2 stream1 global interrupt. * @brief This function handles DMA2 stream1 global interrupt.
*/ */
void DMA2_Stream1_IRQHandler(void) void DMA2_Stream1_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA2_Stream1_IRQn 0 */ /* USER CODE BEGIN DMA2_Stream1_IRQn 0 */
@ -442,8 +442,8 @@ void DMA2_Stream1_IRQHandler(void)
} }
/** /**
* @brief This function handles DMA2 stream2 global interrupt. * @brief This function handles DMA2 stream2 global interrupt.
*/ */
void DMA2_Stream2_IRQHandler(void) void DMA2_Stream2_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA2_Stream2_IRQn 0 */ /* USER CODE BEGIN DMA2_Stream2_IRQn 0 */
@ -456,8 +456,8 @@ void DMA2_Stream2_IRQHandler(void)
} }
/** /**
* @brief This function handles Ethernet global interrupt. * @brief This function handles Ethernet global interrupt.
*/ */
void ETH_IRQHandler(void) void ETH_IRQHandler(void)
{ {
/* USER CODE BEGIN ETH_IRQn 0 */ /* USER CODE BEGIN ETH_IRQn 0 */
@ -470,8 +470,8 @@ void ETH_IRQHandler(void)
} }
/** /**
* @brief This function handles DMA2 stream6 global interrupt. * @brief This function handles DMA2 stream6 global interrupt.
*/ */
void DMA2_Stream6_IRQHandler(void) void DMA2_Stream6_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA2_Stream6_IRQn 0 */ /* USER CODE BEGIN DMA2_Stream6_IRQn 0 */
@ -484,8 +484,8 @@ void DMA2_Stream6_IRQHandler(void)
} }
/** /**
* @brief This function handles DMA2 stream7 global interrupt. * @brief This function handles DMA2 stream7 global interrupt.
*/ */
void DMA2_Stream7_IRQHandler(void) void DMA2_Stream7_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA2_Stream7_IRQn 0 */ /* USER CODE BEGIN DMA2_Stream7_IRQn 0 */
@ -498,8 +498,8 @@ void DMA2_Stream7_IRQHandler(void)
} }
/** /**
* @brief This function handles USART6 global interrupt. * @brief This function handles USART6 global interrupt.
*/ */
void USART6_IRQHandler(void) void USART6_IRQHandler(void)
{ {
/* USER CODE BEGIN USART6_IRQn 0 */ /* USER CODE BEGIN USART6_IRQn 0 */

View File

@ -66,9 +66,8 @@ void MX_UART4_Init(void)
Error_Handler(); Error_Handler();
} }
/* USER CODE BEGIN UART4_Init 2 */ /* USER CODE BEGIN UART4_Init 2 */
//__HAL_UART_ENABLE_IT(&huart4, UART_IT_IDLE); // 使能IDLEä¸­æ­ //__HAL_UART_ENABLE_IT(&huart4, UART_IT_IDLE); // 使能IDLE中断
/* USER CODE END UART4_Init 2 */ /* USER CODE END UART4_Init 2 */
} }
/* UART5 init function */ /* UART5 init function */
void MX_UART5_Init(void) void MX_UART5_Init(void)
@ -94,10 +93,9 @@ void MX_UART5_Init(void)
Error_Handler(); Error_Handler();
} }
/* USER CODE BEGIN UART5_Init 2 */ /* USER CODE BEGIN UART5_Init 2 */
// __HAL_UART_ENABLE_IT(&huart5, UART_IT_RXNE); // 接收中断 // __HAL_UART_ENABLE_IT(&huart5, UART_IT_RXNE); // 接收中断
// __HAL_UART_ENABLE_IT(&huart5, UART_IT_IDLE); // 空闲中断 // __HAL_UART_ENABLE_IT(&huart5, UART_IT_IDLE); // 空闲中断
/* USER CODE END UART5_Init 2 */ /* USER CODE END UART5_Init 2 */
} }
/* USART1 init function */ /* USART1 init function */
@ -126,7 +124,6 @@ void MX_USART1_UART_Init(void)
/* USER CODE BEGIN USART1_Init 2 */ /* USER CODE BEGIN USART1_Init 2 */
/* USER CODE END USART1_Init 2 */ /* USER CODE END USART1_Init 2 */
} }
/* USART2 init function */ /* USART2 init function */
@ -153,10 +150,9 @@ void MX_USART2_UART_Init(void)
Error_Handler(); Error_Handler();
} }
/* USER CODE BEGIN USART2_Init 2 */ /* USER CODE BEGIN USART2_Init 2 */
// __HAL_UART_ENABLE_IT(&huart2, UART_IT_RXNE); // 接收中断 // __HAL_UART_ENABLE_IT(&huart2, UART_IT_RXNE); // 接收中断
// __HAL_UART_ENABLE_IT(&huart2, UART_IT_IDLE); // 使能IDLEä¸­æ­ // __HAL_UART_ENABLE_IT(&huart2, UART_IT_IDLE); // 使能IDLE中断
/* USER CODE END USART2_Init 2 */ /* USER CODE END USART2_Init 2 */
} }
/* USART3 init function */ /* USART3 init function */
@ -185,7 +181,6 @@ void MX_USART3_UART_Init(void)
/* USER CODE BEGIN USART3_Init 2 */ /* USER CODE BEGIN USART3_Init 2 */
/* USER CODE END USART3_Init 2 */ /* USER CODE END USART3_Init 2 */
} }
/* USART6 init function */ /* USART6 init function */
@ -214,18 +209,17 @@ void MX_USART6_UART_Init(void)
/* USER CODE BEGIN USART6_Init 2 */ /* USER CODE BEGIN USART6_Init 2 */
/* USER CODE END USART6_Init 2 */ /* USER CODE END USART6_Init 2 */
} }
void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle) void HAL_UART_MspInit(UART_HandleTypeDef *uartHandle)
{ {
GPIO_InitTypeDef GPIO_InitStruct = {0}; GPIO_InitTypeDef GPIO_InitStruct = {0};
if(uartHandle->Instance==UART4) if (uartHandle->Instance == UART4)
{ {
/* USER CODE BEGIN UART4_MspInit 0 */ /* USER CODE BEGIN UART4_MspInit 0 */
/* USER CODE END UART4_MspInit 0 */ /* USER CODE END UART4_MspInit 0 */
/* UART4 clock enable */ /* UART4 clock enable */
__HAL_RCC_UART4_CLK_ENABLE(); __HAL_RCC_UART4_CLK_ENABLE();
@ -234,7 +228,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
PC10 ------> UART4_TX PC10 ------> UART4_TX
PC11 ------> UART4_RX PC11 ------> UART4_RX
*/ */
GPIO_InitStruct.Pin = LCD_TX_Pin|LCD_RX_Pin; GPIO_InitStruct.Pin = LCD_TX_Pin | LCD_RX_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
@ -258,7 +252,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
Error_Handler(); Error_Handler();
} }
__HAL_LINKDMA(uartHandle,hdmarx,hdma_uart4_rx); __HAL_LINKDMA(uartHandle, hdmarx, hdma_uart4_rx);
/* UART4_TX Init */ /* UART4_TX Init */
hdma_uart4_tx.Instance = DMA1_Stream4; hdma_uart4_tx.Instance = DMA1_Stream4;
@ -276,20 +270,20 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
Error_Handler(); Error_Handler();
} }
__HAL_LINKDMA(uartHandle,hdmatx,hdma_uart4_tx); __HAL_LINKDMA(uartHandle, hdmatx, hdma_uart4_tx);
/* UART4 interrupt Init */ /* UART4 interrupt Init */
HAL_NVIC_SetPriority(UART4_IRQn, 5, 0); HAL_NVIC_SetPriority(UART4_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(UART4_IRQn); HAL_NVIC_EnableIRQ(UART4_IRQn);
/* USER CODE BEGIN UART4_MspInit 1 */ /* USER CODE BEGIN UART4_MspInit 1 */
/* USER CODE END UART4_MspInit 1 */ /* USER CODE END UART4_MspInit 1 */
} }
else if(uartHandle->Instance==UART5) else if (uartHandle->Instance == UART5)
{ {
/* USER CODE BEGIN UART5_MspInit 0 */ /* USER CODE BEGIN UART5_MspInit 0 */
/* USER CODE END UART5_MspInit 0 */ /* USER CODE END UART5_MspInit 0 */
/* UART5 clock enable */ /* UART5 clock enable */
__HAL_RCC_UART5_CLK_ENABLE(); __HAL_RCC_UART5_CLK_ENABLE();
@ -330,7 +324,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
Error_Handler(); Error_Handler();
} }
__HAL_LINKDMA(uartHandle,hdmatx,hdma_uart5_tx); __HAL_LINKDMA(uartHandle, hdmatx, hdma_uart5_tx);
/* UART5_RX Init */ /* UART5_RX Init */
hdma_uart5_rx.Instance = DMA1_Stream0; hdma_uart5_rx.Instance = DMA1_Stream0;
@ -348,20 +342,20 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
Error_Handler(); Error_Handler();
} }
__HAL_LINKDMA(uartHandle,hdmarx,hdma_uart5_rx); __HAL_LINKDMA(uartHandle, hdmarx, hdma_uart5_rx);
/* UART5 interrupt Init */ /* UART5 interrupt Init */
HAL_NVIC_SetPriority(UART5_IRQn, 5, 0); HAL_NVIC_SetPriority(UART5_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(UART5_IRQn); HAL_NVIC_EnableIRQ(UART5_IRQn);
/* USER CODE BEGIN UART5_MspInit 1 */ /* USER CODE BEGIN UART5_MspInit 1 */
/* USER CODE END UART5_MspInit 1 */ /* USER CODE END UART5_MspInit 1 */
} }
else if(uartHandle->Instance==USART1) else if (uartHandle->Instance == USART1)
{ {
/* USER CODE BEGIN USART1_MspInit 0 */ /* USER CODE BEGIN USART1_MspInit 0 */
/* USER CODE END USART1_MspInit 0 */ /* USER CODE END USART1_MspInit 0 */
/* USART1 clock enable */ /* USART1 clock enable */
__HAL_RCC_USART1_CLK_ENABLE(); __HAL_RCC_USART1_CLK_ENABLE();
@ -370,7 +364,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
PA9 ------> USART1_TX PA9 ------> USART1_TX
PA10 ------> USART1_RX PA10 ------> USART1_RX
*/ */
GPIO_InitStruct.Pin = USB_TX_Pin|USB_RX_Pin; GPIO_InitStruct.Pin = USB_TX_Pin | USB_RX_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
@ -394,7 +388,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
Error_Handler(); Error_Handler();
} }
__HAL_LINKDMA(uartHandle,hdmarx,hdma_usart1_rx); __HAL_LINKDMA(uartHandle, hdmarx, hdma_usart1_rx);
/* USART1_TX Init */ /* USART1_TX Init */
hdma_usart1_tx.Instance = DMA2_Stream7; hdma_usart1_tx.Instance = DMA2_Stream7;
@ -412,20 +406,20 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
Error_Handler(); Error_Handler();
} }
__HAL_LINKDMA(uartHandle,hdmatx,hdma_usart1_tx); __HAL_LINKDMA(uartHandle, hdmatx, hdma_usart1_tx);
/* USART1 interrupt Init */ /* USART1 interrupt Init */
HAL_NVIC_SetPriority(USART1_IRQn, 5, 0); HAL_NVIC_SetPriority(USART1_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(USART1_IRQn); HAL_NVIC_EnableIRQ(USART1_IRQn);
/* USER CODE BEGIN USART1_MspInit 1 */ /* USER CODE BEGIN USART1_MspInit 1 */
/* USER CODE END USART1_MspInit 1 */ /* USER CODE END USART1_MspInit 1 */
} }
else if(uartHandle->Instance==USART2) else if (uartHandle->Instance == USART2)
{ {
/* USER CODE BEGIN USART2_MspInit 0 */ /* USER CODE BEGIN USART2_MspInit 0 */
/* USER CODE END USART2_MspInit 0 */ /* USER CODE END USART2_MspInit 0 */
/* USART2 clock enable */ /* USART2 clock enable */
__HAL_RCC_USART2_CLK_ENABLE(); __HAL_RCC_USART2_CLK_ENABLE();
@ -434,7 +428,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
PD5 ------> USART2_TX PD5 ------> USART2_TX
PD6 ------> USART2_RX PD6 ------> USART2_RX
*/ */
GPIO_InitStruct.Pin = HART2_TX_Pin|HART2_RX_Pin; GPIO_InitStruct.Pin = HART2_TX_Pin | HART2_RX_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
@ -458,7 +452,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
Error_Handler(); Error_Handler();
} }
__HAL_LINKDMA(uartHandle,hdmarx,hdma_usart2_rx); __HAL_LINKDMA(uartHandle, hdmarx, hdma_usart2_rx);
/* USART2_TX Init */ /* USART2_TX Init */
hdma_usart2_tx.Instance = DMA1_Stream6; hdma_usart2_tx.Instance = DMA1_Stream6;
@ -476,20 +470,20 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
Error_Handler(); Error_Handler();
} }
__HAL_LINKDMA(uartHandle,hdmatx,hdma_usart2_tx); __HAL_LINKDMA(uartHandle, hdmatx, hdma_usart2_tx);
/* USART2 interrupt Init */ /* USART2 interrupt Init */
HAL_NVIC_SetPriority(USART2_IRQn, 5, 0); HAL_NVIC_SetPriority(USART2_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(USART2_IRQn); HAL_NVIC_EnableIRQ(USART2_IRQn);
/* USER CODE BEGIN USART2_MspInit 1 */ /* USER CODE BEGIN USART2_MspInit 1 */
/* USER CODE END USART2_MspInit 1 */ /* USER CODE END USART2_MspInit 1 */
} }
else if(uartHandle->Instance==USART3) else if (uartHandle->Instance == USART3)
{ {
/* USER CODE BEGIN USART3_MspInit 0 */ /* USER CODE BEGIN USART3_MspInit 0 */
/* USER CODE END USART3_MspInit 0 */ /* USER CODE END USART3_MspInit 0 */
/* USART3 clock enable */ /* USART3 clock enable */
__HAL_RCC_USART3_CLK_ENABLE(); __HAL_RCC_USART3_CLK_ENABLE();
@ -498,7 +492,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
PD8 ------> USART3_TX PD8 ------> USART3_TX
PD9 ------> USART3_RX PD9 ------> USART3_RX
*/ */
GPIO_InitStruct.Pin = BLE2_TX_Pin|BLE2_RX_Pin; GPIO_InitStruct.Pin = BLE2_TX_Pin | BLE2_RX_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
@ -522,7 +516,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
Error_Handler(); Error_Handler();
} }
__HAL_LINKDMA(uartHandle,hdmarx,hdma_usart3_rx); __HAL_LINKDMA(uartHandle, hdmarx, hdma_usart3_rx);
/* USART3_TX Init */ /* USART3_TX Init */
hdma_usart3_tx.Instance = DMA1_Stream3; hdma_usart3_tx.Instance = DMA1_Stream3;
@ -540,20 +534,20 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
Error_Handler(); Error_Handler();
} }
__HAL_LINKDMA(uartHandle,hdmatx,hdma_usart3_tx); __HAL_LINKDMA(uartHandle, hdmatx, hdma_usart3_tx);
/* USART3 interrupt Init */ /* USART3 interrupt Init */
HAL_NVIC_SetPriority(USART3_IRQn, 5, 0); HAL_NVIC_SetPriority(USART3_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(USART3_IRQn); HAL_NVIC_EnableIRQ(USART3_IRQn);
/* USER CODE BEGIN USART3_MspInit 1 */ /* USER CODE BEGIN USART3_MspInit 1 */
/* USER CODE END USART3_MspInit 1 */ /* USER CODE END USART3_MspInit 1 */
} }
else if(uartHandle->Instance==USART6) else if (uartHandle->Instance == USART6)
{ {
/* USER CODE BEGIN USART6_MspInit 0 */ /* USER CODE BEGIN USART6_MspInit 0 */
/* USER CODE END USART6_MspInit 0 */ /* USER CODE END USART6_MspInit 0 */
/* USART6 clock enable */ /* USART6 clock enable */
__HAL_RCC_USART6_CLK_ENABLE(); __HAL_RCC_USART6_CLK_ENABLE();
@ -562,7 +556,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
PC6 ------> USART6_TX PC6 ------> USART6_TX
PC7 ------> USART6_RX PC7 ------> USART6_RX
*/ */
GPIO_InitStruct.Pin = BLE1_TX_Pin|BLE1_RX_Pin; GPIO_InitStruct.Pin = BLE1_TX_Pin | BLE1_RX_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
@ -586,7 +580,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
Error_Handler(); Error_Handler();
} }
__HAL_LINKDMA(uartHandle,hdmarx,hdma_usart6_rx); __HAL_LINKDMA(uartHandle, hdmarx, hdma_usart6_rx);
/* USART6_TX Init */ /* USART6_TX Init */
hdma_usart6_tx.Instance = DMA2_Stream6; hdma_usart6_tx.Instance = DMA2_Stream6;
@ -604,25 +598,25 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
Error_Handler(); Error_Handler();
} }
__HAL_LINKDMA(uartHandle,hdmatx,hdma_usart6_tx); __HAL_LINKDMA(uartHandle, hdmatx, hdma_usart6_tx);
/* USART6 interrupt Init */ /* USART6 interrupt Init */
HAL_NVIC_SetPriority(USART6_IRQn, 5, 0); HAL_NVIC_SetPriority(USART6_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(USART6_IRQn); HAL_NVIC_EnableIRQ(USART6_IRQn);
/* USER CODE BEGIN USART6_MspInit 1 */ /* USER CODE BEGIN USART6_MspInit 1 */
/* USER CODE END USART6_MspInit 1 */ /* USER CODE END USART6_MspInit 1 */
} }
} }
void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle) void HAL_UART_MspDeInit(UART_HandleTypeDef *uartHandle)
{ {
if(uartHandle->Instance==UART4) if (uartHandle->Instance == UART4)
{ {
/* USER CODE BEGIN UART4_MspDeInit 0 */ /* USER CODE BEGIN UART4_MspDeInit 0 */
/* USER CODE END UART4_MspDeInit 0 */ /* USER CODE END UART4_MspDeInit 0 */
/* Peripheral clock disable */ /* Peripheral clock disable */
__HAL_RCC_UART4_CLK_DISABLE(); __HAL_RCC_UART4_CLK_DISABLE();
@ -630,7 +624,7 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
PC10 ------> UART4_TX PC10 ------> UART4_TX
PC11 ------> UART4_RX PC11 ------> UART4_RX
*/ */
HAL_GPIO_DeInit(GPIOC, LCD_TX_Pin|LCD_RX_Pin); HAL_GPIO_DeInit(GPIOC, LCD_TX_Pin | LCD_RX_Pin);
/* UART4 DMA DeInit */ /* UART4 DMA DeInit */
HAL_DMA_DeInit(uartHandle->hdmarx); HAL_DMA_DeInit(uartHandle->hdmarx);
@ -638,15 +632,15 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
/* UART4 interrupt Deinit */ /* UART4 interrupt Deinit */
HAL_NVIC_DisableIRQ(UART4_IRQn); HAL_NVIC_DisableIRQ(UART4_IRQn);
/* USER CODE BEGIN UART4_MspDeInit 1 */ /* USER CODE BEGIN UART4_MspDeInit 1 */
/* USER CODE END UART4_MspDeInit 1 */ /* USER CODE END UART4_MspDeInit 1 */
} }
else if(uartHandle->Instance==UART5) else if (uartHandle->Instance == UART5)
{ {
/* USER CODE BEGIN UART5_MspDeInit 0 */ /* USER CODE BEGIN UART5_MspDeInit 0 */
/* USER CODE END UART5_MspDeInit 0 */ /* USER CODE END UART5_MspDeInit 0 */
/* Peripheral clock disable */ /* Peripheral clock disable */
__HAL_RCC_UART5_CLK_DISABLE(); __HAL_RCC_UART5_CLK_DISABLE();
@ -664,15 +658,15 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
/* UART5 interrupt Deinit */ /* UART5 interrupt Deinit */
HAL_NVIC_DisableIRQ(UART5_IRQn); HAL_NVIC_DisableIRQ(UART5_IRQn);
/* USER CODE BEGIN UART5_MspDeInit 1 */ /* USER CODE BEGIN UART5_MspDeInit 1 */
/* USER CODE END UART5_MspDeInit 1 */ /* USER CODE END UART5_MspDeInit 1 */
} }
else if(uartHandle->Instance==USART1) else if (uartHandle->Instance == USART1)
{ {
/* USER CODE BEGIN USART1_MspDeInit 0 */ /* USER CODE BEGIN USART1_MspDeInit 0 */
/* USER CODE END USART1_MspDeInit 0 */ /* USER CODE END USART1_MspDeInit 0 */
/* Peripheral clock disable */ /* Peripheral clock disable */
__HAL_RCC_USART1_CLK_DISABLE(); __HAL_RCC_USART1_CLK_DISABLE();
@ -680,7 +674,7 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
PA9 ------> USART1_TX PA9 ------> USART1_TX
PA10 ------> USART1_RX PA10 ------> USART1_RX
*/ */
HAL_GPIO_DeInit(GPIOA, USB_TX_Pin|USB_RX_Pin); HAL_GPIO_DeInit(GPIOA, USB_TX_Pin | USB_RX_Pin);
/* USART1 DMA DeInit */ /* USART1 DMA DeInit */
HAL_DMA_DeInit(uartHandle->hdmarx); HAL_DMA_DeInit(uartHandle->hdmarx);
@ -688,15 +682,15 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
/* USART1 interrupt Deinit */ /* USART1 interrupt Deinit */
HAL_NVIC_DisableIRQ(USART1_IRQn); HAL_NVIC_DisableIRQ(USART1_IRQn);
/* USER CODE BEGIN USART1_MspDeInit 1 */ /* USER CODE BEGIN USART1_MspDeInit 1 */
/* USER CODE END USART1_MspDeInit 1 */ /* USER CODE END USART1_MspDeInit 1 */
} }
else if(uartHandle->Instance==USART2) else if (uartHandle->Instance == USART2)
{ {
/* USER CODE BEGIN USART2_MspDeInit 0 */ /* USER CODE BEGIN USART2_MspDeInit 0 */
/* USER CODE END USART2_MspDeInit 0 */ /* USER CODE END USART2_MspDeInit 0 */
/* Peripheral clock disable */ /* Peripheral clock disable */
__HAL_RCC_USART2_CLK_DISABLE(); __HAL_RCC_USART2_CLK_DISABLE();
@ -704,7 +698,7 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
PD5 ------> USART2_TX PD5 ------> USART2_TX
PD6 ------> USART2_RX PD6 ------> USART2_RX
*/ */
HAL_GPIO_DeInit(GPIOD, HART2_TX_Pin|HART2_RX_Pin); HAL_GPIO_DeInit(GPIOD, HART2_TX_Pin | HART2_RX_Pin);
/* USART2 DMA DeInit */ /* USART2 DMA DeInit */
HAL_DMA_DeInit(uartHandle->hdmarx); HAL_DMA_DeInit(uartHandle->hdmarx);
@ -712,15 +706,15 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
/* USART2 interrupt Deinit */ /* USART2 interrupt Deinit */
HAL_NVIC_DisableIRQ(USART2_IRQn); HAL_NVIC_DisableIRQ(USART2_IRQn);
/* USER CODE BEGIN USART2_MspDeInit 1 */ /* USER CODE BEGIN USART2_MspDeInit 1 */
/* USER CODE END USART2_MspDeInit 1 */ /* USER CODE END USART2_MspDeInit 1 */
} }
else if(uartHandle->Instance==USART3) else if (uartHandle->Instance == USART3)
{ {
/* USER CODE BEGIN USART3_MspDeInit 0 */ /* USER CODE BEGIN USART3_MspDeInit 0 */
/* USER CODE END USART3_MspDeInit 0 */ /* USER CODE END USART3_MspDeInit 0 */
/* Peripheral clock disable */ /* Peripheral clock disable */
__HAL_RCC_USART3_CLK_DISABLE(); __HAL_RCC_USART3_CLK_DISABLE();
@ -728,7 +722,7 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
PD8 ------> USART3_TX PD8 ------> USART3_TX
PD9 ------> USART3_RX PD9 ------> USART3_RX
*/ */
HAL_GPIO_DeInit(GPIOD, BLE2_TX_Pin|BLE2_RX_Pin); HAL_GPIO_DeInit(GPIOD, BLE2_TX_Pin | BLE2_RX_Pin);
/* USART3 DMA DeInit */ /* USART3 DMA DeInit */
HAL_DMA_DeInit(uartHandle->hdmarx); HAL_DMA_DeInit(uartHandle->hdmarx);
@ -736,15 +730,15 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
/* USART3 interrupt Deinit */ /* USART3 interrupt Deinit */
HAL_NVIC_DisableIRQ(USART3_IRQn); HAL_NVIC_DisableIRQ(USART3_IRQn);
/* USER CODE BEGIN USART3_MspDeInit 1 */ /* USER CODE BEGIN USART3_MspDeInit 1 */
/* USER CODE END USART3_MspDeInit 1 */ /* USER CODE END USART3_MspDeInit 1 */
} }
else if(uartHandle->Instance==USART6) else if (uartHandle->Instance == USART6)
{ {
/* USER CODE BEGIN USART6_MspDeInit 0 */ /* USER CODE BEGIN USART6_MspDeInit 0 */
/* USER CODE END USART6_MspDeInit 0 */ /* USER CODE END USART6_MspDeInit 0 */
/* Peripheral clock disable */ /* Peripheral clock disable */
__HAL_RCC_USART6_CLK_DISABLE(); __HAL_RCC_USART6_CLK_DISABLE();
@ -752,7 +746,7 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
PC6 ------> USART6_TX PC6 ------> USART6_TX
PC7 ------> USART6_RX PC7 ------> USART6_RX
*/ */
HAL_GPIO_DeInit(GPIOC, BLE1_TX_Pin|BLE1_RX_Pin); HAL_GPIO_DeInit(GPIOC, BLE1_TX_Pin | BLE1_RX_Pin);
/* USART6 DMA DeInit */ /* USART6 DMA DeInit */
HAL_DMA_DeInit(uartHandle->hdmarx); HAL_DMA_DeInit(uartHandle->hdmarx);
@ -760,30 +754,26 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
/* USART6 interrupt Deinit */ /* USART6 interrupt Deinit */
HAL_NVIC_DisableIRQ(USART6_IRQn); HAL_NVIC_DisableIRQ(USART6_IRQn);
/* USER CODE BEGIN USART6_MspDeInit 1 */ /* USER CODE BEGIN USART6_MspDeInit 1 */
/* USER CODE END USART6_MspDeInit 1 */ /* USER CODE END USART6_MspDeInit 1 */
} }
} }
/* USER CODE BEGIN 1 */ /* USER CODE BEGIN 1 */
/** /**
* @brief 使ç¨DMAæ¹å¼<EFBFBD>éšè¿ä¸²å<EFBFBD>£å<EFBFBD>é?<EFBFBD>æ°æ<EFBFBD>? * @brief 使DMA方式通过UART发送数据
* *
* è¯¥å½æ°ä½¿ç¨DMAæ¹å¼<EFBFBD>éšè¿æŒå®šçšä¸²å<EFBFBD>£å<EFBFBD>é<EFBFBD>æŒå®šé¿åº¦çšæ°æ<EFBFBD>®ã? * UART句柄使DMA方式发送数据
* *
* @param huart UART_HandleTypeDefç»æžä½æŒéˆï¼ŒæŒå<EFBFBD>éœ?è¦<EFBFBD>使ç¨çšä¸²å<EFBFBD>£å<EFBFBD>¥æŸ * @param huart UART句柄
* @param buf æŒå<EFBFBD>éœ?è¦<EFBFBD>å<EFBFBD>é<EFBFBD>çšæ°æ<EFBFBD>®ç¼å²åŒºçšæŒéˆ * @param buf
* @param len éœ?è¦<EFBFBD>å<EFBFBD>é<EFBFBD>çšæ°æ<EFBFBD>®é¿åº¦ * @param len
*
* @return æ è¿åžå??
*
* @note 妿žœå<EFBFBD>é?<EFBFBD>è¿ç¨ä¸­åºçްé误,会调ç¨Error_Handler彿°å¤ç<EFBFBD>é误
*/ */
void dma_usart_send(UART_HandleTypeDef *huart, uint8_t *buf, uint8_t len) void dma_usart_send(UART_HandleTypeDef *huart, uint8_t *buf, uint8_t len)
{ {
if (HAL_UART_Transmit_DMA(huart, buf, len) != HAL_OK) // åˆ¤æ­æ˜¯å<C2AF>¦å<C2A6>é?<3F>æ­£å¸¸ï¼Œå¦æžœå‡ºçްå¼å¸¸åˆ™è¿å…¥å¼å¸¸ä¸­æ­å‡½æ•?
if (HAL_UART_Transmit_DMA(huart, buf, len) != HAL_OK) // 判断是否发é?ć­Łĺ¸¸ďźŒĺŚ‚ćžœĺ‡şçŽ°ĺź‚ĺ¸¸ĺˆ™čż›ĺ…Ľĺź‚ĺ¸¸ä¸­ć–­ĺ‡˝ć•?
{ {
Error_Handler(); Error_Handler();
} }

View File

@ -1,48 +0,0 @@
// File: STM32F405_415_407_417_427_437_429_439.dbgconf
// Version: 1.0.0
// Note: refer to STM32F405/415 STM32F407/417 STM32F427/437 STM32F429/439 reference manual (RM0090)
// refer to STM32F40x STM32F41x datasheets
// refer to STM32F42x STM32F43x datasheets
// <<< Use Configuration Wizard in Context Menu >>>
// <h> Debug MCU configuration register (DBGMCU_CR)
// <o.2> DBG_STANDBY <i> Debug Standby Mode
// <o.1> DBG_STOP <i> Debug Stop Mode
// <o.0> DBG_SLEEP <i> Debug Sleep Mode
// </h>
DbgMCU_CR = 0x00000007;
// <h> Debug MCU APB1 freeze register (DBGMCU_APB1_FZ)
// <i> Reserved bits must be kept at reset value
// <o.26> DBG_CAN2_STOP <i> CAN2 stopped when core is halted
// <o.25> DBG_CAN1_STOP <i> CAN2 stopped when core is halted
// <o.23> DBG_I2C3_SMBUS_TIMEOUT <i> I2C3 SMBUS timeout mode stopped when core is halted
// <o.22> DBG_I2C2_SMBUS_TIMEOUT <i> I2C2 SMBUS timeout mode stopped when core is halted
// <o.21> DBG_I2C1_SMBUS_TIMEOUT <i> I2C1 SMBUS timeout mode stopped when core is halted
// <o.12> DBG_IWDG_STOP <i> Independent watchdog stopped when core is halted
// <o.11> DBG_WWDG_STOP <i> Window watchdog stopped when core is halted
// <o.10> DBG_RTC_STOP <i> RTC stopped when core is halted
// <o.8> DBG_TIM14_STOP <i> TIM14 counter stopped when core is halted
// <o.7> DBG_TIM13_STOP <i> TIM13 counter stopped when core is halted
// <o.6> DBG_TIM12_STOP <i> TIM12 counter stopped when core is halted
// <o.5> DBG_TIM7_STOP <i> TIM7 counter stopped when core is halted
// <o.4> DBG_TIM6_STOP <i> TIM6 counter stopped when core is halted
// <o.3> DBG_TIM5_STOP <i> TIM5 counter stopped when core is halted
// <o.2> DBG_TIM4_STOP <i> TIM4 counter stopped when core is halted
// <o.1> DBG_TIM3_STOP <i> TIM3 counter stopped when core is halted
// <o.0> DBG_TIM2_STOP <i> TIM2 counter stopped when core is halted
// </h>
DbgMCU_APB1_Fz = 0x00000000;
// <h> Debug MCU APB2 freeze register (DBGMCU_APB2_FZ)
// <i> Reserved bits must be kept at reset value
// <o.18> DBG_TIM11_STOP <i> TIM11 counter stopped when core is halted
// <o.17> DBG_TIM10_STOP <i> TIM10 counter stopped when core is halted
// <o.16> DBG_TIM9_STOP <i> TIM9 counter stopped when core is halted
// <o.1> DBG_TIM8_STOP <i> TIM8 counter stopped when core is halted
// <o.0> DBG_TIM1_STOP <i> TIM1 counter stopped when core is halted
// </h>
DbgMCU_APB2_Fz = 0x00000000;
// <<< end of configuration section >>>

File diff suppressed because one or more lines are too long

View File

@ -148,13 +148,61 @@
<Name>-U090F00028316303030303032 -O2254 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(2BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8000 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32F4xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F407VGTx$CMSIS\Flash\STM32F4xx_1024.FLM)</Name> <Name>-U090F00028316303030303032 -O2254 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(2BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8000 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32F4xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F407VGTx$CMSIS\Flash\STM32F4xx_1024.FLM)</Name>
</SetRegEntry> </SetRegEntry>
</TargetDriverDllRegistry> </TargetDriverDllRegistry>
<Breakpoint/> <Breakpoint>
<Bp>
<Number>0</Number>
<Type>0</Type>
<LineNumber>1404</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134235956</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\signal_generator\../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c\1404</Expression>
</Bp>
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>1447</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134236092</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\signal_generator\../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c\1447</Expression>
</Bp>
</Breakpoint>
<WatchWindow1> <WatchWindow1>
<Ww> <Ww>
<count>0</count> <count>0</count>
<WinNumber>1</WinNumber> <WinNumber>1</WinNumber>
<ItemText>ec11_data,0x0A</ItemText> <ItemText>ec11_data,0x0A</ItemText>
</Ww> </Ww>
<Ww>
<count>1</count>
<WinNumber>1</WinNumber>
<ItemText>uart_lcd_state</ItemText>
</Ww>
<Ww>
<count>2</count>
<WinNumber>1</WinNumber>
<ItemText>lcd_channel</ItemText>
</Ww>
<Ww>
<count>3</count>
<WinNumber>1</WinNumber>
<ItemText>current_buff</ItemText>
</Ww>
</WatchWindow1> </WatchWindow1>
<Tracepoint> <Tracepoint>
<THDelay>0</THDelay> <THDelay>0</THDelay>
@ -418,7 +466,7 @@
<Group> <Group>
<GroupName>Drivers/STM32F4xx_HAL_Driver</GroupName> <GroupName>Drivers/STM32F4xx_HAL_Driver</GroupName>
<tvExp>0</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
@ -1846,7 +1894,7 @@
<Group> <Group>
<GroupName>User/driver</GroupName> <GroupName>User/driver</GroupName>
<tvExp>0</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>

View File

@ -339,7 +339,7 @@
<MiscControls></MiscControls> <MiscControls></MiscControls>
<Define>USE_HAL_DRIVER,STM32F407xx</Define> <Define>USE_HAL_DRIVER,STM32F407xx</Define>
<Undefine></Undefine> <Undefine></Undefine>
<IncludePath>../Core/Inc;../LWIP/App;../LWIP/Target;../Middlewares/Third_Party/LwIP/src/include;../Middlewares/Third_Party/LwIP/system;../Drivers/STM32F4xx_HAL_Driver/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy;../Middlewares/Third_Party/FreeRTOS/Source/include;../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS;../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM4F;../Drivers/BSP/Components/lan8742;../Middlewares/Third_Party/LwIP/src/include/netif/ppp;../Drivers/CMSIS/Device/ST/STM32F4xx/Include;../Middlewares/Third_Party/LwIP/src/include/lwip;../Middlewares/Third_Party/LwIP/src/include/lwip/apps;../Middlewares/Third_Party/LwIP/src/include/lwip/priv;../Middlewares/Third_Party/LwIP/src/include/lwip/prot;../Middlewares/Third_Party/LwIP/src/include/netif;../Middlewares/Third_Party/LwIP/src/include/compat/posix;../Middlewares/Third_Party/LwIP/src/include/compat/posix/arpa;../Middlewares/Third_Party/LwIP/src/include/compat/posix/net;../Middlewares/Third_Party/LwIP/src/include/compat/posix/sys;../Middlewares/Third_Party/LwIP/src/include/compat/stdc;../Middlewares/Third_Party/LwIP/system/arch;../Drivers/CMSIS/Include;..\User\application\inc;..\User\board\inc;..\User\driver;..\User\system</IncludePath> <IncludePath>../Core/Inc;../LWIP/App;../LWIP/Target;../Middlewares/Third_Party/LwIP/src/include;../Middlewares/Third_Party/LwIP/system;../Drivers/STM32F4xx_HAL_Driver/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy;../Middlewares/Third_Party/FreeRTOS/Source/include;../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS;../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM4F;../Drivers/BSP/Components/lan8742;../Middlewares/Third_Party/LwIP/src/include/netif/ppp;../Drivers/CMSIS/Device/ST/STM32F4xx/Include;../Middlewares/Third_Party/LwIP/src/include/lwip;../Middlewares/Third_Party/LwIP/src/include/lwip/apps;../Middlewares/Third_Party/LwIP/src/include/lwip/priv;../Middlewares/Third_Party/LwIP/src/include/lwip/prot;../Middlewares/Third_Party/LwIP/src/include/netif;../Middlewares/Third_Party/LwIP/src/include/compat/posix;../Middlewares/Third_Party/LwIP/src/include/compat/posix/arpa;../Middlewares/Third_Party/LwIP/src/include/compat/posix/net;../Middlewares/Third_Party/LwIP/src/include/compat/posix/sys;../Middlewares/Third_Party/LwIP/src/include/compat/stdc;../Middlewares/Third_Party/LwIP/system/arch;../Drivers/CMSIS/Include;../User/application/inc;../User/board/inc;../User/driver;../User/system</IncludePath>
</VariousControls> </VariousControls>
</Cads> </Cads>
<Aads> <Aads>

View File

@ -1,2 +0,0 @@
[EXTDLL]
Count=0

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,24 @@
#include "lwip.h" #include "lwip.h"
extern ip4_addr_t ipaddr; extern ip4_addr_t ipaddr;
uint8_t ip_addr[24] = {0}; uart_lcd_t uart_lcd_state = {0};
uint8_t uart_lcd_data[24] = {0xEE, 0xB1, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x01, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0xFF, 0xFC, 0xFF, 0xFF};
static void uart_lcd_current_channel1(void);
static void uart_lcd_current_channel2(void);
static void uart_lcd_current_channel1(void)
{
// uint8_t uart_lcd_data[24] = {0xEE, 0xB1, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x01, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0xFF, 0xFC, 0xFF, 0xFF};
dma_usart_send(&huart4, uart_lcd_data, ARRAY_LEN(uart_lcd_data));
}
uint8_t uart_lcd_data2[24] = {0xEE, 0xB1, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x03, 0x00, 0x01, 0x01, 0xFF, 0xFC, 0xFF, 0xFF};
static void uart_lcd_current_channel2(void)
{
dma_usart_send(&huart4, uart_lcd_data2, ARRAY_LEN(uart_lcd_data2));
}
/** /**
* @brief UART向LCD屏幕绘制IP地址 * @brief UART向LCD屏幕绘制IP地址
* *
@ -13,6 +30,7 @@ uint8_t ip_addr[24] = {0};
*/ */
void uart_lcd_draw_ipaddr(void) void uart_lcd_draw_ipaddr(void)
{ {
uint8_t ip_addr[24] = {0};
// 串口发送的固定值为串口屏指令指定的帧头帧尾 // 串口发送的固定值为串口屏指令指定的帧头帧尾
ip_addr[0] = 0xEE; // 帧头 ip_addr[0] = 0xEE; // 帧头
ip_addr[1] = 0xB1; ip_addr[1] = 0xB1;
@ -29,3 +47,52 @@ void uart_lcd_draw_ipaddr(void)
ip_addr[10 + strlen(ip_addr_str)] = 0xFF; ip_addr[10 + strlen(ip_addr_str)] = 0xFF;
dma_usart_send(&huart4, ip_addr, ARRAY_LEN(ip_addr)); dma_usart_send(&huart4, ip_addr, ARRAY_LEN(ip_addr));
} }
void uart_lcd_init(void)
{
uart_lcd_state.page_num = 0;
uart_lcd_state.key_state[0] = 0;
uart_lcd_state.key_state[1] = 1;
uart_lcd_state.key_state[2] = 0;
uart_lcd_state.current_value[0] = 0;
uart_lcd_state.current_value[1] = 0;
uart_lcd_channel_switch(uart_lcd_state.key_state[0]);
HAL_Delay(10);
uart_lcd_current_out(0);
HAL_Delay(10);
uart_lcd_current_out(1);
}
uint8_t lcd_channel[15] = {0xEE, 0xB1, 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFC, 0xFF, 0xFF};
void uart_lcd_current_out(uint8_t channel)
{
if (channel == 0)
{
lcd_channel[6] = 0x04;
lcd_channel[10] = uart_lcd_state.current_value[0];
dma_usart_send(&huart4, lcd_channel, ARRAY_LEN(lcd_channel));
}
else if (channel == 1)
{
lcd_channel[6] = 0x05;
lcd_channel[10] = uart_lcd_state.current_value[1];
dma_usart_send(&huart4, lcd_channel, ARRAY_LEN(lcd_channel));
}
}
void uart_lcd_channel_switch(uint8_t channel)
{
switch (channel)
{
case 0:
uart_lcd_current_channel1();
break;
case 1:
uart_lcd_current_channel2();
break;
default:
uart_lcd_current_channel1();
break;
}
}

View File

@ -2,14 +2,27 @@
#define __UART_LCD_H__ #define __UART_LCD_H__
#include "main.h" #include "main.h"
typedef struct
{
uint8_t page_num;
uint8_t key_state[3];
uint8_t current_value[2];
uint8_t lcd_flag;
} uart_lcd_t;
extern uart_lcd_t uart_lcd_state;
typedef struct typedef struct
{ {
uint8_t confirm_key_flag; uint8_t confirm_key_flag;
uint8_t confirm_key_flag_last; uint8_t confirm_key_flag_last;
int direction; int direction;
int encode_num_last;
int encode_num; int encode_num;
} ec11_t; } ec11_t;
extern ec11_t ec11_data; extern ec11_t ec11_data;
void uart_lcd_draw_ipaddr(void); void uart_lcd_draw_ipaddr(void);
void uart_lcd_init(void);
void uart_lcd_current_out(uint8_t channel);
void uart_lcd_channel_switch(uint8_t channel);
#endif #endif

View File

@ -139,7 +139,7 @@ ETH.IPParameters=MediaInterface
ETH.MediaInterface=HAL_ETH_RMII_MODE ETH.MediaInterface=HAL_ETH_RMII_MODE
FREERTOS.FootprintOK=true FREERTOS.FootprintOK=true
FREERTOS.IPParameters=Tasks01,configMAX_TASK_NAME_LEN,configENABLE_FPU,configMAX_PRIORITIES,FootprintOK FREERTOS.IPParameters=Tasks01,configMAX_TASK_NAME_LEN,configENABLE_FPU,configMAX_PRIORITIES,FootprintOK
FREERTOS.Tasks01=lwip_task,2,512,start_tcp_task,Default,NULL,Dynamic,NULL,NULL;led_task,-2,128,start_led_toggle_task,Default,NULL,Dynamic,NULL,NULL;dac_task,0,512,start_dac_task,Default,NULL,Dynamic,NULL,NULL;adc_task,-1,128,start_adc_task,Default,NULL,Dynamic,NULL,NULL;gpio_di_do_task,0,128,start_gpio_di_do_task,Default,NULL,Dynamic,NULL,NULL;ec11_task,0,128,start_ec11_task,Default,NULL,Dynamic,NULL,NULL FREERTOS.Tasks01=lwip_task,2,512,start_tcp_task,Default,NULL,Dynamic,NULL,NULL;led_task,-2,128,start_led_toggle_task,Default,NULL,Dynamic,NULL,NULL;dac_task,0,512,start_dac_task,Default,NULL,Dynamic,NULL,NULL;adc_task,-1,128,start_adc_task,Default,NULL,Dynamic,NULL,NULL;gpio_di_do_task,0,128,start_gpio_di_do_task,Default,NULL,Dynamic,NULL,NULL;ec11_task,0,128,start_ec11_task,Default,NULL,Dynamic,NULL,NULL;lcd_task,-3,512,start_lcd_task,Default,NULL,Dynamic,NULL,NULL
FREERTOS.configENABLE_FPU=1 FREERTOS.configENABLE_FPU=1
FREERTOS.configMAX_PRIORITIES=32 FREERTOS.configMAX_PRIORITIES=32
FREERTOS.configMAX_TASK_NAME_LEN=24 FREERTOS.configMAX_TASK_NAME_LEN=24