备份--曲线绘制
This commit is contained in:
parent
9bf76112e0
commit
768f66dd16
|
@ -179,7 +179,6 @@ void start_tcp_task(void const *argument)
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
// uart_lcd_draw_ipaddr();
|
|
||||||
osThreadTerminate(NULL);
|
osThreadTerminate(NULL);
|
||||||
}
|
}
|
||||||
/* USER CODE END start_tcp_task */
|
/* USER CODE END start_tcp_task */
|
||||||
|
@ -201,7 +200,7 @@ void start_led_toggle_task(void const *argument)
|
||||||
HAL_GPIO_TogglePin(LED3_G_GPIO_Port, LED3_G_Pin);
|
HAL_GPIO_TogglePin(LED3_G_GPIO_Port, LED3_G_Pin);
|
||||||
|
|
||||||
uart_lcd_ecll_control_current_out();
|
uart_lcd_ecll_control_current_out();
|
||||||
vTaskDelay(500);
|
vTaskDelay(300);
|
||||||
}
|
}
|
||||||
/* USER CODE END start_led_toggle_task */
|
/* USER CODE END start_led_toggle_task */
|
||||||
}
|
}
|
||||||
|
@ -220,10 +219,10 @@ void start_dac_task(void const *argument)
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
osThreadSuspend(adc_taskHandle);
|
osThreadSuspend(adc_taskHandle); // Suspend ADC task to prevent conflicts with ADC task.
|
||||||
dac161s997_output(DAC161S997_1, current_buff[0]);
|
dac161s997_output(DAC161S997_1, current_buff[0]);
|
||||||
dac161s997_output(DAC161S997_2, current_buff[1]);
|
dac161s997_output(DAC161S997_2, current_buff[1]);
|
||||||
osThreadResume(adc_taskHandle);
|
osThreadResume(adc_taskHandle); // Resume ADC task.
|
||||||
vTaskDelay(100);
|
vTaskDelay(100);
|
||||||
}
|
}
|
||||||
/* USER CODE END start_dac_task */
|
/* USER CODE END start_dac_task */
|
||||||
|
@ -243,13 +242,13 @@ void start_adc_task(void const *argument)
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
osThreadSuspend(dac_taskHandle);
|
osThreadSuspend(dac_taskHandle); // Suspend DAC task to prevent conflicts with DAC task.
|
||||||
uint8_t ch = 0;
|
uint8_t ch = 0;
|
||||||
for (ch = STOP_NC_ADC; ch < AD7124_CHANNEL_EN_MAX; ch++)
|
for (ch = STOP_NC_ADC; ch < AD7124_CHANNEL_EN_MAX; ch++)
|
||||||
{
|
{
|
||||||
ad7124_get_analog(ch);
|
ad7124_get_analog(ch);
|
||||||
}
|
}
|
||||||
osThreadResume(dac_taskHandle);
|
osThreadResume(dac_taskHandle); // Resume DAC task.
|
||||||
vTaskDelay(10);
|
vTaskDelay(10);
|
||||||
}
|
}
|
||||||
/* USER CODE END start_adc_task */
|
/* USER CODE END start_adc_task */
|
||||||
|
@ -286,7 +285,6 @@ void start_ec11_task(void const *argument)
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
|
||||||
uart_lcd_ec11_control_current();
|
uart_lcd_ec11_control_current();
|
||||||
vTaskDelay(100);
|
vTaskDelay(100);
|
||||||
}
|
}
|
||||||
|
@ -307,7 +305,8 @@ void start_lcd_task(void const *argument)
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
vTaskDelay(10);
|
uart_lcd_makecurve_test();
|
||||||
|
vTaskDelay(300);
|
||||||
}
|
}
|
||||||
/* USER CODE END start_lcd_task */
|
/* USER CODE END start_lcd_task */
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,18 +126,18 @@ 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 */
|
||||||
/*閰濈疆鍧勪覆鍧g殑DMA鎺ユ敹*/
|
/*Configure serial port DMA reception*/
|
||||||
// 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));
|
||||||
HAL_UARTEx_ReceiveToIdle_DMA(&huart3, ble2_uart3.rx_data_temp, ARRAY_LEN(ble2_uart3.rx_data_temp));
|
// HAL_UARTEx_ReceiveToIdle_DMA(&huart3, ble2_uart3.rx_data_temp, ARRAY_LEN(ble2_uart3.rx_data_temp));
|
||||||
HAL_UARTEx_ReceiveToIdle_DMA(&huart5, hart1_uart5.rx_data_temp, ARRAY_LEN(hart1_uart5.rx_data_temp));
|
// HAL_UARTEx_ReceiveToIdle_DMA(&huart5, hart1_uart5.rx_data_temp, ARRAY_LEN(hart1_uart5.rx_data_temp));
|
||||||
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(); // Reset HT1200M
|
||||||
HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1); // PWM杈撳嚭锛岀敤浜庨┍鍔℉T1200M妯″潡
|
HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1); // PWM output, used to drive the HT1200M module
|
||||||
HAL_TIM_Encoder_Start(&htim1, TIM_CHANNEL_ALL); // 鏃嬭浆缂栫牆鍣ㄨ緭锟???
|
HAL_TIM_Encoder_Start(&htim1, TIM_CHANNEL_ALL); // rotary encoder
|
||||||
/* 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) */
|
||||||
|
@ -212,13 +212,11 @@ void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
|
||||||
memset(usb_uart1.rx_data, 0, ARRAY_LEN(usb_uart1.rx_data));
|
memset(usb_uart1.rx_data, 0, ARRAY_LEN(usb_uart1.rx_data));
|
||||||
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);
|
// UART receives IP address
|
||||||
// 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)
|
||||||
{
|
{
|
||||||
// uart_lcd_draw_ipaddr();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (huart == &huart4)
|
if (huart == &huart4)
|
||||||
|
@ -228,7 +226,6 @@ void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
|
||||||
memset(lcd_uart4.rx_data, 0, ARRAY_LEN(lcd_uart4.rx_data));
|
memset(lcd_uart4.rx_data, 0, ARRAY_LEN(lcd_uart4.rx_data));
|
||||||
memcpy(lcd_uart4.rx_data, lcd_uart4.rx_data_temp, Size);
|
memcpy(lcd_uart4.rx_data, lcd_uart4.rx_data_temp, Size);
|
||||||
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));
|
||||||
// dma_usart_send(&huart4, lcd_uart4.rx_data_temp, lcd_uart4.rx_num);
|
|
||||||
}
|
}
|
||||||
if (huart == &huart6)
|
if (huart == &huart6)
|
||||||
{
|
{
|
||||||
|
@ -291,7 +288,7 @@ void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
|
||||||
}
|
}
|
||||||
if (huart == &huart4)
|
if (huart == &huart4)
|
||||||
{
|
{
|
||||||
HART2_RTS_RECEIVE;
|
uart_lcd_state.lcd_flag = 0; // Reset the LCD flag after sending data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,7 +346,6 @@ void Error_Handler(void)
|
||||||
// while (1)
|
// while (1)
|
||||||
// {
|
// {
|
||||||
// }
|
// }
|
||||||
// TODO 这里暂时注释,导致原因为DMA发送太快,导致发送失败
|
|
||||||
/* USER CODE END Error_Handler_Debug */
|
/* USER CODE END Error_Handler_Debug */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "usart.h"
|
#include "usart.h"
|
||||||
|
|
||||||
/* USER CODE BEGIN 0 */
|
/* USER CODE BEGIN 0 */
|
||||||
|
#include "uart_lcd.h"
|
||||||
/* USER CODE END 0 */
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
UART_HandleTypeDef huart4;
|
UART_HandleTypeDef huart4;
|
||||||
|
@ -772,8 +773,12 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef *uartHandle)
|
||||||
*/
|
*/
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
while (uart_lcd_state.lcd_flag != 0)
|
||||||
if (HAL_UART_Transmit_DMA(huart, buf, len) != HAL_OK) // ĺ¤ććŻĺŚĺé?ćŁĺ¸¸ďźĺŚćĺşç°ĺźĺ¸¸ĺčżĺ
Ľĺźĺ¸¸ä¸ćĺ˝ć?
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
uart_lcd_state.lcd_flag = 1; // 设置标志位,表示正在发送数据
|
||||||
|
if (HAL_UART_Transmit_DMA(huart, buf, len) != HAL_OK)
|
||||||
{
|
{
|
||||||
Error_Handler();
|
Error_Handler();
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -21,9 +21,11 @@
|
||||||
|
|
||||||
#define _TXT_DIS__MONITORING_TEXT_DISPLAY4 6
|
#define _TXT_DIS__MONITORING_TEXT_DISPLAY4 6
|
||||||
|
|
||||||
#define _TXT_DIS__MONITORING_TEXT_DISPLAY6 7
|
#define _TXT_DIS__MONITORING_TEXT_DISPLAY8 7
|
||||||
|
|
||||||
#define _TXT_DIS__MONITORING_TEXT_DISPLAY8 8
|
|
||||||
|
|
||||||
#define _GRAPH_MONITORING_GRAPH1 14
|
#define _GRAPH_MONITORING_GRAPH1 14
|
||||||
|
|
||||||
|
#define _BTN_MONITORING_BUTTON1 1
|
||||||
|
|
||||||
|
#define _BTN_MONITORING_BUTTON2 2
|
||||||
|
|
||||||
|
|
|
@ -1 +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>
|
<controls count="11"><control type="16" count="5"/><control type="17" count="3"/><control type="19" count="2"/><control type="24" count="1"/></controls>
|
||||||
|
|
Binary file not shown.
|
@ -4,7 +4,7 @@
|
||||||
<page name="monitoring" id="1" />
|
<page name="monitoring" id="1" />
|
||||||
</pages>
|
</pages>
|
||||||
<images>
|
<images>
|
||||||
<image id="0" url="e:\work\项目资料\显示屏工程\signal generator\Images\780.jpg" effect_width="60" effect_height="60" />
|
<image id="0" url="e:\work\代码-项目\positioner_testing\signal_generator\lcd\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="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="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" />
|
<image id="3" url="C:\Users\WANGXU~1\AppData\Local\Temp\slider_0_5.png" effect_width="60" effect_height="245" />
|
||||||
|
|
|
@ -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
|
@ -148,24 +148,7 @@
|
||||||
<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>134235972</Address>
|
|
||||||
<ByteObject>0</ByteObject>
|
|
||||||
<HtxType>0</HtxType>
|
|
||||||
<ManyObjects>0</ManyObjects>
|
|
||||||
<SizeOfObject>0</SizeOfObject>
|
|
||||||
<BreakByAccess>0</BreakByAccess>
|
|
||||||
<BreakIfRCount>1</BreakIfRCount>
|
|
||||||
<Filename>E:\WORK\浠g爜-椤圭洰\positioner_testing\signal_generator\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>
|
|
||||||
</Breakpoint>
|
|
||||||
<WatchWindow1>
|
<WatchWindow1>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>0</count>
|
<count>0</count>
|
||||||
|
@ -192,6 +175,21 @@
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>ad7124_analog</ItemText>
|
<ItemText>ad7124_analog</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>5</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>lcd_makecurve_data</ItemText>
|
||||||
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>6</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>uart_makecurve_data</ItemText>
|
||||||
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>7</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>test_num</ItemText>
|
||||||
|
</Ww>
|
||||||
</WatchWindow1>
|
</WatchWindow1>
|
||||||
<Tracepoint>
|
<Tracepoint>
|
||||||
<THDelay>0</THDelay>
|
<THDelay>0</THDelay>
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
[EXTDLL]
|
|
||||||
Count=0
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4,6 +4,7 @@
|
||||||
#include "tim.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};
|
||||||
|
lcd_makecurve_t lcd_makecurve_data = {0};
|
||||||
extern float current_buff[2];
|
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};
|
||||||
|
|
||||||
|
@ -12,7 +13,6 @@ static void uart_lcd_current_channel2(void);
|
||||||
|
|
||||||
static void uart_lcd_current_channel1(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));
|
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};
|
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};
|
||||||
|
@ -63,6 +63,8 @@ void uart_lcd_draw_ipaddr(void)
|
||||||
void uart_lcd_init(void)
|
void uart_lcd_init(void)
|
||||||
{
|
{
|
||||||
uart_lcd_state.page_num = 0;
|
uart_lcd_state.page_num = 0;
|
||||||
|
uart_lcd_page_switch(uart_lcd_state.page_num); // 切换到第一个页面
|
||||||
|
|
||||||
uart_lcd_state.key_state[0] = 0;
|
uart_lcd_state.key_state[0] = 0;
|
||||||
uart_lcd_state.key_state[1] = 1;
|
uart_lcd_state.key_state[1] = 1;
|
||||||
uart_lcd_state.key_state[2] = 0;
|
uart_lcd_state.key_state[2] = 0;
|
||||||
|
@ -73,6 +75,13 @@ void uart_lcd_init(void)
|
||||||
uart_lcd_current_out(0);
|
uart_lcd_current_out(0);
|
||||||
HAL_Delay(10);
|
HAL_Delay(10);
|
||||||
uart_lcd_current_out(1);
|
uart_lcd_current_out(1);
|
||||||
|
lcd_makecurve_data.cmd_head = 0xEE; // 帧头
|
||||||
|
lcd_makecurve_data.cmd_type = 0xB1; // 命令类型
|
||||||
|
lcd_makecurve_data.cmd_ctrl_type = 0x32; // 写曲线数据
|
||||||
|
lcd_makecurve_data.cmd_page_id = 0x01; // 画面ID
|
||||||
|
lcd_makecurve_data.cmd_ctrl_id = 0x0E; // 控件ID
|
||||||
|
lcd_makecurve_data.cmd_curve_channel = 0x00; // 曲线通道
|
||||||
|
lcd_makecurve_data.cmd_tail = 0xFFFCFFFF; // 帧尾
|
||||||
}
|
}
|
||||||
uint8_t lcd_channel[15] = {0xEE, 0xB1, 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFC, 0xFF, 0xFF};
|
uint8_t lcd_channel[15] = {0xEE, 0xB1, 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFC, 0xFF, 0xFF};
|
||||||
|
|
||||||
|
@ -131,7 +140,7 @@ void uart_lcd_ecll_control_current_out(void)
|
||||||
if (ec11_data.confirm_key_flag == 0)
|
if (ec11_data.confirm_key_flag == 0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else if (ec11_data.confirm_key_flag == 1) // 确认按键确认电流输出
|
else if (ec11_data.confirm_key_flag == 1) // Confirm button - confirms current output
|
||||||
{
|
{
|
||||||
ec11_data.confirm_key_flag_last++;
|
ec11_data.confirm_key_flag_last++;
|
||||||
if (ec11_data.confirm_key_flag_last > 2)
|
if (ec11_data.confirm_key_flag_last > 2)
|
||||||
|
@ -142,7 +151,7 @@ void uart_lcd_ecll_control_current_out(void)
|
||||||
ec11_data.confirm_key_flag = 0;
|
ec11_data.confirm_key_flag = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ec11_data.confirm_key_flag == 2) // 切换通道按键确认状<EFBFBD>??
|
else if (ec11_data.confirm_key_flag == 2) // Switch the current output channel
|
||||||
{
|
{
|
||||||
ec11_data.confirm_key_flag_last++;
|
ec11_data.confirm_key_flag_last++;
|
||||||
if (ec11_data.confirm_key_flag_last > 2)
|
if (ec11_data.confirm_key_flag_last > 2)
|
||||||
|
@ -238,3 +247,42 @@ void uart_lcd_ec11_control_current(void)
|
||||||
ec11_data.encode_num_last = ec11_data.encode_num;
|
ec11_data.encode_num_last = ec11_data.encode_num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
uint8_t uart_makecurve_data[128] = {0};
|
||||||
|
void uart_lcd_makecurvet(lcd_makecurve_t *makecurve_data)
|
||||||
|
{
|
||||||
|
|
||||||
|
uart_makecurve_data[0] = makecurve_data->cmd_head; // 帧头
|
||||||
|
uart_makecurve_data[1] = makecurve_data->cmd_type; // 命令类型
|
||||||
|
uart_makecurve_data[2] = makecurve_data->cmd_ctrl_type; // 控制类型
|
||||||
|
uart_makecurve_data[3] = (makecurve_data->cmd_page_id >> 8) & 0xFF; // 画面ID高位地址
|
||||||
|
uart_makecurve_data[4] = makecurve_data->cmd_page_id & 0xFF; // 画面ID低位地址
|
||||||
|
uart_makecurve_data[5] = (makecurve_data->cmd_ctrl_id >> 8) & 0xFF; // 控件ID高位地址
|
||||||
|
uart_makecurve_data[6] = makecurve_data->cmd_ctrl_id & 0xFF; // 控件ID低位地址
|
||||||
|
uart_makecurve_data[7] = makecurve_data->cmd_curve_channel; // 曲线通道
|
||||||
|
uart_makecurve_data[8] = (makecurve_data->cmd_data_len >> 8) & 0xFF; // 数据长度高位地址
|
||||||
|
uart_makecurve_data[9] = makecurve_data->cmd_data_len & 0xFF; // 数据长度低位地址
|
||||||
|
MEMCPY(uart_makecurve_data + 10, makecurve_data->cmd_data, makecurve_data->cmd_data_len); // 数据内容
|
||||||
|
uart_makecurve_data[10 + makecurve_data->cmd_data_len] = (makecurve_data->cmd_tail >> 24) & 0xFF; // 帧尾
|
||||||
|
uart_makecurve_data[11 + makecurve_data->cmd_data_len] = (makecurve_data->cmd_tail >> 16) & 0xFF; // 帧尾
|
||||||
|
uart_makecurve_data[12 + makecurve_data->cmd_data_len] = (makecurve_data->cmd_tail >> 8) & 0xFF; // 帧尾
|
||||||
|
uart_makecurve_data[13 + makecurve_data->cmd_data_len] = makecurve_data->cmd_tail & 0xFF; // 帧尾
|
||||||
|
|
||||||
|
dma_usart_send(&huart4, uart_makecurve_data, makecurve_data->cmd_data_len + 14);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_lcd_makecurve_test(void)
|
||||||
|
{
|
||||||
|
lcd_makecurve_data.cmd_data_len = 1; // 假设数据长度为1
|
||||||
|
static uint8_t test_num = 0;
|
||||||
|
// if (uart_lcd_state.page_num == 1)
|
||||||
|
{
|
||||||
|
test_num++;
|
||||||
|
if (test_num > 100)
|
||||||
|
{
|
||||||
|
test_num = 0; // 重置计数器
|
||||||
|
}
|
||||||
|
lcd_makecurve_data.cmd_data[0] = test_num / 10 * 10; // 填充数据内容
|
||||||
|
|
||||||
|
uart_lcd_makecurvet(&lcd_makecurve_data); // 调用函数发送数据
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* @Author: wangxujie wangxujie@wuxismart.com
|
* @Author: wangxujie wangxujie@wuxismart.com
|
||||||
* @Date: 2025-03-10 15:05:20
|
* @Date: 2025-03-10 15:05:20
|
||||||
* @LastEditors: wangxujie wangxujie@wuxismart.com
|
* @LastEditors: wangxujie wangxujie@wuxismart.com
|
||||||
* @LastEditTime: 2025-07-28 16:17:11
|
* @LastEditTime: 2025-07-29 15:28:31
|
||||||
* @FilePath: \signal_generator\User\driver\uart_lcd.h
|
* @FilePath: \signal_generator\User\driver\uart_lcd.h
|
||||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||||
*/
|
*/
|
||||||
|
@ -10,7 +10,21 @@
|
||||||
#define __UART_LCD_H__
|
#define __UART_LCD_H__
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t cmd_head; // 帧头
|
||||||
|
uint8_t cmd_type; // 命令类型
|
||||||
|
uint8_t cmd_ctrl_type; // 控制类型
|
||||||
|
uint16_t cmd_page_id; // 画面ID
|
||||||
|
uint16_t cmd_ctrl_id; // 控件ID
|
||||||
|
|
||||||
|
uint8_t cmd_curve_channel; // 曲线通道
|
||||||
|
uint16_t cmd_data_len; // 数据长度
|
||||||
|
uint8_t cmd_data[256]; // 数据内容
|
||||||
|
|
||||||
|
uint32_t cmd_tail; // 帧尾
|
||||||
|
} lcd_makecurve_t; // lcd绘制曲线结构体
|
||||||
|
extern lcd_makecurve_t lcd_makecurve_data;
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint8_t page_num;
|
uint8_t page_num;
|
||||||
|
@ -36,4 +50,6 @@ void uart_lcd_channel_switch(uint8_t channel);
|
||||||
void uart_lcd_page_switch(uint8_t page);
|
void uart_lcd_page_switch(uint8_t page);
|
||||||
void uart_lcd_ecll_control_current_out(void);
|
void uart_lcd_ecll_control_current_out(void);
|
||||||
void uart_lcd_ec11_control_current(void);
|
void uart_lcd_ec11_control_current(void);
|
||||||
|
void uart_lcd_makecurvet(lcd_makecurve_t *makecurve_data);
|
||||||
|
void uart_lcd_makecurve_test(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue