首次上传-备份

This commit is contained in:
王绪洁 2025-07-28 16:23:06 +08:00
parent 97daf86d23
commit 78e0073116
54 changed files with 6158 additions and 5872 deletions

View File

@ -198,43 +198,10 @@ void start_led_toggle_task(void const *argument)
/* Infinite loop */ /* Infinite loop */
for (;;) for (;;)
{ {
if (ec11_data.confirm_key_flag == 0) HAL_GPIO_TogglePin(LED3_G_GPIO_Port, LED3_G_Pin);
{
HAL_GPIO_TogglePin(LED2_Y_GPIO_Port, LED2_Y_Pin);
}
else if (ec11_data.confirm_key_flag == 1)
{
ec11_data.confirm_key_flag_last++;
if (ec11_data.confirm_key_flag_last > 3)
{
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 = 0;
}
}
else if (ec11_data.confirm_key_flag == 2)
{
ec11_data.confirm_key_flag_last = 0;
if (uart_lcd_state.key_state[0] == 1) uart_lcd_ecll_control_current_out();
{ vTaskDelay(500);
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;
uart_lcd_channel_switch(uart_lcd_state.key_state[0]);
}
vTaskDelay(400);
} }
/* USER CODE END start_led_toggle_task */ /* USER CODE END start_led_toggle_task */
} }
@ -358,56 +325,8 @@ void start_ec11_task(void const *argument)
/* Infinite loop */ /* Infinite loop */
for (;;) for (;;)
{ {
ec11_data.direction = __HAL_TIM_IS_TIM_COUNTING_DOWN(&htim1);
ec11_data.encode_num = (short)__HAL_TIM_GET_COUNTER(&htim1); uart_lcd_ec11_control_current();
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); vTaskDelay(100);
} }
/* USER CODE END start_ec11_task */ /* USER CODE END start_ec11_task */

View File

@ -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 */
/*閰濈疆鍧勪覆鍧殑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));
@ -135,9 +135,9 @@ int main(void)
HAL_UARTEx_ReceiveToIdle_DMA(&huart2, hart2_uart2.rx_data_temp, ARRAY_LEN(hart2_uart2.rx_data_temp)); HAL_UARTEx_ReceiveToIdle_DMA(&huart2, hart2_uart2.rx_data_temp, ARRAY_LEN(hart2_uart2.rx_data_temp));
HAL_UARTEx_ReceiveToIdle_DMA(&huart1, usb_uart1.rx_data_temp, ARRAY_LEN(usb_uart1.rx_data_temp)); HAL_UARTEx_ReceiveToIdle_DMA(&huart1, usb_uart1.rx_data_temp, ARRAY_LEN(usb_uart1.rx_data_temp));
// end // end
hart_ht1200m_reset(); // 鍒濆鍖朒T1200M妯″潡 hart_ht1200m_reset(); // 鍒濆?鍖朒T1200M妯″潡
HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1); // PWM杈撳嚭锛岀敤浜庨┍鍔℉T1200M妯″潡 HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1); // PWM杈撳嚭锛岀敤浜庨┍鍔℉T1200M妯″潡
HAL_TIM_Encoder_Start(&htim1, TIM_CHANNEL_ALL); // 鏃嬭浆缂栫牆鍣ㄨ緭锟<EFBFBD>?? HAL_TIM_Encoder_Start(&htim1, TIM_CHANNEL_ALL); // 鏃嬭浆缂栫牆鍣ㄨ緭锟???
/* 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) */
@ -213,7 +213,7 @@ void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
memcpy(usb_uart1.rx_data, usb_uart1.rx_data_temp, Size); memcpy(usb_uart1.rx_data, usb_uart1.rx_data_temp, Size);
HAL_UARTEx_ReceiveToIdle_DMA(&huart1, usb_uart1.rx_data_temp, ARRAY_LEN(usb_uart1.rx_data_temp)); HAL_UARTEx_ReceiveToIdle_DMA(&huart1, usb_uart1.rx_data_temp, ARRAY_LEN(usb_uart1.rx_data_temp));
// dma_usart_send(&huart4, usb_uart1.rx_data_temp, usb_uart1.rx_num); // dma_usart_send(&huart4, usb_uart1.rx_data_temp, usb_uart1.rx_num);
// ip鍦板潃淇敼澶勭悊 // ip鍦板潃淇?敼澶勭悊
IP4_ADDR(&ipaddr, usb_uart1.rx_data_temp[0], usb_uart1.rx_data_temp[1], usb_uart1.rx_data_temp[2], usb_uart1.rx_data_temp[3]); IP4_ADDR(&ipaddr, usb_uart1.rx_data_temp[0], usb_uart1.rx_data_temp[1], usb_uart1.rx_data_temp[2], usb_uart1.rx_data_temp[3]);
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)
@ -294,6 +294,25 @@ void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
HART2_RTS_RECEIVE; HART2_RTS_RECEIVE;
} }
} }
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if (GPIO_Pin == EC11_KEY_Pin)
{
if (ec11_data.confirm_key_flag == 0)
{
ec11_data.confirm_key_flag = 1;
}
else if (ec11_data.confirm_key_flag == 1)
{
ec11_data.confirm_key_flag = 2;
}
else if (ec11_data.confirm_key_flag == 2)
{
ec11_data.confirm_key_flag = 3;
}
}
}
/* USER CODE END 4 */ /* USER CODE END 4 */
/** /**
@ -330,7 +349,7 @@ void Error_Handler(void)
// while (1) // while (1)
// { // {
// } // }
// TODO 这里暂时注释导致原因为DMA发送太快导致发送失败 // TODO 这里暂时注释导致原因为DMA发送太快导致发送失败
/* USER CODE END Error_Handler_Debug */ /* USER CODE END Error_Handler_Debug */
} }

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 */
@ -322,20 +322,13 @@ void EXTI9_5_IRQHandler(void)
/* USER CODE END EXTI9_5_IRQn 0 */ /* USER CODE END EXTI9_5_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(EC11_KEY_Pin); HAL_GPIO_EXTI_IRQHandler(EC11_KEY_Pin);
/* USER CODE BEGIN EXTI9_5_IRQn 1 */ /* USER CODE BEGIN EXTI9_5_IRQn 1 */
if (ec11_data.confirm_key_flag == 1)
{
ec11_data.confirm_key_flag = 2;
}
else if (ec11_data.confirm_key_flag == 0)
{
ec11_data.confirm_key_flag = 1;
}
/* USER CODE END EXTI9_5_IRQn 1 */ /* USER CODE END EXTI9_5_IRQn 1 */
} }
/** /**
* @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 +341,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 +355,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 +368,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 +382,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 +396,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 +409,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 +421,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 +435,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 +449,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 +463,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 +477,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 +491,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 */

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

@ -0,0 +1 @@
<DrawPage name="current_out" bk_transparent="0" bk_color="255;255;255" bk_image="" size_option="0" width="240" height="320"><item name="Button1" id="1" type="button" button_type="1" focus="0" notify_disable="1" key_code="a" key_type="0" init_state="0" button_style="0" longpress_delay="0" url_down="" url_up="" popup_menu_id="0" input_text_id="0" switch="" switch_effect="0" switch_area="0" switch_area_left="0" switch_area_right="0" switch_area_top="0" switch_area_bottom="0" action="" xOffset="0" yOffset="0" width="320" height="59" cut_up="0" cut_up_offset_x="0" cut_up_offset_y="0" cut_down="0" cut_down_offset_x="0" cut_down_offset_y="0" custom_data_up="" custom_data_down="" external_data_up="" external_data_down="" external_data_delay="100" child_screen="0" need_login="0" login_password="888888" show_text_state="1" font="10" font_color_up="0;0;0" font_color_down="0;0;0" text_state_up="第一路输出控制" text_state_down="第二路输出控制" bind_variant="" show_condition="0" condition_variant="" condition_value="0"/><item name="Button2" id="2" type="button" button_type="1" focus="1" notify_disable="0" key_code="a" key_type="0" init_state="1" button_style="0" longpress_delay="0" url_down="Images\780.jpg" url_up="" popup_menu_id="0" input_text_id="0" switch="" switch_effect="0" switch_area="0" switch_area_left="0" switch_area_right="0" switch_area_top="0" switch_area_bottom="0" action="" xOffset="4" yOffset="70" width="60" height="60" cut_up="0" cut_up_offset_x="0" cut_up_offset_y="0" cut_down="0" cut_down_offset_x="0" cut_down_offset_y="0" custom_data_up="" custom_data_down="" external_data_up="" external_data_down="" external_data_delay="100" child_screen="0" need_login="0" login_password="888888" show_text_state="0" font="7" font_color_up="255;255;255" font_color_down="255;255;255" text_state_up="" text_state_down="" bind_variant="" show_condition="0" condition_variant="" condition_value="0"/><item name="Button3" id="3" type="button" button_type="1" focus="1" notify_disable="0" key_code="a" key_type="0" init_state="0" button_style="0" longpress_delay="0" url_down="images\780.jpg" url_up="" popup_menu_id="0" input_text_id="0" switch="" switch_effect="0" switch_area="0" switch_area_left="0" switch_area_right="0" switch_area_top="0" switch_area_bottom="0" action="" xOffset="4" yOffset="150" width="60" height="60" cut_up="0" cut_up_offset_x="4" cut_up_offset_y="150" cut_down="0" cut_down_offset_x="0" cut_down_offset_y="0" custom_data_up="" custom_data_down="" external_data_up="" external_data_down="" external_data_delay="100" child_screen="0" need_login="0" login_password="888888" show_text_state="0" font="7" font_color_up="255;255;255" font_color_down="255;255;255" text_state_up="" text_state_down="" bind_variant="" show_condition="0" condition_variant="" condition_value="0"/><item name="Slider1" id="4" type="slider" xOffset="71" yOffset="70" width="245" height="60" value="0" start_value="0" end_value="20" input="1" notify="0" direction="0" mark_type="0" mark_count="10" mark_color="0;0;0" show_value="1" left_space="24" right_space="24" bkg_type="1" bkg_image_path="" bkg_color="255;255;255" cursor_type="0" cursor_direction="0" cursor_offset="14" cursor_width="24" cursor_height="24" cursor_image_path="" bind_variant="" show_condition="0" condition_variant="" condition_value="0"/><item name="Slider2" id="5" type="slider" xOffset="69" yOffset="150" width="245" height="60" value="0" start_value="0" end_value="20" input="1" notify="0" direction="0" mark_type="0" mark_count="10" mark_color="0;0;0" show_value="1" left_space="24" right_space="24" bkg_type="1" bkg_image_path="" bkg_color="255;255;255" cursor_type="0" cursor_direction="0" cursor_offset="14" cursor_width="24" cursor_height="24" cursor_image_path="" bind_variant="" show_condition="0" condition_variant="" condition_value="0"/></DrawPage>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,24 @@
[tcpip]
dhcp=n
ipaddr=192.168.1.100
netmask=255.255.255.0
gw=192.168.1.1
dns=192.168.1.1
server_port=5050
remote_ip=192.168.1.200
network_transfer=0
network_mode=0
[ctrlboard]
lcd_width=320
lcd_height=240
baudrate=115200
enable_keysound=0
audiolevel=100
[wifi]
wifi_mode=0
ssid=
password=
secumode=0

View File

@ -0,0 +1 @@
<EFBFBD>uc<EFBFBD>

View File

@ -0,0 +1,37 @@
------------------------------------
-- 提示
-- 如果使用其他Lua编辑工具编辑此文档请将VisualTFT软件中打开的此文件编辑器视图关闭
-- 因为VisualTFT具有自动保存功能其他软件修改时不能同步到VisualTFT编辑视图
-- VisualTFT定时保存时其他软件修改的内容将被恢复。
--
-- Attention
-- If you use other Lua Editor to edit this file, please close the file editor view
-- opened in the VisualTFT, Because VisualTFT has an automatic save function,
-- other Lua Editor cannot be synchronized to the VisualTFT edit view when it is modified.
-- When VisualTFT saves regularly, the content modified by other Lua Editor will be restored.
------------------------------------
--下面列出了常用的回调函数
--更多功能请阅读<<LUA脚本API.pdf>>
--初始化函数
--function on_init()
--end
--定时回调函数系统每隔1秒钟自动调用。
--function on_systick()
--end
--定时器超时回调函数当设置的定时器超时时执行此回调函数timer_id为对应的定时器ID
--function on_timer(timer_id)
--end
--用户通过触摸修改控件后,执行此回调函数。
--点击按钮控件,修改文本控件、修改滑动条都会触发此事件。
--function on_control_notify(screen,control,value)
--end
--当画面切换时执行此回调函数screen为目标画面。
--function on_screen_change(screen)
--end

View File

@ -0,0 +1,2 @@
[setting]
font0=wqymicrohei.ttf

View File

@ -0,0 +1,32 @@
<fonts ttf="wqyMicroHei.ttf">
<font id="0" type="2" name="ASC_CHS_8" width="4" height="8"/>
<font id="1" type="2" name="ASC_CHS_10" width="5" height="10"/>
<font id="2" type="2" name="ASC_CHS_12" width="6" height="12"/>
<font id="3" type="2" name="ASC_CHS_14" width="7" height="14"/>
<font id="4" type="2" name="ASC_CHS_16" width="8" height="16"/>
<font id="5" type="2" name="ASC_CHS_18" width="9" height="18"/>
<font id="6" type="2" name="ASC_CHS_20" width="10" height="20"/>
<font id="7" type="2" name="ASC_CHS_22" width="11" height="22"/>
<font id="8" type="2" name="ASC_CHS_24" width="12" height="24"/>
<font id="9" type="2" name="ASC_CHS_26" width="13" height="26"/>
<font id="10" type="2" name="ASC_CHS_28" width="14" height="28"/>
<font id="11" type="2" name="ASC_CHS_30" width="15" height="30"/>
<font id="12" type="2" name="ASC_CHS_32" width="16" height="32"/>
<font id="13" type="2" name="ASC_CHS_36" width="18" height="36"/>
<font id="14" type="2" name="ASC_CHS_40" width="20" height="40"/>
<font id="15" type="2" name="ASC_CHS_44" width="22" height="44"/>
<font id="16" type="2" name="ASC_CHS_48" width="24" height="48"/>
<font id="17" type="2" name="ASC_CHS_52" width="26" height="52"/>
<font id="18" type="2" name="ASC_CHS_56" width="28" height="56"/>
<font id="19" type="2" name="ASC_CHS_60" width="30" height="60"/>
<font id="20" type="2" name="ASC_CHS_64" width="32" height="64"/>
<font id="21" type="2" name="ASC_CHS_80" width="40" height="80"/>
<font id="22" type="2" name="ASC_CHS_96" width="48" height="96"/>
<font id="23" type="2" name="ASC_CHS_112" width="56" height="112"/>
<font id="24" type="2" name="ASC_CHS_128" width="64" height="128"/>
<font id="25" type="2" name="ASC_CHS_144" width="72" height="144"/>
<font id="26" type="2" name="ASC_CHS_160" width="80" height="160"/>
<font id="27" type="2" name="ASC_CHS_176" width="88" height="176"/>
<font id="28" type="2" name="ASC_CHS_192" width="96" height="192"/>
<font id="29" type="2" name="ASC_CHS_200" width="100" height="200"/>
</fonts>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -0,0 +1,37 @@
------------------------------------
-- 提示
-- 如果使用其他Lua编辑工具编辑此文档请将VisualTFT软件中打开的此文件编辑器视图关闭
-- 因为VisualTFT具有自动保存功能其他软件修改时不能同步到VisualTFT编辑视图
-- VisualTFT定时保存时其他软件修改的内容将被恢复。
--
-- Attention
-- If you use other Lua Editor to edit this file, please close the file editor view
-- opened in the VisualTFT, Because VisualTFT has an automatic save function,
-- other Lua Editor cannot be synchronized to the VisualTFT edit view when it is modified.
-- When VisualTFT saves regularly, the content modified by other Lua Editor will be restored.
------------------------------------
--下面列出了常用的回调函数
--更多功能请阅读<<LUA脚本API.pdf>>
--初始化函数
--function on_init()
--end
--定时回调函数系统每隔1秒钟自动调用。
--function on_systick()
--end
--定时器超时回调函数当设置的定时器超时时执行此回调函数timer_id为对应的定时器ID
--function on_timer(timer_id)
--end
--用户通过触摸修改控件后,执行此回调函数。
--点击按钮控件,修改文本控件、修改滑动条都会触发此事件。
--function on_control_notify(screen,control,value)
--end
--当画面切换时执行此回调函数screen为目标画面。
--function on_screen_change(screen)
--end

View File

@ -0,0 +1,2 @@
<DrawPage name="monitoring" bk_transparent="0" bk_color="255;255;255" bk_image="" size_option="0" width="240" height="320"><item name="Text_Display2" id="5" type="text_display" text="" tipinfo="" font="4" encode="1" show_bkg_style="0" fore_color="102;255;102" bkg_color="0;255;0" bkg_image_path="" xOffset="35" yOffset="200" width="45" height="40" input_mode="0" variant="0" text_type="0" text_len_max="255" password="0" focus_rect="0" text_align="1" text_align_v="1" value_limit="0" value_precision="0" max_value="100" min_value="0" keyboard_init="0" keyboard_position="0" keyboard_x="0" keyboard_y="0" art_digit="0" art_digit_icon="" half_width_dot="0" bind_variant="" show_condition="0" condition_variant="" condition_value="0"/><item name="Text_Display4" id="6" type="text_display" text="" tipinfo="" font="4" encode="1" show_bkg_style="0" fore_color="255;0;0" bkg_color="0;255;0" bkg_image_path="" xOffset="115" yOffset="200" width="45" height="40" input_mode="0" variant="0" text_type="0" text_len_max="255" password="0" focus_rect="0" text_align="1" text_align_v="1" value_limit="0" value_precision="0" max_value="100" min_value="0" keyboard_init="0" keyboard_position="0" keyboard_x="0" keyboard_y="0" art_digit="0" art_digit_icon="" half_width_dot="0" bind_variant="" show_condition="0" condition_variant="" condition_value="0"/><item name="Text_Display6" id="7" type="text_display" text="" tipinfo="" font="4" encode="1" show_bkg_style="0" fore_color="0;0;255" bkg_color="0;255;0" bkg_image_path="" xOffset="195" yOffset="200" width="45" height="40" input_mode="0" variant="0" text_type="0" text_len_max="255" password="0" focus_rect="0" text_align="1" text_align_v="1" value_limit="0" value_precision="0" max_value="100" min_value="0" keyboard_init="0" keyboard_position="0" keyboard_x="0" keyboard_y="0" art_digit="0" art_digit_icon="" half_width_dot="0" bind_variant="" show_condition="0" condition_variant="" condition_value="0"/><item name="Text_Display8" id="8" type="text_display" text="" tipinfo="" font="4" encode="1" show_bkg_style="0" fore_color="204;204;0" bkg_color="0;255;0" bkg_image_path="" xOffset="275" yOffset="200" width="45" height="40" input_mode="0" variant="0" text_type="0" text_len_max="255" password="0" focus_rect="0" text_align="1" text_align_v="1" value_limit="0" value_precision="0" max_value="100" min_value="0" keyboard_init="0" keyboard_position="0" keyboard_x="0" keyboard_y="0" art_digit="0" art_digit_icon="" half_width_dot="0" bind_variant="" show_condition="0" condition_variant="" condition_value="0"/><item name="Text1" id="1" type="text" multi_lang="1" text_align="1" text_align_v="1" text="SW1:
" text1="" text2="" text3="" text4="" text5="" text6="" text7="" text8="" text9="" text10="" text11="" text12="" text13="" text14="" text15="" font="4" encode="0" show_bk="0" fore_color="0;128;0" bk_color="255;255;255" xOffset="0" yOffset="200" width="35" height="40" row_gap="0" col_gap="0"/><item name="Text2" id="2" type="text" multi_lang="1" text_align="1" text_align_v="1" text="SW2:" text1="" text2="" text3="" text4="" text5="" text6="" text7="" text8="" text9="" text10="" text11="" text12="" text13="" text14="" text15="" font="4" encode="0" show_bk="0" fore_color="255;0;0" bk_color="255;255;255" xOffset="80" yOffset="200" width="35" height="40" row_gap="0" col_gap="0"/><item name="Text3" id="3" type="text" multi_lang="1" text_align="1" text_align_v="1" text="S.P:" text1="" text2="" text3="" text4="" text5="" text6="" text7="" text8="" text9="" text10="" text11="" text12="" text13="" text14="" text15="" font="4" encode="0" show_bk="0" fore_color="0;0;255" bk_color="255;255;255" xOffset="160" yOffset="200" width="35" height="40" row_gap="0" col_gap="0"/><item name="Text4" id="4" type="text" multi_lang="1" text_align="1" text_align_v="1" text="A.P:" text1="" text2="" text3="" text4="" text5="" text6="" text7="" text8="" text9="" text10="" text11="" text12="" text13="" text14="" text15="" font="4" encode="0" show_bk="0" fore_color="204;204;0" bk_color="255;255;255" xOffset="240" yOffset="200" width="35" height="40" row_gap="0" col_gap="0"/><item name="Line1" id="9" type="line" x0="23" y0="0" x1="23" y1="190" pen_width="1" pen_color="0;0;0"/><item name="Text5" id="10" type="text" multi_lang="1" text_align="0" text_align_v="0" text="100" text1="" text2="" text3="" text4="" text5="" text6="" text7="" text8="" text9="" text10="" text11="" text12="" text13="" text14="" text15="" font="3" encode="0" show_bk="0" fore_color="0;0;0" bk_color="255;255;255" xOffset="1" yOffset="10" width="34" height="21" row_gap="0" col_gap="0"/><item name="Text6" id="11" type="text" multi_lang="1" text_align="0" text_align_v="0" text="50" text1="" text2="" text3="" text4="" text5="" text6="" text7="" text8="" text9="" text10="" text11="" text12="" text13="" text14="" text15="" font="3" encode="0" show_bk="0" fore_color="0;0;0" bk_color="255;255;255" xOffset="5" yOffset="100" width="34" height="21" row_gap="0" col_gap="0"/><item name="Text7" id="12" type="text" multi_lang="1" text_align="0" text_align_v="0" text="0" text1="" text2="" text3="" text4="" text5="" text6="" text7="" text8="" text9="" text10="" text11="" text12="" text13="" text14="" text15="" font="3" encode="0" show_bk="0" fore_color="0;0;0" bk_color="255;255;255" xOffset="1" yOffset="185" width="34" height="21" row_gap="0" col_gap="0"/><item name="Line2" id="13" type="line" x0="23" y0="190" x1="315" y1="190" pen_width="1" pen_color="0;0;0"/><item name="Graph1" id="14" type="graph" xOffset="25" yOffset="23" width="288" height="164" sample_count="260" sample_depth="1" anti_aliasing="1" direction="0" line_width="1" scale="1" start_value="0" end_value="100" channel_count="4" channel_color0="0;128;0" channel_color1="255;0;0" channel_color2="0;0;255" channel_color3="204;204;0" channel_color4="255;255;255" channel_color5="255;255;255" channel_color6="255;255;255" channel_color7="255;255;255"/></DrawPage>

View File

@ -0,0 +1,29 @@
//创建画面current_out的命令索引ID
#define _SCREEN_CURRENT_OUT 0
//创建画面monitoring的命令索引ID
#define _SCREEN_MONITORING 1
#define _BTN_CURRENT_OUT_BUTTON1 1
#define _BTN_CURRENT_OUT_BUTTON2 2
//画面current_out中按钮Button3按下时的图片
#define _IMG_CURRENT_OUT_BUTTON3_DOWN 0
#define _BTN_CURRENT_OUT_BUTTON3 3
#define _SLIDER_CURRENT_OUT_SLIDER1 4
#define _SLIDER_CURRENT_OUT_SLIDER2 5
#define _TXT_DIS__MONITORING_TEXT_DISPLAY2 5
#define _TXT_DIS__MONITORING_TEXT_DISPLAY4 6
#define _TXT_DIS__MONITORING_TEXT_DISPLAY6 7
#define _TXT_DIS__MONITORING_TEXT_DISPLAY8 8
#define _GRAPH_MONITORING_GRAPH1 14

View File

@ -0,0 +1,2 @@
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`1234567890-=[];',./~!@#$%^&*()_+{}:"<>? 年月日时分秒星期一二三四五六日
第路输出控制

View File

@ -0,0 +1 @@
<controls count="10"><control type="16" count="3"/><control type="17" count="4"/><control type="19" count="2"/><control type="24" count="1"/></controls>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
<Resource>
<pages>
<page name="current_out" id="0" />
<page name="monitoring" id="1" />
</pages>
<images>
<image id="0" url="e:\work\项目资料\显示屏工程\signal generator\Images\780.jpg" effect_width="60" effect_height="60" />
<image id="1" url="C:\Users\WANGXU~1\AppData\Local\Temp\slider_0_4.png" effect_width="60" effect_height="245" />
<image id="2" url="C:\Users\WANGXU~1\AppData\Local\Temp\cursor_0_0.png" effect_width="24" effect_height="24" />
<image id="3" url="C:\Users\WANGXU~1\AppData\Local\Temp\slider_0_5.png" effect_width="60" effect_height="245" />
</images>
<waves />
</Resource>

View File

@ -0,0 +1,2 @@
[setting]
font0=wqymicrohei.ttf

Binary file not shown.

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<VisualTFT Name="signal generator" OutputDirectory="output\" StartupPage="current_out" StartupAction="" StartupActionLoop="1" DeviceType="28000" DeviceEnableControl="1" DeviceEnableTouchPane="1" DeviceEnableBuzzer="2" DeviceEnableCRC="0" DeviceBaudRate="7" DeviceCoordinateUpdateMode="4" DeviceControlNotify="3" DeviceScreenNotify="1" DeviceScreenRvs="1" DeviceBacklightAutoControl="0" DeviceBacklightTime="10" DeviceBacklightOn="200" DeviceBacklightOff="50" DeviceBacklightNotify="0" DeviceLockConfig="1" DeviceStartupVoice="0" DeviceVoiceVolume="100" DeviceEnableSlidingScreen="0" BeginSlidingScreen="" EndSlidingScreen="" CompatibleScreenRotate="1" AddResourceFloder="1" FastRefreshScreen="0" DelayInitScreen="0" ImageDithering="1" ImageFormat="1" JPEGQuality="95" StartupLogo="" DHCP="0" IPAddress="192.168.1.100" NetMask="255.255.255.0" Gateway="192.168.1.1" DNS="192.168.1.1" NetworkMode="0" ServerAddress="192.168.1.200" ServicePort="5050" NetworkTransfer="0" WifiMode="0" WifiSSID="" WifiPassword="" FlashType="1" PartitionSize0="100" PartitionSize1="10" PartitionSize2="0" Repartition="1" FormatPartition="1" UartDownloadSpeed="0" PKGSetting="0" PKGControl="1" PKGImage="1" PKGFont="1" PKGOther="1" Version="1.0" EnableSlidingRange="0" EnableKeysound="0" BacklightAutoControl="0" BacklightNotify="0" StandbyPage="" ServerPort="5050" WifiSSI="">
<Pages><Page RelativePath="current_out.tft"/><Page RelativePath="monitoring.tft"/></Pages>
<Images/>
<Waves/>
</VisualTFT>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -154,14 +154,14 @@
<Type>0</Type> <Type>0</Type>
<LineNumber>1404</LineNumber> <LineNumber>1404</LineNumber>
<EnabledFlag>1</EnabledFlag> <EnabledFlag>1</EnabledFlag>
<Address>134235956</Address> <Address>134235972</Address>
<ByteObject>0</ByteObject> <ByteObject>0</ByteObject>
<HtxType>0</HtxType> <HtxType>0</HtxType>
<ManyObjects>0</ManyObjects> <ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject> <SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess> <BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount> <BreakIfRCount>1</BreakIfRCount>
<Filename>../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c</Filename> <Filename>E:\WORK\浠g爜-椤圭洰\positioner_testing\signal_generator\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_uart.c</Filename>
<ExecCommand></ExecCommand> <ExecCommand></ExecCommand>
<Expression>\\signal_generator\../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c\1404</Expression> <Expression>\\signal_generator\../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c\1404</Expression>
</Bp> </Bp>
@ -450,7 +450,7 @@
<Group> <Group>
<GroupName>Drivers/STM32F4xx_HAL_Driver</GroupName> <GroupName>Drivers/STM32F4xx_HAL_Driver</GroupName>
<tvExp>1</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>

View File

@ -16,8 +16,8 @@
<TargetCommonOption> <TargetCommonOption>
<Device>STM32F407VGTx</Device> <Device>STM32F407VGTx</Device>
<Vendor>STMicroelectronics</Vendor> <Vendor>STMicroelectronics</Vendor>
<PackID>Keil.STM32F4xx_DFP.2.17.1</PackID> <PackID>Keil.STM32F4xx_DFP.2.12.0</PackID>
<PackURL>https://www.keil.com/pack/</PackURL> <PackURL>http://www.keil.com/pack</PackURL>
<Cpu>IRAM(0x20000000-0x2001BFFF) IRAM2(0x2001C000-0x2001FFFF) IROM(0x8000000-0x80FFFFF) CLOCK(25000000) FPU2 CPUTYPE("Cortex-M4") TZ</Cpu> <Cpu>IRAM(0x20000000-0x2001BFFF) IRAM2(0x2001C000-0x2001FFFF) IROM(0x8000000-0x80FFFFF) CLOCK(25000000) FPU2 CPUTYPE("Cortex-M4") TZ</Cpu>
<FlashUtilSpec></FlashUtilSpec> <FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile> <StartupFile></StartupFile>

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,10 @@
#include "uart_lcd.h" #include "uart_lcd.h"
#include "usart.h" #include "usart.h"
#include "lwip.h" #include "lwip.h"
#include "tim.h"
extern ip4_addr_t ipaddr; extern ip4_addr_t ipaddr;
uart_lcd_t uart_lcd_state = {0}; uart_lcd_t uart_lcd_state = {0};
extern float current_buff[2];
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}; 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_channel1(void);
@ -20,7 +21,18 @@ static void uart_lcd_current_channel2(void)
{ {
dma_usart_send(&huart4, uart_lcd_data2, ARRAY_LEN(uart_lcd_data2)); dma_usart_send(&huart4, uart_lcd_data2, ARRAY_LEN(uart_lcd_data2));
} }
uint8_t uart_lcd_data3[9] = {0xEE, 0xB1, 0x00, 0x00, 0x00, 0xFF, 0xFC, 0xFF, 0xFF};
static void uart_lcd_page1(void)
{
uart_lcd_state.page_num = 0;
dma_usart_send(&huart4, uart_lcd_data3, ARRAY_LEN(uart_lcd_data3));
}
uint8_t uart_lcd_data4[9] = {0xEE, 0xB1, 0x00, 0x00, 0x01, 0xFF, 0xFC, 0xFF, 0xFF};
static void uart_lcd_page2(void)
{
uart_lcd_state.page_num = 1;
dma_usart_send(&huart4, uart_lcd_data4, ARRAY_LEN(uart_lcd_data4));
}
/** /**
* @brief UART向LCD屏幕绘制IP地址 * @brief UART向LCD屏幕绘制IP地址
* *
@ -96,3 +108,133 @@ void uart_lcd_channel_switch(uint8_t channel)
break; break;
} }
} }
void uart_lcd_page_switch(uint8_t page)
{
switch (page)
{
case 0:
uart_lcd_page1();
break;
case 1:
uart_lcd_page2();
break;
default:
uart_lcd_page1();
break;
}
// HAL_Delay(100);
}
void uart_lcd_ecll_control_current_out(void)
{
if (ec11_data.confirm_key_flag == 0)
{
}
else if (ec11_data.confirm_key_flag == 1) // 确认按键确认电流输出
{
ec11_data.confirm_key_flag_last++;
if (ec11_data.confirm_key_flag_last > 2)
{
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 = 0;
}
}
else if (ec11_data.confirm_key_flag == 2) // 切换通道按键确认状<E8AEA4>??
{
ec11_data.confirm_key_flag_last++;
if (ec11_data.confirm_key_flag_last > 2)
{
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_last = 0;
ec11_data.confirm_key_flag = 0;
uart_lcd_channel_switch(uart_lcd_state.key_state[0]);
}
}
else if (ec11_data.confirm_key_flag == 3) // 切换界面
{
if (uart_lcd_state.page_num == 0)
{
uart_lcd_state.page_num = 1;
}
else if (uart_lcd_state.page_num == 1)
{
uart_lcd_state.page_num = 0;
}
ec11_data.confirm_key_flag_last = 0;
ec11_data.confirm_key_flag = 0;
uart_lcd_page_switch(uart_lcd_state.page_num);
}
}
void uart_lcd_ec11_control_current(void)
{
if (uart_lcd_state.page_num == 0) // 当前页面为电流调节页面时才对EC11编码器进行计数处理
{
ec11_data.direction = __HAL_TIM_IS_TIM_COUNTING_DOWN(&htim1);
ec11_data.encode_num = (short)__HAL_TIM_GET_COUNTER(&htim1);
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;
}
}
uart_lcd_current_out(uart_lcd_state.key_state[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;
}
}
uart_lcd_current_out(uart_lcd_state.key_state[0]);
}
ec11_data.encode_num_last = ec11_data.encode_num;
}
}

View File

@ -1,3 +1,11 @@
/*
* @Author: wangxujie wangxujie@wuxismart.com
* @Date: 2025-03-10 15:05:20
* @LastEditors: wangxujie wangxujie@wuxismart.com
* @LastEditTime: 2025-07-28 16:17:11
* @FilePath: \signal_generator\User\driver\uart_lcd.h
* @Description: ,`customMade`, koroFileHeader查看配置 : https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
#ifndef __UART_LCD_H__ #ifndef __UART_LCD_H__
#define __UART_LCD_H__ #define __UART_LCD_H__
@ -25,4 +33,7 @@ void uart_lcd_draw_ipaddr(void);
void uart_lcd_init(void); void uart_lcd_init(void);
void uart_lcd_current_out(uint8_t channel); void uart_lcd_current_out(uint8_t channel);
void uart_lcd_channel_switch(uint8_t channel); void uart_lcd_channel_switch(uint8_t channel);
void uart_lcd_page_switch(uint8_t page);
void uart_lcd_ecll_control_current_out(void);
void uart_lcd_ec11_control_current(void);
#endif #endif