Compare commits
10 Commits
c5774f328e
...
b399ccf974
Author | SHA1 | Date |
---|---|---|
|
b399ccf974 | |
|
76b2ac39f2 | |
|
e23fe78a83 | |
|
c4cbbdcd38 | |
|
d458a3e88f | |
|
2e4b25888a | |
|
472ebda0a7 | |
|
2b5868bfff | |
|
26a0e48da3 | |
|
10a92ef376 |
|
@ -99,6 +99,8 @@ void Error_Handler(void);
|
||||||
#define DI_CH6_GPIO_Port GPIOE
|
#define DI_CH6_GPIO_Port GPIOE
|
||||||
#define ETH_RESET_Pin GPIO_PIN_0
|
#define ETH_RESET_Pin GPIO_PIN_0
|
||||||
#define ETH_RESET_GPIO_Port GPIOC
|
#define ETH_RESET_GPIO_Port GPIOC
|
||||||
|
#define T3_CH3_BUZZER_Pin GPIO_PIN_0
|
||||||
|
#define T3_CH3_BUZZER_GPIO_Port GPIOB
|
||||||
#define LED3_R_Pin GPIO_PIN_1
|
#define LED3_R_Pin GPIO_PIN_1
|
||||||
#define LED3_R_GPIO_Port GPIOB
|
#define LED3_R_GPIO_Port GPIOB
|
||||||
#define LED3_G_Pin GPIO_PIN_2
|
#define LED3_G_Pin GPIO_PIN_2
|
||||||
|
|
|
@ -62,7 +62,6 @@ void DMA1_Stream4_IRQHandler(void);
|
||||||
void DMA1_Stream5_IRQHandler(void);
|
void DMA1_Stream5_IRQHandler(void);
|
||||||
void DMA1_Stream6_IRQHandler(void);
|
void DMA1_Stream6_IRQHandler(void);
|
||||||
void EXTI9_5_IRQHandler(void);
|
void EXTI9_5_IRQHandler(void);
|
||||||
void TIM3_IRQHandler(void);
|
|
||||||
void TIM4_IRQHandler(void);
|
void TIM4_IRQHandler(void);
|
||||||
void USART1_IRQHandler(void);
|
void USART1_IRQHandler(void);
|
||||||
void USART2_IRQHandler(void);
|
void USART2_IRQHandler(void);
|
||||||
|
|
|
@ -73,18 +73,18 @@ uint8_t di_state_last[DI_MAX] = {0};
|
||||||
uint8_t di_state_now[DI_MAX] = {0};
|
uint8_t di_state_now[DI_MAX] = {0};
|
||||||
/* USER CODE END FunctionPrototypes */
|
/* USER CODE END FunctionPrototypes */
|
||||||
|
|
||||||
void start_tcp_task(void const *argument);
|
void start_tcp_task(void const * argument);
|
||||||
void start_led_toggle_task(void const *argument);
|
void start_led_toggle_task(void const * argument);
|
||||||
void start_dac_task(void const *argument);
|
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);
|
||||||
|
|
||||||
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) */
|
||||||
|
|
||||||
/* GetIdleTaskMemory prototype (linked to static allocation support) */
|
/* GetIdleTaskMemory prototype (linked to static allocation support) */
|
||||||
void vApplicationGetIdleTaskMemory(StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize);
|
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize );
|
||||||
|
|
||||||
/* USER CODE BEGIN GET_IDLE_TASK_MEMORY */
|
/* USER CODE BEGIN GET_IDLE_TASK_MEMORY */
|
||||||
static StaticTask_t xIdleTaskTCBBuffer;
|
static StaticTask_t xIdleTaskTCBBuffer;
|
||||||
|
@ -100,12 +100,11 @@ void vApplicationGetIdleTaskMemory(StaticTask_t **ppxIdleTaskTCBBuffer, StackTyp
|
||||||
/* USER CODE END GET_IDLE_TASK_MEMORY */
|
/* USER CODE END GET_IDLE_TASK_MEMORY */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief FreeRTOS initialization
|
* @brief FreeRTOS initialization
|
||||||
* @param None
|
* @param None
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void MX_FREERTOS_Init(void)
|
void MX_FREERTOS_Init(void) {
|
||||||
{
|
|
||||||
/* USER CODE BEGIN Init */
|
/* USER CODE BEGIN Init */
|
||||||
|
|
||||||
/* USER CODE END Init */
|
/* USER CODE END Init */
|
||||||
|
@ -154,6 +153,7 @@ void MX_FREERTOS_Init(void)
|
||||||
/* USER CODE BEGIN RTOS_THREADS */
|
/* USER CODE BEGIN RTOS_THREADS */
|
||||||
/* add threads, ... */
|
/* add threads, ... */
|
||||||
/* USER CODE END RTOS_THREADS */
|
/* USER CODE END RTOS_THREADS */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* USER CODE BEGIN Header_start_tcp_task */
|
/* USER CODE BEGIN Header_start_tcp_task */
|
||||||
|
@ -163,7 +163,7 @@ void MX_FREERTOS_Init(void)
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
/* USER CODE END Header_start_tcp_task */
|
/* USER CODE END Header_start_tcp_task */
|
||||||
void start_tcp_task(void const *argument)
|
void start_tcp_task(void const * argument)
|
||||||
{
|
{
|
||||||
/* init code for LWIP */
|
/* init code for LWIP */
|
||||||
MX_LWIP_Init();
|
MX_LWIP_Init();
|
||||||
|
@ -185,7 +185,7 @@ void start_tcp_task(void const *argument)
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
/* USER CODE END Header_start_led_toggle_task */
|
/* USER CODE END Header_start_led_toggle_task */
|
||||||
void start_led_toggle_task(void const *argument)
|
void start_led_toggle_task(void const * argument)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN start_led_toggle_task */
|
/* USER CODE BEGIN start_led_toggle_task */
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
|
@ -204,7 +204,7 @@ void start_led_toggle_task(void const *argument)
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
/* USER CODE END Header_start_dac_task */
|
/* USER CODE END Header_start_dac_task */
|
||||||
void start_dac_task(void const *argument)
|
void start_dac_task(void const * argument)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN start_dac_task */
|
/* USER CODE BEGIN start_dac_task */
|
||||||
dac161s997_init();
|
dac161s997_init();
|
||||||
|
@ -227,7 +227,7 @@ void start_dac_task(void const *argument)
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
/* USER CODE END Header_start_adc_task */
|
/* USER CODE END Header_start_adc_task */
|
||||||
void start_adc_task(void const *argument)
|
void start_adc_task(void const * argument)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN start_adc_task */
|
/* USER CODE BEGIN start_adc_task */
|
||||||
ad7124_setup();
|
ad7124_setup();
|
||||||
|
@ -262,7 +262,7 @@ void start_adc_task(void const *argument)
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
/* USER CODE END Header_start_gpio_di_do_task */
|
/* USER CODE END Header_start_gpio_di_do_task */
|
||||||
void start_gpio_di_do_task(void const *argument)
|
void start_gpio_di_do_task(void const * argument)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN start_gpio_di_do_task */
|
/* USER CODE BEGIN start_gpio_di_do_task */
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
|
@ -273,9 +273,9 @@ void start_gpio_di_do_task(void const *argument)
|
||||||
uint8_t tx_data_len = 7 + DI_MAX;
|
uint8_t tx_data_len = 7 + DI_MAX;
|
||||||
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; // 状态码
|
tx_data[1] = COM_OK; // 状æ?<3F>ç <C3A7>
|
||||||
tx_data[2] = DEVICE_NUM; // 设备号
|
tx_data[2] = DEVICE_NUM; // 设备å<EFBFBD>?
|
||||||
tx_data[3] = SEND_STATE_CMD; // 命令号
|
tx_data[3] = SEND_STATE_CMD; // 命令å<EFBFBD>?
|
||||||
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++)
|
||||||
{
|
{
|
||||||
|
@ -310,7 +310,7 @@ void start_gpio_di_do_task(void const *argument)
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
/* USER CODE END Header_start_ec11_task */
|
/* USER CODE END Header_start_ec11_task */
|
||||||
void start_ec11_task(void const *argument)
|
void start_ec11_task(void const * argument)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN start_ec11_task */
|
/* USER CODE BEGIN start_ec11_task */
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
#include "lwip/tcp.h"
|
#include "lwip/tcp.h"
|
||||||
#include "ad7124.h"
|
#include "ad7124.h"
|
||||||
#include "ht1200m.h"
|
#include "ht1200m.h"
|
||||||
|
#include "uart_lcd.h"
|
||||||
|
#include "user_flash.h"
|
||||||
/* USER CODE END Includes */
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
|
@ -79,6 +81,9 @@ uint8_t tcp_echo_flags_ble1 = 0;
|
||||||
uint8_t tcp_echo_flags_ble2 = 0;
|
uint8_t tcp_echo_flags_ble2 = 0;
|
||||||
uint8_t tcp_echo_flags_control = 0;
|
uint8_t tcp_echo_flags_control = 0;
|
||||||
uint8_t send_data_flag_cmd = 0;
|
uint8_t send_data_flag_cmd = 0;
|
||||||
|
|
||||||
|
extern struct netif gnetif;
|
||||||
|
extern ip4_addr_t ipaddr;
|
||||||
/* USER CODE END 0 */
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,17 +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 */
|
||||||
// HAL_GPIO_WritePin(DO_EN_GPIO_Port, DO_EN_Pin, GPIO_PIN_SET); // DO输出使能
|
/*配置各串口的DMA接收*/
|
||||||
|
// 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));
|
||||||
hart_ht1200m_reset(); // 初始化HT1200M模块
|
// end
|
||||||
HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1); // PWM输出,用于驱动HT1200M模块
|
hart_ht1200m_reset(); // 初始化HT1200M模块
|
||||||
HAL_TIM_Encoder_Start(&htim1, TIM_CHANNEL_ALL);
|
HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1); // PWM输出,用于驱动HT1200M模块
|
||||||
|
HAL_TIM_Encoder_Start(&htim1, TIM_CHANNEL_ALL); // 旋转编码器输<E599A8><E8BE93>?
|
||||||
/* 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) */
|
||||||
|
@ -207,8 +213,14 @@ 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(&huart1, usb_uart1.rx_data_temp, usb_uart1.rx_num);
|
// 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地址修改处理
|
||||||
|
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;
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
|
@ -217,7 +229,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(&huart1, lcd_uart4.rx_data_temp, lcd_uart4.rx_num);
|
|
||||||
// dma_usart_send(&huart4, lcd_uart4.rx_data_temp, lcd_uart4.rx_num);
|
// dma_usart_send(&huart4, lcd_uart4.rx_data_temp, lcd_uart4.rx_num);
|
||||||
}
|
}
|
||||||
if (huart == &huart6)
|
if (huart == &huart6)
|
||||||
|
|
|
@ -78,7 +78,7 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* spiHandle)
|
||||||
*/
|
*/
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5;
|
GPIO_InitStruct.Pin = GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
GPIO_InitStruct.Alternate = GPIO_AF5_SPI1;
|
GPIO_InitStruct.Alternate = GPIO_AF5_SPI1;
|
||||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
|
@ -38,6 +38,7 @@ extern struct tcp_pcb *server_pcb_hart1;
|
||||||
extern struct tcp_pcb *server_pcb_hart2;
|
extern struct tcp_pcb *server_pcb_hart2;
|
||||||
extern struct tcp_pcb *server_pcb_ble1;
|
extern struct tcp_pcb *server_pcb_ble1;
|
||||||
extern struct tcp_pcb *server_pcb_ble2;
|
extern struct tcp_pcb *server_pcb_ble2;
|
||||||
|
uint8_t buzzer_flag = 0;
|
||||||
/* USER CODE END PD */
|
/* USER CODE END PD */
|
||||||
|
|
||||||
/* Private macro -------------------------------------------------------------*/
|
/* Private macro -------------------------------------------------------------*/
|
||||||
|
@ -62,7 +63,6 @@ extern struct tcp_pcb *server_pcb_ble2;
|
||||||
|
|
||||||
/* External variables --------------------------------------------------------*/
|
/* External variables --------------------------------------------------------*/
|
||||||
extern ETH_HandleTypeDef heth;
|
extern ETH_HandleTypeDef heth;
|
||||||
extern TIM_HandleTypeDef htim3;
|
|
||||||
extern DMA_HandleTypeDef hdma_uart4_rx;
|
extern DMA_HandleTypeDef hdma_uart4_rx;
|
||||||
extern DMA_HandleTypeDef hdma_uart4_tx;
|
extern DMA_HandleTypeDef hdma_uart4_tx;
|
||||||
extern DMA_HandleTypeDef hdma_uart5_tx;
|
extern DMA_HandleTypeDef hdma_uart5_tx;
|
||||||
|
@ -321,24 +321,19 @@ 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 (buzzer_flag == 1)
|
||||||
|
{
|
||||||
|
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3); // 蜂鸣器PWM输出,用于蜂鸣器发声
|
||||||
|
buzzer_flag = 0;
|
||||||
|
}
|
||||||
|
else if (buzzer_flag == 0)
|
||||||
|
{
|
||||||
|
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
||||||
|
buzzer_flag = 1;
|
||||||
|
}
|
||||||
/* USER CODE END EXTI9_5_IRQn 1 */
|
/* USER CODE END EXTI9_5_IRQn 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function handles TIM3 global interrupt.
|
|
||||||
*/
|
|
||||||
void TIM3_IRQHandler(void)
|
|
||||||
{
|
|
||||||
/* USER CODE BEGIN TIM3_IRQn 0 */
|
|
||||||
|
|
||||||
/* USER CODE END TIM3_IRQn 0 */
|
|
||||||
HAL_TIM_IRQHandler(&htim3);
|
|
||||||
/* USER CODE BEGIN TIM3_IRQn 1 */
|
|
||||||
|
|
||||||
/* USER CODE END TIM3_IRQn 1 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles TIM4 global interrupt.
|
* @brief This function handles TIM4 global interrupt.
|
||||||
*/
|
*/
|
||||||
|
@ -373,24 +368,6 @@ void USART1_IRQHandler(void)
|
||||||
void USART2_IRQHandler(void)
|
void USART2_IRQHandler(void)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN USART2_IRQn 0 */
|
/* USER CODE BEGIN USART2_IRQn 0 */
|
||||||
// uint8_t receive_data = 0;
|
|
||||||
// if (__HAL_UART_GET_FLAG(&huart2, UART_FLAG_RXNE) != RESET)
|
|
||||||
// {
|
|
||||||
// HAL_UART_Receive(&huart2, &receive_data, 1, 10);
|
|
||||||
// hart2_uart2.rx_data[hart2_uart2.rx_num] = receive_data;
|
|
||||||
// hart2_uart2.rx_num++;
|
|
||||||
// __HAL_UART_CLEAR_IDLEFLAG(&huart2);
|
|
||||||
// }
|
|
||||||
// // 空闲中断
|
|
||||||
// if (__HAL_UART_GET_FLAG(&huart2, UART_FLAG_IDLE) != RESET)
|
|
||||||
// {
|
|
||||||
// if (tcp_echo_flags_hart2 == 1)
|
|
||||||
// {
|
|
||||||
// user_send_data_hart2(hart2_uart2.rx_data, hart2_uart2.rx_num);
|
|
||||||
// }
|
|
||||||
// hart2_uart2.rx_num = 0;
|
|
||||||
// __HAL_UART_CLEAR_IDLEFLAG(&huart2);
|
|
||||||
// }
|
|
||||||
/* USER CODE END USART2_IRQn 0 */
|
/* USER CODE END USART2_IRQn 0 */
|
||||||
HAL_UART_IRQHandler(&huart2);
|
HAL_UART_IRQHandler(&huart2);
|
||||||
/* USER CODE BEGIN USART2_IRQn 1 */
|
/* USER CODE BEGIN USART2_IRQn 1 */
|
||||||
|
@ -418,15 +395,7 @@ void USART3_IRQHandler(void)
|
||||||
void DMA1_Stream7_IRQHandler(void)
|
void DMA1_Stream7_IRQHandler(void)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN DMA1_Stream7_IRQn 0 */
|
/* USER CODE BEGIN DMA1_Stream7_IRQn 0 */
|
||||||
// if (__HAL_DMA_GET_FLAG(&hdma_uart5_tx, DMA_FLAG_TCIF3_7) != RESET)
|
|
||||||
// {
|
|
||||||
// uint8_t i = 0;
|
|
||||||
// for (i = 0; i < 200; i++)
|
|
||||||
// {
|
|
||||||
// HART1_RTS_SEND;
|
|
||||||
// }
|
|
||||||
// HART1_RTS_RECEIVE;
|
|
||||||
// }
|
|
||||||
/* USER CODE END DMA1_Stream7_IRQn 0 */
|
/* USER CODE END DMA1_Stream7_IRQn 0 */
|
||||||
HAL_DMA_IRQHandler(&hdma_uart5_tx);
|
HAL_DMA_IRQHandler(&hdma_uart5_tx);
|
||||||
/* USER CODE BEGIN DMA1_Stream7_IRQn 1 */
|
/* USER CODE BEGIN DMA1_Stream7_IRQn 1 */
|
||||||
|
@ -453,24 +422,6 @@ void UART4_IRQHandler(void)
|
||||||
void UART5_IRQHandler(void)
|
void UART5_IRQHandler(void)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN UART5_IRQn 0 */
|
/* USER CODE BEGIN UART5_IRQn 0 */
|
||||||
// uint8_t receive_data = 0;
|
|
||||||
// if (__HAL_UART_GET_FLAG(&huart5, UART_FLAG_RXNE) != RESET)
|
|
||||||
// {
|
|
||||||
// HAL_UART_Receive(&huart5, &receive_data, 1, 1);
|
|
||||||
// hart1_uart5.rx_data[hart1_uart5.rx_num] = receive_data;
|
|
||||||
// hart1_uart5.rx_num++;
|
|
||||||
// __HAL_UART_CLEAR_IDLEFLAG(&huart5);
|
|
||||||
// }
|
|
||||||
// // 空闲中断
|
|
||||||
// if (__HAL_UART_GET_FLAG(&huart5, UART_FLAG_IDLE) != RESET)
|
|
||||||
// {
|
|
||||||
// if (tcp_echo_flags_hart1 == 1)
|
|
||||||
// {
|
|
||||||
// user_send_data_hart1(hart1_uart5.rx_data, hart1_uart5.rx_num);
|
|
||||||
// }
|
|
||||||
// hart1_uart5.rx_num = 0;
|
|
||||||
// __HAL_UART_CLEAR_IDLEFLAG(&huart5);
|
|
||||||
// }
|
|
||||||
/* USER CODE END UART5_IRQn 0 */
|
/* USER CODE END UART5_IRQn 0 */
|
||||||
HAL_UART_IRQHandler(&huart5);
|
HAL_UART_IRQHandler(&huart5);
|
||||||
/* USER CODE BEGIN UART5_IRQn 1 */
|
/* USER CODE BEGIN UART5_IRQn 1 */
|
||||||
|
|
|
@ -137,16 +137,17 @@ void MX_TIM3_Init(void)
|
||||||
|
|
||||||
TIM_ClockConfigTypeDef sClockSourceConfig = {0};
|
TIM_ClockConfigTypeDef sClockSourceConfig = {0};
|
||||||
TIM_MasterConfigTypeDef sMasterConfig = {0};
|
TIM_MasterConfigTypeDef sMasterConfig = {0};
|
||||||
|
TIM_OC_InitTypeDef sConfigOC = {0};
|
||||||
|
|
||||||
/* USER CODE BEGIN TIM3_Init 1 */
|
/* USER CODE BEGIN TIM3_Init 1 */
|
||||||
|
|
||||||
/* USER CODE END TIM3_Init 1 */
|
/* USER CODE END TIM3_Init 1 */
|
||||||
htim3.Instance = TIM3;
|
htim3.Instance = TIM3;
|
||||||
htim3.Init.Prescaler = 55295;
|
htim3.Init.Prescaler = 54;
|
||||||
htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
|
htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||||
htim3.Init.Period = 999;
|
htim3.Init.Period = 370;
|
||||||
htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||||
htim3.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE;
|
htim3.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||||
if (HAL_TIM_Base_Init(&htim3) != HAL_OK)
|
if (HAL_TIM_Base_Init(&htim3) != HAL_OK)
|
||||||
{
|
{
|
||||||
Error_Handler();
|
Error_Handler();
|
||||||
|
@ -156,15 +157,28 @@ void MX_TIM3_Init(void)
|
||||||
{
|
{
|
||||||
Error_Handler();
|
Error_Handler();
|
||||||
}
|
}
|
||||||
|
if (HAL_TIM_PWM_Init(&htim3) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
|
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
|
||||||
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
||||||
if (HAL_TIMEx_MasterConfigSynchronization(&htim3, &sMasterConfig) != HAL_OK)
|
if (HAL_TIMEx_MasterConfigSynchronization(&htim3, &sMasterConfig) != HAL_OK)
|
||||||
{
|
{
|
||||||
Error_Handler();
|
Error_Handler();
|
||||||
}
|
}
|
||||||
|
sConfigOC.OCMode = TIM_OCMODE_PWM1;
|
||||||
|
sConfigOC.Pulse = 92;
|
||||||
|
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
|
||||||
|
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
|
||||||
|
if (HAL_TIM_PWM_ConfigChannel(&htim3, &sConfigOC, TIM_CHANNEL_3) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
/* USER CODE BEGIN TIM3_Init 2 */
|
/* USER CODE BEGIN TIM3_Init 2 */
|
||||||
HAL_TIM_Base_Start_IT(&htim3);
|
HAL_TIM_Base_Start_IT(&htim3);
|
||||||
/* USER CODE END TIM3_Init 2 */
|
/* USER CODE END TIM3_Init 2 */
|
||||||
|
HAL_TIM_MspPostInit(&htim3);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,10 +233,6 @@ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle)
|
||||||
/* USER CODE END TIM3_MspInit 0 */
|
/* USER CODE END TIM3_MspInit 0 */
|
||||||
/* TIM3 clock enable */
|
/* TIM3 clock enable */
|
||||||
__HAL_RCC_TIM3_CLK_ENABLE();
|
__HAL_RCC_TIM3_CLK_ENABLE();
|
||||||
|
|
||||||
/* TIM3 interrupt Init */
|
|
||||||
HAL_NVIC_SetPriority(TIM3_IRQn, 5, 0);
|
|
||||||
HAL_NVIC_EnableIRQ(TIM3_IRQn);
|
|
||||||
/* USER CODE BEGIN TIM3_MspInit 1 */
|
/* USER CODE BEGIN TIM3_MspInit 1 */
|
||||||
|
|
||||||
/* USER CODE END TIM3_MspInit 1 */
|
/* USER CODE END TIM3_MspInit 1 */
|
||||||
|
@ -237,7 +247,6 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* timHandle)
|
||||||
/* USER CODE BEGIN TIM2_MspPostInit 0 */
|
/* USER CODE BEGIN TIM2_MspPostInit 0 */
|
||||||
|
|
||||||
/* USER CODE END TIM2_MspPostInit 0 */
|
/* USER CODE END TIM2_MspPostInit 0 */
|
||||||
|
|
||||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||||
/**TIM2 GPIO Configuration
|
/**TIM2 GPIO Configuration
|
||||||
PA15 ------> TIM2_CH1
|
PA15 ------> TIM2_CH1
|
||||||
|
@ -253,6 +262,27 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* timHandle)
|
||||||
|
|
||||||
/* USER CODE END TIM2_MspPostInit 1 */
|
/* USER CODE END TIM2_MspPostInit 1 */
|
||||||
}
|
}
|
||||||
|
else if(timHandle->Instance==TIM3)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM3_MspPostInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM3_MspPostInit 0 */
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||||
|
/**TIM3 GPIO Configuration
|
||||||
|
PB0 ------> TIM3_CH3
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = T3_CH3_BUZZER_Pin;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF2_TIM3;
|
||||||
|
HAL_GPIO_Init(T3_CH3_BUZZER_GPIO_Port, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM3_MspPostInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM3_MspPostInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,9 +330,6 @@ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle)
|
||||||
/* USER CODE END TIM3_MspDeInit 0 */
|
/* USER CODE END TIM3_MspDeInit 0 */
|
||||||
/* Peripheral clock disable */
|
/* Peripheral clock disable */
|
||||||
__HAL_RCC_TIM3_CLK_DISABLE();
|
__HAL_RCC_TIM3_CLK_DISABLE();
|
||||||
|
|
||||||
/* TIM3 interrupt Deinit */
|
|
||||||
HAL_NVIC_DisableIRQ(TIM3_IRQn);
|
|
||||||
/* USER CODE BEGIN TIM3_MspDeInit 1 */
|
/* USER CODE BEGIN TIM3_MspDeInit 1 */
|
||||||
|
|
||||||
/* USER CODE END TIM3_MspDeInit 1 */
|
/* USER CODE END TIM3_MspDeInit 1 */
|
||||||
|
|
Binary file not shown.
|
@ -22,13 +22,13 @@
|
||||||
#include "lwip.h"
|
#include "lwip.h"
|
||||||
#include "lwip/init.h"
|
#include "lwip/init.h"
|
||||||
#include "lwip/netif.h"
|
#include "lwip/netif.h"
|
||||||
#if defined(__CC_ARM) /* MDK ARM Compiler */
|
#if defined ( __CC_ARM ) /* MDK ARM Compiler */
|
||||||
#include "lwip/sio.h"
|
#include "lwip/sio.h"
|
||||||
#endif /* MDK ARM Compiler */
|
#endif /* MDK ARM Compiler */
|
||||||
#include "ethernetif.h"
|
#include "ethernetif.h"
|
||||||
|
|
||||||
/* USER CODE BEGIN 0 */
|
/* USER CODE BEGIN 0 */
|
||||||
|
#include "user_flash.h"
|
||||||
/* USER CODE END 0 */
|
/* USER CODE END 0 */
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
static void ethernet_link_status_updated(struct netif *netif);
|
static void ethernet_link_status_updated(struct netif *netif);
|
||||||
|
@ -53,8 +53,8 @@ uint8_t GATEWAY_ADDRESS[4];
|
||||||
/* USER CODE END 2 */
|
/* USER CODE END 2 */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LwIP initialization function
|
* LwIP initialization function
|
||||||
*/
|
*/
|
||||||
void MX_LWIP_Init(void)
|
void MX_LWIP_Init(void)
|
||||||
{
|
{
|
||||||
/* IP addresses initialization */
|
/* IP addresses initialization */
|
||||||
|
@ -71,15 +71,15 @@ void MX_LWIP_Init(void)
|
||||||
GATEWAY_ADDRESS[2] = 1;
|
GATEWAY_ADDRESS[2] = 1;
|
||||||
GATEWAY_ADDRESS[3] = 29;
|
GATEWAY_ADDRESS[3] = 29;
|
||||||
|
|
||||||
/* USER CODE BEGIN IP_ADDRESSES */
|
/* USER CODE BEGIN IP_ADDRESSES */
|
||||||
/* USER CODE END IP_ADDRESSES */
|
/* USER CODE END IP_ADDRESSES */
|
||||||
|
|
||||||
/* Initilialize the LwIP stack with RTOS */
|
/* Initilialize the LwIP stack with RTOS */
|
||||||
tcpip_init(NULL, NULL);
|
tcpip_init( NULL, NULL );
|
||||||
|
|
||||||
/* IP addresses initialization without DHCP (IPv4) */
|
/* IP addresses initialization without DHCP (IPv4) */
|
||||||
IP4_ADDR(&ipaddr, IP_ADDRESS[0], IP_ADDRESS[1], IP_ADDRESS[2], IP_ADDRESS[3]);
|
IP4_ADDR(&ipaddr, IP_ADDRESS[0], IP_ADDRESS[1], IP_ADDRESS[2], IP_ADDRESS[3]);
|
||||||
IP4_ADDR(&netmask, NETMASK_ADDRESS[0], NETMASK_ADDRESS[1], NETMASK_ADDRESS[2], NETMASK_ADDRESS[3]);
|
IP4_ADDR(&netmask, NETMASK_ADDRESS[0], NETMASK_ADDRESS[1] , NETMASK_ADDRESS[2], NETMASK_ADDRESS[3]);
|
||||||
IP4_ADDR(&gw, GATEWAY_ADDRESS[0], GATEWAY_ADDRESS[1], GATEWAY_ADDRESS[2], GATEWAY_ADDRESS[3]);
|
IP4_ADDR(&gw, GATEWAY_ADDRESS[0], GATEWAY_ADDRESS[1], GATEWAY_ADDRESS[2], GATEWAY_ADDRESS[3]);
|
||||||
|
|
||||||
/* add the network interface (IPv4/IPv6) with RTOS */
|
/* add the network interface (IPv4/IPv6) with RTOS */
|
||||||
|
@ -103,14 +103,19 @@ void MX_LWIP_Init(void)
|
||||||
netif_set_link_callback(&gnetif, ethernet_link_status_updated);
|
netif_set_link_callback(&gnetif, ethernet_link_status_updated);
|
||||||
|
|
||||||
/* Create the Ethernet link handler thread */
|
/* Create the Ethernet link handler thread */
|
||||||
/* USER CODE BEGIN H7_OS_THREAD_DEF_CREATE_CMSIS_RTOS_V1 */
|
/* USER CODE BEGIN H7_OS_THREAD_DEF_CREATE_CMSIS_RTOS_V1 */
|
||||||
osThreadDef(EthLink, ethernet_link_thread, osPriorityBelowNormal, 0, configMINIMAL_STACK_SIZE * 2);
|
osThreadDef(EthLink, ethernet_link_thread, osPriorityBelowNormal, 0, configMINIMAL_STACK_SIZE * 2);
|
||||||
osThreadCreate(osThread(EthLink), &gnetif);
|
osThreadCreate(osThread(EthLink), &gnetif);
|
||||||
/* USER CODE END H7_OS_THREAD_DEF_CREATE_CMSIS_RTOS_V1 */
|
/* USER CODE END H7_OS_THREAD_DEF_CREATE_CMSIS_RTOS_V1 */
|
||||||
|
|
||||||
/* USER CODE BEGIN 3 */
|
/* USER CODE BEGIN 3 */
|
||||||
|
flash_read_data(FLASH_USER_START_ADDR, IP_ADDRESS, 4);
|
||||||
/* USER CODE END 3 */
|
if (IP_ADDRESS[0] == 192)
|
||||||
|
{
|
||||||
|
IP4_ADDR(&ipaddr, IP_ADDRESS[0], IP_ADDRESS[1], IP_ADDRESS[2], IP_ADDRESS[3]);
|
||||||
|
gnetif.ip_addr = ipaddr;
|
||||||
|
}
|
||||||
|
/* USER CODE END 3 */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_OBSOLETE_USER_CODE_SECTION_4
|
#ifdef USE_OBSOLETE_USER_CODE_SECTION_4
|
||||||
|
@ -121,25 +126,25 @@ void MX_LWIP_Init(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Notify the User about the network interface config status
|
* @brief Notify the User about the network interface config status
|
||||||
* @param netif: the network interface
|
* @param netif: the network interface
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
static void ethernet_link_status_updated(struct netif *netif)
|
static void ethernet_link_status_updated(struct netif *netif)
|
||||||
{
|
{
|
||||||
if (netif_is_up(netif))
|
if (netif_is_up(netif))
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN 5 */
|
/* USER CODE BEGIN 5 */
|
||||||
/* USER CODE END 5 */
|
/* USER CODE END 5 */
|
||||||
}
|
}
|
||||||
else /* netif is down */
|
else /* netif is down */
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN 6 */
|
/* USER CODE BEGIN 6 */
|
||||||
/* USER CODE END 6 */
|
/* USER CODE END 6 */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__CC_ARM) /* MDK ARM Compiler */
|
#if defined ( __CC_ARM ) /* MDK ARM Compiler */
|
||||||
/**
|
/**
|
||||||
* Opens a serial device for communication.
|
* Opens a serial device for communication.
|
||||||
*
|
*
|
||||||
|
@ -150,9 +155,9 @@ sio_fd_t sio_open(u8_t devnum)
|
||||||
{
|
{
|
||||||
sio_fd_t sd;
|
sio_fd_t sd;
|
||||||
|
|
||||||
/* USER CODE BEGIN 7 */
|
/* USER CODE BEGIN 7 */
|
||||||
sd = 0; // dummy code
|
sd = 0; // dummy code
|
||||||
/* USER CODE END 7 */
|
/* USER CODE END 7 */
|
||||||
|
|
||||||
return sd;
|
return sd;
|
||||||
}
|
}
|
||||||
|
@ -167,8 +172,8 @@ sio_fd_t sio_open(u8_t devnum)
|
||||||
*/
|
*/
|
||||||
void sio_send(u8_t c, sio_fd_t fd)
|
void sio_send(u8_t c, sio_fd_t fd)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN 8 */
|
/* USER CODE BEGIN 8 */
|
||||||
/* USER CODE END 8 */
|
/* USER CODE END 8 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -186,9 +191,9 @@ u32_t sio_read(sio_fd_t fd, u8_t *data, u32_t len)
|
||||||
{
|
{
|
||||||
u32_t recved_bytes;
|
u32_t recved_bytes;
|
||||||
|
|
||||||
/* USER CODE BEGIN 9 */
|
/* USER CODE BEGIN 9 */
|
||||||
recved_bytes = 0; // dummy code
|
recved_bytes = 0; // dummy code
|
||||||
/* USER CODE END 9 */
|
/* USER CODE END 9 */
|
||||||
return recved_bytes;
|
return recved_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,9 +210,10 @@ u32_t sio_tryread(sio_fd_t fd, u8_t *data, u32_t len)
|
||||||
{
|
{
|
||||||
u32_t recved_bytes;
|
u32_t recved_bytes;
|
||||||
|
|
||||||
/* USER CODE BEGIN 10 */
|
/* USER CODE BEGIN 10 */
|
||||||
recved_bytes = 0; // dummy code
|
recved_bytes = 0; // dummy code
|
||||||
/* USER CODE END 10 */
|
/* USER CODE END 10 */
|
||||||
return recved_bytes;
|
return recved_bytes;
|
||||||
}
|
}
|
||||||
#endif /* MDK ARM Compiler */
|
#endif /* MDK ARM Compiler */
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
/* USER CODE BEGIN Header */
|
/* USER CODE BEGIN Header */
|
||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* File Name : ethernetif.c
|
* File Name : ethernetif.c
|
||||||
* Description : This file provides code for the configuration
|
* @file ethernetif.c
|
||||||
* of the ethernetif.c MiddleWare.
|
* of the ethernetif.c MiddleWare.
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* Copyright (c) 2024 STMicroelectronics.
|
* Copyright (c) 2024 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This software is licensed under terms that can be found in the LICENSE file
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
* in the root directory of this software component.
|
* in the root directory of this software component.
|
||||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
/* USER CODE END Header */
|
/* USER CODE END Header */
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
#define TIME_WAITING_FOR_INPUT ( portMAX_DELAY )
|
#define TIME_WAITING_FOR_INPUT ( portMAX_DELAY )
|
||||||
/* USER CODE BEGIN OS_THREAD_STACK_SIZE_WITH_RTOS */
|
/* USER CODE BEGIN OS_THREAD_STACK_SIZE_WITH_RTOS */
|
||||||
/* Stack size of the interface thread */
|
/* Stack size of the interface thread */
|
||||||
#define INTERFACE_THREAD_STACK_SIZE ( 350 )
|
#define INTERFACE_THREAD_STACK_SIZE (350)
|
||||||
/* USER CODE END OS_THREAD_STACK_SIZE_WITH_RTOS */
|
/* USER CODE END OS_THREAD_STACK_SIZE_WITH_RTOS */
|
||||||
/* Network interface name */
|
/* Network interface name */
|
||||||
#define IFNAME0 's'
|
#define IFNAME0 's'
|
||||||
|
@ -202,7 +202,10 @@ static void low_level_init(struct netif *netif)
|
||||||
heth.Init.RxBuffLen = 1536;
|
heth.Init.RxBuffLen = 1536;
|
||||||
|
|
||||||
/* USER CODE BEGIN MACADDRESS */
|
/* USER CODE BEGIN MACADDRESS */
|
||||||
|
MACAddr[3] = (uint8_t)HAL_GetUIDw0();
|
||||||
|
MACAddr[4] = (uint8_t)HAL_GetUIDw1();
|
||||||
|
MACAddr[5] = (uint8_t)HAL_GetUIDw2();
|
||||||
|
heth.Init.MACAddr = &MACAddr[0];
|
||||||
/* USER CODE END MACADDRESS */
|
/* USER CODE END MACADDRESS */
|
||||||
|
|
||||||
hal_eth_init_status = HAL_ETH_Init(&heth);
|
hal_eth_init_status = HAL_ETH_Init(&heth);
|
||||||
|
@ -250,7 +253,7 @@ static void low_level_init(struct netif *netif)
|
||||||
/* create the task that handles the ETH_MAC */
|
/* create the task that handles the ETH_MAC */
|
||||||
/* USER CODE BEGIN OS_THREAD_DEF_CREATE_CMSIS_RTOS_V1 */
|
/* USER CODE BEGIN OS_THREAD_DEF_CREATE_CMSIS_RTOS_V1 */
|
||||||
osThreadDef(EthIf, ethernetif_input, osPriorityRealtime, 0, INTERFACE_THREAD_STACK_SIZE);
|
osThreadDef(EthIf, ethernetif_input, osPriorityRealtime, 0, INTERFACE_THREAD_STACK_SIZE);
|
||||||
osThreadCreate (osThread(EthIf), netif);
|
osThreadCreate(osThread(EthIf), netif);
|
||||||
/* USER CODE END OS_THREAD_DEF_CREATE_CMSIS_RTOS_V1 */
|
/* USER CODE END OS_THREAD_DEF_CREATE_CMSIS_RTOS_V1 */
|
||||||
|
|
||||||
/* USER CODE BEGIN PHY_PRE_CONFIG */
|
/* USER CODE BEGIN PHY_PRE_CONFIG */
|
||||||
|
@ -543,11 +546,11 @@ void pbuf_free_custom(struct pbuf *p)
|
||||||
/* USER CODE BEGIN 6 */
|
/* USER CODE BEGIN 6 */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the current time in milliseconds
|
* @brief Returns the current time in milliseconds
|
||||||
* when LWIP_TIMERS == 1 and NO_SYS == 1
|
* when LWIP_TIMERS == 1 and NO_SYS == 1
|
||||||
* @param None
|
* @param None
|
||||||
* @retval Current Time value
|
* @retval Current Time value
|
||||||
*/
|
*/
|
||||||
u32_t sys_now(void)
|
u32_t sys_now(void)
|
||||||
{
|
{
|
||||||
return HAL_GetTick();
|
return HAL_GetTick();
|
||||||
|
@ -810,8 +813,8 @@ void HAL_ETH_RxAllocateCallback(uint8_t **buff)
|
||||||
*buff = (uint8_t *)p + offsetof(RxBuff_t, buff);
|
*buff = (uint8_t *)p + offsetof(RxBuff_t, buff);
|
||||||
p->custom_free_function = pbuf_free_custom;
|
p->custom_free_function = pbuf_free_custom;
|
||||||
/* Initialize the struct pbuf.
|
/* Initialize the struct pbuf.
|
||||||
* This must be performed whenever a buffer's allocated because it may be
|
* This must be performed whenever a buffer's allocated because it may be
|
||||||
* changed by lwIP or the app, e.g., pbuf_free decrements ref. */
|
* changed by lwIP or the app, e.g., pbuf_free decrements ref. */
|
||||||
pbuf_alloced_custom(PBUF_RAW, 0, PBUF_REF, p, *buff, ETH_RX_BUF_SIZE);
|
pbuf_alloced_custom(PBUF_RAW, 0, PBUF_REF, p, *buff, ETH_RX_BUF_SIZE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -847,7 +850,7 @@ void HAL_ETH_RxLinkCallback(void **pStart, void **pEnd, uint8_t *buff, uint16_t
|
||||||
/* Chain the buffer to the end of the packet. */
|
/* Chain the buffer to the end of the packet. */
|
||||||
(*ppEnd)->next = p;
|
(*ppEnd)->next = p;
|
||||||
}
|
}
|
||||||
*ppEnd = p;
|
*ppEnd = p;
|
||||||
|
|
||||||
/* Update the total length of all the buffers of the chain. Each pbuf in the chain should have its tot_len
|
/* Update the total length of all the buffers of the chain. Each pbuf in the chain should have its tot_len
|
||||||
* set to its own length, plus the length of all the following pbufs in the chain. */
|
* set to its own length, plus the length of all the following pbufs in the chain. */
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
* Auto generated Run-Time-Environment Configuration File
|
* Auto generated Run-Time-Environment Configuration File
|
||||||
* *** Do not modify ! ***
|
* *** Do not modify ! ***
|
||||||
*
|
*
|
||||||
* Project: 'semi-finished_product_testing'
|
* Project: 'signal_generator'
|
||||||
* Target: 'semi-finished_product_testing'
|
* Target: 'signal_generator'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef RTE_COMPONENTS_H
|
#ifndef RTE_COMPONENTS_H
|
|
@ -22,7 +22,7 @@
|
||||||
</DaveTm>
|
</DaveTm>
|
||||||
|
|
||||||
<Target>
|
<Target>
|
||||||
<TargetName>semi-finished_product_testing</TargetName>
|
<TargetName>signal_generator</TargetName>
|
||||||
<ToolsetNumber>0x4</ToolsetNumber>
|
<ToolsetNumber>0x4</ToolsetNumber>
|
||||||
<ToolsetName>ARM-ADS</ToolsetName>
|
<ToolsetName>ARM-ADS</ToolsetName>
|
||||||
<TargetOption>
|
<TargetOption>
|
||||||
|
@ -117,26 +117,6 @@
|
||||||
<pMon>STLink\ST-LINKIII-KEIL_SWO.dll</pMon>
|
<pMon>STLink\ST-LINKIII-KEIL_SWO.dll</pMon>
|
||||||
</DebugOpt>
|
</DebugOpt>
|
||||||
<TargetDriverDllRegistry>
|
<TargetDriverDllRegistry>
|
||||||
<SetRegEntry>
|
|
||||||
<Number>0</Number>
|
|
||||||
<Key>ARMRTXEVENTFLAGS</Key>
|
|
||||||
<Name>-L70 -Z18 -C0 -M0 -T1</Name>
|
|
||||||
</SetRegEntry>
|
|
||||||
<SetRegEntry>
|
|
||||||
<Number>0</Number>
|
|
||||||
<Key>DLGTARM</Key>
|
|
||||||
<Name>(1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0)</Name>
|
|
||||||
</SetRegEntry>
|
|
||||||
<SetRegEntry>
|
|
||||||
<Number>0</Number>
|
|
||||||
<Key>ARMDBGFLAGS</Key>
|
|
||||||
<Name></Name>
|
|
||||||
</SetRegEntry>
|
|
||||||
<SetRegEntry>
|
|
||||||
<Number>0</Number>
|
|
||||||
<Key>DLGUARM</Key>
|
|
||||||
<Name>(105=-1,-1,-1,-1,0)</Name>
|
|
||||||
</SetRegEntry>
|
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
<Key>UL2CM3</Key>
|
<Key>UL2CM3</Key>
|
||||||
|
@ -145,135 +125,10 @@
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
<Key>ST-LINKIII-KEIL_SWO</Key>
|
<Key>ST-LINKIII-KEIL_SWO</Key>
|
||||||
<Name>-US -O2254 -SF1800 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(2BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -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("") -D00(00000000) -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/>
|
||||||
<WatchWindow1>
|
|
||||||
<Ww>
|
|
||||||
<count>0</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>current_buff</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>1</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>ad7124_analog</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>2</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>xReturn</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>3</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>direction</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>4</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>encode_num,0x0A</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>5</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>htim1,0x0A</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>6</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>lwip_taskHandle</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>7</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>led_taskHandle</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>8</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>dac_taskHandle</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>9</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>adc_taskHandle</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>10</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>gpio_di_do_taskHandle</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>11</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>ec11_taskHandle</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>12</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>di_state_last</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>13</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>di_state_now</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>14</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>tcp_echo_flags_control</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>15</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>state</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>16</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>IP_ADDRESS,0x0A</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>17</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>ipaddr,0x10</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>18</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>ip_addr_str,0x0A</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>19</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>gnetif</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>20</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>MACConf</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>21</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>heth</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>22</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>ip_addr</ItemText>
|
|
||||||
</Ww>
|
|
||||||
</WatchWindow1>
|
|
||||||
<MemoryWindow1>
|
|
||||||
<Mm>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<SubType>0</SubType>
|
|
||||||
<ItemText>\\semi_finished_product_testing\../LWIP/Target/ethernetif.c\heth.Init.MACAddr</ItemText>
|
|
||||||
<AccSizeX>0</AccSizeX>
|
|
||||||
</Mm>
|
|
||||||
</MemoryWindow1>
|
|
||||||
<Tracepoint>
|
<Tracepoint>
|
||||||
<THDelay>0</THDelay>
|
<THDelay>0</THDelay>
|
||||||
</Tracepoint>
|
</Tracepoint>
|
||||||
|
@ -321,7 +176,7 @@
|
||||||
<EnableFlashSeq>0</EnableFlashSeq>
|
<EnableFlashSeq>0</EnableFlashSeq>
|
||||||
<EnableLog>0</EnableLog>
|
<EnableLog>0</EnableLog>
|
||||||
<Protocol>2</Protocol>
|
<Protocol>2</Protocol>
|
||||||
<DbgClock>1800000</DbgClock>
|
<DbgClock>10000000</DbgClock>
|
||||||
</DebugDescription>
|
</DebugDescription>
|
||||||
</TargetOption>
|
</TargetOption>
|
||||||
</Target>
|
</Target>
|
||||||
|
@ -348,7 +203,7 @@
|
||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>Application/User/Core</GroupName>
|
<GroupName>Application/User/Core</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>
|
||||||
|
@ -1887,7 +1742,7 @@
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>User/board</GroupName>
|
<GroupName>User/application</GroupName>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<cbSel>0</cbSel>
|
<cbSel>0</cbSel>
|
||||||
|
@ -1899,46 +1754,14 @@
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>..\User\board\src\leds.c</PathWithFileName>
|
|
||||||
<FilenameWithoutPath>leds.c</FilenameWithoutPath>
|
|
||||||
<RteFlg>0</RteFlg>
|
|
||||||
<bShared>0</bShared>
|
|
||||||
</File>
|
|
||||||
</Group>
|
|
||||||
|
|
||||||
<Group>
|
|
||||||
<GroupName>User/application</GroupName>
|
|
||||||
<tvExp>0</tvExp>
|
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
|
||||||
<cbSel>0</cbSel>
|
|
||||||
<RteFlg>0</RteFlg>
|
|
||||||
<File>
|
|
||||||
<GroupNumber>11</GroupNumber>
|
|
||||||
<FileNumber>126</FileNumber>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<tvExp>0</tvExp>
|
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
|
||||||
<bDave2>0</bDave2>
|
|
||||||
<PathWithFileName>..\User\application\src\ble_mx_02.c</PathWithFileName>
|
|
||||||
<FilenameWithoutPath>ble_mx_02.c</FilenameWithoutPath>
|
|
||||||
<RteFlg>0</RteFlg>
|
|
||||||
<bShared>0</bShared>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<GroupNumber>11</GroupNumber>
|
|
||||||
<FileNumber>127</FileNumber>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<tvExp>0</tvExp>
|
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
|
||||||
<bDave2>0</bDave2>
|
|
||||||
<PathWithFileName>..\User\application\src\communication_protocol.c</PathWithFileName>
|
<PathWithFileName>..\User\application\src\communication_protocol.c</PathWithFileName>
|
||||||
<FilenameWithoutPath>communication_protocol.c</FilenameWithoutPath>
|
<FilenameWithoutPath>communication_protocol.c</FilenameWithoutPath>
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
<bShared>0</bShared>
|
<bShared>0</bShared>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>11</GroupNumber>
|
<GroupNumber>10</GroupNumber>
|
||||||
<FileNumber>128</FileNumber>
|
<FileNumber>126</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -1949,8 +1772,8 @@
|
||||||
<bShared>0</bShared>
|
<bShared>0</bShared>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>11</GroupNumber>
|
<GroupNumber>10</GroupNumber>
|
||||||
<FileNumber>129</FileNumber>
|
<FileNumber>127</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -1961,8 +1784,8 @@
|
||||||
<bShared>0</bShared>
|
<bShared>0</bShared>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>11</GroupNumber>
|
<GroupNumber>10</GroupNumber>
|
||||||
<FileNumber>130</FileNumber>
|
<FileNumber>128</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -1974,15 +1797,35 @@
|
||||||
</File>
|
</File>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
|
<Group>
|
||||||
|
<GroupName>User/board</GroupName>
|
||||||
|
<tvExp>0</tvExp>
|
||||||
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
<cbSel>0</cbSel>
|
||||||
|
<RteFlg>0</RteFlg>
|
||||||
|
<File>
|
||||||
|
<GroupNumber>11</GroupNumber>
|
||||||
|
<FileNumber>129</FileNumber>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<tvExp>0</tvExp>
|
||||||
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
<bDave2>0</bDave2>
|
||||||
|
<PathWithFileName>..\User\board\src\leds.c</PathWithFileName>
|
||||||
|
<FilenameWithoutPath>leds.c</FilenameWithoutPath>
|
||||||
|
<RteFlg>0</RteFlg>
|
||||||
|
<bShared>0</bShared>
|
||||||
|
</File>
|
||||||
|
</Group>
|
||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>User/driver</GroupName>
|
<GroupName>User/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>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>12</GroupNumber>
|
<GroupNumber>12</GroupNumber>
|
||||||
<FileNumber>131</FileNumber>
|
<FileNumber>130</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -1994,7 +1837,7 @@
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>12</GroupNumber>
|
<GroupNumber>12</GroupNumber>
|
||||||
<FileNumber>132</FileNumber>
|
<FileNumber>131</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -2006,7 +1849,7 @@
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>12</GroupNumber>
|
<GroupNumber>12</GroupNumber>
|
||||||
<FileNumber>133</FileNumber>
|
<FileNumber>132</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -2018,7 +1861,7 @@
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>12</GroupNumber>
|
<GroupNumber>12</GroupNumber>
|
||||||
<FileNumber>134</FileNumber>
|
<FileNumber>133</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -2036,6 +1879,18 @@
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<cbSel>0</cbSel>
|
<cbSel>0</cbSel>
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
|
<File>
|
||||||
|
<GroupNumber>13</GroupNumber>
|
||||||
|
<FileNumber>134</FileNumber>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<tvExp>0</tvExp>
|
||||||
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
<bDave2>0</bDave2>
|
||||||
|
<PathWithFileName>..\User\system\user_flash.c</PathWithFileName>
|
||||||
|
<FilenameWithoutPath>user_flash.c</FilenameWithoutPath>
|
||||||
|
<RteFlg>0</RteFlg>
|
||||||
|
<bShared>0</bShared>
|
||||||
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>13</GroupNumber>
|
<GroupNumber>13</GroupNumber>
|
||||||
<FileNumber>135</FileNumber>
|
<FileNumber>135</FileNumber>
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<Targets>
|
<Targets>
|
||||||
<Target>
|
<Target>
|
||||||
<TargetName>semi-finished_product_testing</TargetName>
|
<TargetName>signal_generator</TargetName>
|
||||||
<ToolsetNumber>0x4</ToolsetNumber>
|
<ToolsetNumber>0x4</ToolsetNumber>
|
||||||
<ToolsetName>ARM-ADS</ToolsetName>
|
<ToolsetName>ARM-ADS</ToolsetName>
|
||||||
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
|
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
<SLE66CMisc></SLE66CMisc>
|
<SLE66CMisc></SLE66CMisc>
|
||||||
<SLE66AMisc></SLE66AMisc>
|
<SLE66AMisc></SLE66AMisc>
|
||||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||||
<SFDFile>$$Device:STM32F407VGTx$CMSIS\SVD\STM32F40x.svd</SFDFile>
|
<SFDFile>$$Device:STM32F407VGTx$CMSIS\SVD\STM32F407.svd</SFDFile>
|
||||||
<bCustSvd>0</bCustSvd>
|
<bCustSvd>0</bCustSvd>
|
||||||
<UseEnv>0</UseEnv>
|
<UseEnv>0</UseEnv>
|
||||||
<BinPath></BinPath>
|
<BinPath></BinPath>
|
||||||
|
@ -48,11 +48,11 @@
|
||||||
<NotGenerated>0</NotGenerated>
|
<NotGenerated>0</NotGenerated>
|
||||||
<InvalidFlash>1</InvalidFlash>
|
<InvalidFlash>1</InvalidFlash>
|
||||||
</TargetStatus>
|
</TargetStatus>
|
||||||
<OutputDirectory>semi-finished_product_testing\</OutputDirectory>
|
<OutputDirectory>signal_generator\</OutputDirectory>
|
||||||
<OutputName>semi-finished_product_testing</OutputName>
|
<OutputName>signal_generator</OutputName>
|
||||||
<CreateExecutable>1</CreateExecutable>
|
<CreateExecutable>1</CreateExecutable>
|
||||||
<CreateLib>0</CreateLib>
|
<CreateLib>0</CreateLib>
|
||||||
<CreateHexFile>0</CreateHexFile>
|
<CreateHexFile>1</CreateHexFile>
|
||||||
<DebugInformation>1</DebugInformation>
|
<DebugInformation>1</DebugInformation>
|
||||||
<BrowseInformation>0</BrowseInformation>
|
<BrowseInformation>0</BrowseInformation>
|
||||||
<ListingPath></ListingPath>
|
<ListingPath></ListingPath>
|
||||||
|
@ -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>
|
||||||
|
@ -1045,24 +1045,9 @@
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
<Group>
|
|
||||||
<GroupName>User/board</GroupName>
|
|
||||||
<Files>
|
|
||||||
<File>
|
|
||||||
<FileName>leds.c</FileName>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<FilePath>..\User\board\src\leds.c</FilePath>
|
|
||||||
</File>
|
|
||||||
</Files>
|
|
||||||
</Group>
|
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>User/application</GroupName>
|
<GroupName>User/application</GroupName>
|
||||||
<Files>
|
<Files>
|
||||||
<File>
|
|
||||||
<FileName>ble_mx_02.c</FileName>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<FilePath>..\User\application\src\ble_mx_02.c</FilePath>
|
|
||||||
</File>
|
|
||||||
<File>
|
<File>
|
||||||
<FileName>communication_protocol.c</FileName>
|
<FileName>communication_protocol.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
|
@ -1085,6 +1070,16 @@
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
|
<Group>
|
||||||
|
<GroupName>User/board</GroupName>
|
||||||
|
<Files>
|
||||||
|
<File>
|
||||||
|
<FileName>leds.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\User\board\src\leds.c</FilePath>
|
||||||
|
</File>
|
||||||
|
</Files>
|
||||||
|
</Group>
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>User/driver</GroupName>
|
<GroupName>User/driver</GroupName>
|
||||||
<Files>
|
<Files>
|
||||||
|
@ -1113,6 +1108,11 @@
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>User/system</GroupName>
|
<GroupName>User/system</GroupName>
|
||||||
<Files>
|
<Files>
|
||||||
|
<File>
|
||||||
|
<FileName>user_flash.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\User\system\user_flash.c</FilePath>
|
||||||
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>user_gpio.c</FileName>
|
<FileName>user_gpio.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
|
@ -1138,7 +1138,7 @@
|
||||||
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="4.3.0" condition="CMSIS Core">
|
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="4.3.0" condition="CMSIS Core">
|
||||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="4.5.0"/>
|
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="4.5.0"/>
|
||||||
<targetInfos>
|
<targetInfos>
|
||||||
<targetInfo name="semi-finished_product_testing"/>
|
<targetInfo name="signal_generator"/>
|
||||||
</targetInfos>
|
</targetInfos>
|
||||||
</component>
|
</component>
|
||||||
</components>
|
</components>
|
||||||
|
@ -1148,7 +1148,7 @@
|
||||||
<LayerInfo>
|
<LayerInfo>
|
||||||
<Layers>
|
<Layers>
|
||||||
<Layer>
|
<Layer>
|
||||||
<LayName>semi-finished_product_testing</LayName>
|
<LayName>signal_generator</LayName>
|
||||||
<LayPrjMark>1</LayPrjMark>
|
<LayPrjMark>1</LayPrjMark>
|
||||||
</Layer>
|
</Layer>
|
||||||
</Layers>
|
</Layers>
|
File diff suppressed because it is too large
Load Diff
|
@ -25,6 +25,15 @@ void communication_exception(uint8_t *tx_data, const uint8_t *const rx_data, com
|
||||||
tx_data[6] = FRAME_TAIL; // 帧尾
|
tx_data[6] = FRAME_TAIL; // 帧尾
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 获取AI数据并封装成通信帧
|
||||||
|
*
|
||||||
|
* 该函数从指定的AI通道获取模拟数据,并将其封装成一个通信帧。
|
||||||
|
*
|
||||||
|
* @param ai_data 指向communication_ai_t结构体的指针,包含AI通道信息
|
||||||
|
* @param tx_data 指向uint8_t数组的指针,用于存储生成的通信帧
|
||||||
|
* @param rx_data 指向const uint8_t数组的指针,包含接收到的命令数据
|
||||||
|
*/
|
||||||
void communication_get_ai(communication_ai_t *ai_data, uint8_t *tx_data, const uint8_t *const rx_data)
|
void communication_get_ai(communication_ai_t *ai_data, uint8_t *tx_data, const uint8_t *const rx_data)
|
||||||
{
|
{
|
||||||
float32_u analog_data;
|
float32_u analog_data;
|
||||||
|
|
|
@ -89,13 +89,6 @@ void TCP_Client_Init(void)
|
||||||
client_pcb = tcp_new();
|
client_pcb = tcp_new();
|
||||||
|
|
||||||
IP4_ADDR(&server_ip, DEST_IP_ADDR0, DEST_IP_ADDR1, DEST_IP_ADDR2, DEST_IP_ADDR3); // 磁甜IP華硊
|
IP4_ADDR(&server_ip, DEST_IP_ADDR0, DEST_IP_ADDR1, DEST_IP_ADDR2, DEST_IP_ADDR3); // 磁甜IP華硊
|
||||||
// printf("IP 地址为: %d.%d.%d.%d\n",
|
|
||||||
// ip4_addr1(&server_ip),
|
|
||||||
// ip4_addr2(&server_ip),
|
|
||||||
// ip4_addr3(&server_ip),
|
|
||||||
// ip4_addr4(&server_ip));
|
|
||||||
// printf("客户端开始连接!\n");
|
|
||||||
|
|
||||||
// 羲宎蟀諉
|
// 羲宎蟀諉
|
||||||
tcp_connect(client_pcb, &server_ip, TCP_CLIENT_PORT, client_connected);
|
tcp_connect(client_pcb, &server_ip, TCP_CLIENT_PORT, client_connected);
|
||||||
ip_set_option(client_pcb, SOF_KEEPALIVE);
|
ip_set_option(client_pcb, SOF_KEEPALIVE);
|
||||||
|
|
|
@ -209,8 +209,9 @@ static err_t tcpecho_recv_control(void *arg, struct tcp_pcb *tpcb, struct pbuf *
|
||||||
/*2. 判断所要执行的操作 读或写指令*/
|
/*2. 判断所要执行的操作 读或写指令*/
|
||||||
/*3. 对要发送的数据进行校验,组包,返回数据*/
|
/*3. 对要发送的数据进行校验,组包,返回数据*/
|
||||||
|
|
||||||
pbuf_free(p);
|
|
||||||
}
|
}
|
||||||
|
pbuf_free(p);
|
||||||
}
|
}
|
||||||
else if (err == ERR_OK) // 检测到对方主动关闭连接时,也会调用recv函数,此时p为空
|
else if (err == ERR_OK) // 检测到对方主动关闭连接时,也会调用recv函数,此时p为空
|
||||||
{
|
{
|
||||||
|
|
|
@ -220,6 +220,7 @@ typedef enum
|
||||||
} ad7124_registers_addr_e; // 寄存器地址
|
} ad7124_registers_addr_e; // 寄存器地址
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
|
||||||
AD7124_SIZE_1 = 1,
|
AD7124_SIZE_1 = 1,
|
||||||
AD7124_SIZE_2 = 2,
|
AD7124_SIZE_2 = 2,
|
||||||
AD7124_SIZE_3 = 3,
|
AD7124_SIZE_3 = 3,
|
||||||
|
|
|
@ -1,5 +1,16 @@
|
||||||
#include "ht1200m.h"
|
#include "ht1200m.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 重置hart_ht1200m模块
|
||||||
|
*
|
||||||
|
* 该函数用于重置hart_ht1200m模块,通过操作硬件复位引脚和RTS引脚实现。
|
||||||
|
*
|
||||||
|
* 具体步骤如下:
|
||||||
|
* 1. 将HART1和HART2的复位引脚置高电平,启动复位过程。
|
||||||
|
* 2. 延时10毫秒,确保复位过程完成。
|
||||||
|
* 3. 将HART1和HART2的复位引脚置低电平,结束复位过程。
|
||||||
|
* 4. 将HART1和HART2的RTS引脚设置为接收状态,准备接收数据。
|
||||||
|
*/
|
||||||
extern void hart_ht1200m_reset(void)
|
extern void hart_ht1200m_reset(void)
|
||||||
{
|
{
|
||||||
HART1_RESET_ON;
|
HART1_RESET_ON;
|
||||||
|
|
|
@ -4,19 +4,26 @@
|
||||||
|
|
||||||
extern ip4_addr_t ipaddr;
|
extern ip4_addr_t ipaddr;
|
||||||
uint8_t ip_addr[24] = {0};
|
uint8_t ip_addr[24] = {0};
|
||||||
|
/**
|
||||||
|
* @brief 通过UART向LCD屏幕绘制IP地址
|
||||||
|
*
|
||||||
|
* 此函数通过UART接口向LCD屏幕发送IP地址,以便在屏幕上显示。
|
||||||
|
*
|
||||||
|
* @note 此函数假定已经正确初始化了UART接口,并且LCD屏幕已经正确连接到UART接口。
|
||||||
|
*/
|
||||||
void uart_lcd_draw_ipaddr(void)
|
void uart_lcd_draw_ipaddr(void)
|
||||||
{
|
{
|
||||||
|
// 串口发送的固定值为串口屏指令指定的帧头帧尾
|
||||||
ip_addr[0] = 0xEE;
|
ip_addr[0] = 0xEE; // 帧头
|
||||||
ip_addr[1] = 0xB1;
|
ip_addr[1] = 0xB1;
|
||||||
ip_addr[2] = 0x10;
|
ip_addr[2] = 0x10; // 命令码,此处为文本控件文本设置指令
|
||||||
ip_addr[3] = 0x00;
|
ip_addr[3] = 0x00; // 画面ID高位地址
|
||||||
ip_addr[4] = 0x00;
|
ip_addr[4] = 0x00; // 画面ID低位地址
|
||||||
ip_addr[5] = 0x00;
|
ip_addr[5] = 0x00; // 控件ID高位地址
|
||||||
ip_addr[6] = 0x03;
|
ip_addr[6] = 0x03; // 控件ID低位地址
|
||||||
char *ip_addr_str = ipaddr_ntoa(&ipaddr);
|
char *ip_addr_str = ipaddr_ntoa(&ipaddr);
|
||||||
MEMCPY(ip_addr + 7, (uint8_t *)ip_addr_str, strlen(ip_addr_str));
|
MEMCPY(ip_addr + 7, (uint8_t *)ip_addr_str, strlen(ip_addr_str));
|
||||||
ip_addr[7 + strlen(ip_addr_str)] = 0xFF;
|
ip_addr[7 + strlen(ip_addr_str)] = 0xFF; // 帧尾,下列都为帧尾
|
||||||
ip_addr[8 + strlen(ip_addr_str)] = 0xFC;
|
ip_addr[8 + strlen(ip_addr_str)] = 0xFC;
|
||||||
ip_addr[9 + strlen(ip_addr_str)] = 0xFF;
|
ip_addr[9 + strlen(ip_addr_str)] = 0xFF;
|
||||||
ip_addr[10 + strlen(ip_addr_str)] = 0xFF;
|
ip_addr[10 + strlen(ip_addr_str)] = 0xFF;
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
#include "user_flash.h"
|
||||||
|
|
||||||
|
/* 写入原始数据 ---------------------------------------------*/
|
||||||
|
HAL_StatusTypeDef flash_write_data(uint32_t addr, uint8_t *data, uint16_t size)
|
||||||
|
{
|
||||||
|
HAL_StatusTypeDef status = HAL_OK;
|
||||||
|
uint32_t i;
|
||||||
|
uint32_t write_addr = addr;
|
||||||
|
FLASH_EraseInitTypeDef erase_init;
|
||||||
|
uint32_t sector_error;
|
||||||
|
|
||||||
|
// 1. 解锁Flash
|
||||||
|
HAL_FLASH_Unlock();
|
||||||
|
|
||||||
|
// 2. 擦除目标扇区
|
||||||
|
erase_init.TypeErase = FLASH_TYPEERASE_SECTORS;
|
||||||
|
erase_init.Sector = FLASH_USER_SECTOR;
|
||||||
|
erase_init.NbSectors = 1; // 擦除1个扇区
|
||||||
|
erase_init.VoltageRange = FLASH_VOLTAGE_RANGE_3; // 根据电压范围选择
|
||||||
|
|
||||||
|
// 执行擦除操作
|
||||||
|
if (HAL_FLASHEx_Erase(&erase_init, §or_error) != HAL_OK)
|
||||||
|
{
|
||||||
|
status = HAL_ERROR;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 写入数据
|
||||||
|
for (i = 0; i < size; i += 4)
|
||||||
|
{ // 以32位(4字节)为单位写入
|
||||||
|
uint32_t data_to_write = *(uint32_t *)(data + i);
|
||||||
|
|
||||||
|
if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD,
|
||||||
|
write_addr,
|
||||||
|
data_to_write) != HAL_OK)
|
||||||
|
{
|
||||||
|
status = HAL_ERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
write_addr += 4; // 地址递增
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
|
// 4. 锁定Flash
|
||||||
|
HAL_FLASH_Lock();
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 读取原始数据 ---------------------------------------------*/
|
||||||
|
void flash_read_data(uint32_t addr, uint8_t *data, uint32_t size)
|
||||||
|
{
|
||||||
|
memcpy(data, (uint32_t *)addr, size);
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
#ifndef __USER_FLASH_H__
|
||||||
|
#define __USER_FLASH_H__
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* Flash配置 -------------------------------------------------*/
|
||||||
|
#define FLASH_USER_START_ADDR 0x080E0000 // Sector11起始地址(128KB)
|
||||||
|
#define FLASH_USER_SECTOR FLASH_SECTOR_11
|
||||||
|
|
||||||
|
/* 函数声明 -------------------------------------------------*/
|
||||||
|
HAL_StatusTypeDef flash_write_data(uint32_t addr, uint8_t *data, uint16_t size);
|
||||||
|
void flash_read_data(uint32_t addr, uint8_t *data, uint32_t size);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -190,69 +190,70 @@ Mcu.Package=LQFP100
|
||||||
Mcu.Pin0=PE2
|
Mcu.Pin0=PE2
|
||||||
Mcu.Pin1=PE3
|
Mcu.Pin1=PE3
|
||||||
Mcu.Pin10=PC5
|
Mcu.Pin10=PC5
|
||||||
Mcu.Pin11=PB1
|
Mcu.Pin11=PB0
|
||||||
Mcu.Pin12=PB2
|
Mcu.Pin12=PB1
|
||||||
Mcu.Pin13=PE7
|
Mcu.Pin13=PB2
|
||||||
Mcu.Pin14=PE8
|
Mcu.Pin14=PE7
|
||||||
Mcu.Pin15=PE9
|
Mcu.Pin15=PE8
|
||||||
Mcu.Pin16=PE11
|
Mcu.Pin16=PE9
|
||||||
Mcu.Pin17=PE12
|
Mcu.Pin17=PE11
|
||||||
Mcu.Pin18=PE13
|
Mcu.Pin18=PE12
|
||||||
Mcu.Pin19=PE14
|
Mcu.Pin19=PE13
|
||||||
Mcu.Pin2=PH0-OSC_IN
|
Mcu.Pin2=PH0-OSC_IN
|
||||||
Mcu.Pin20=PB11
|
Mcu.Pin20=PE14
|
||||||
Mcu.Pin21=PB12
|
Mcu.Pin21=PB11
|
||||||
Mcu.Pin22=PB13
|
Mcu.Pin22=PB12
|
||||||
Mcu.Pin23=PD8
|
Mcu.Pin23=PB13
|
||||||
Mcu.Pin24=PD9
|
Mcu.Pin24=PD8
|
||||||
Mcu.Pin25=PD11
|
Mcu.Pin25=PD9
|
||||||
Mcu.Pin26=PD12
|
Mcu.Pin26=PD11
|
||||||
Mcu.Pin27=PD13
|
Mcu.Pin27=PD12
|
||||||
Mcu.Pin28=PD14
|
Mcu.Pin28=PD13
|
||||||
Mcu.Pin29=PD15
|
Mcu.Pin29=PD14
|
||||||
Mcu.Pin3=PH1-OSC_OUT
|
Mcu.Pin3=PH1-OSC_OUT
|
||||||
Mcu.Pin30=PC6
|
Mcu.Pin30=PD15
|
||||||
Mcu.Pin31=PC7
|
Mcu.Pin31=PC6
|
||||||
Mcu.Pin32=PC8
|
Mcu.Pin32=PC7
|
||||||
Mcu.Pin33=PC9
|
Mcu.Pin33=PC8
|
||||||
Mcu.Pin34=PA8
|
Mcu.Pin34=PC9
|
||||||
Mcu.Pin35=PA9
|
Mcu.Pin35=PA8
|
||||||
Mcu.Pin36=PA10
|
Mcu.Pin36=PA9
|
||||||
Mcu.Pin37=PA11
|
Mcu.Pin37=PA10
|
||||||
Mcu.Pin38=PA12
|
Mcu.Pin38=PA11
|
||||||
Mcu.Pin39=PA13
|
Mcu.Pin39=PA12
|
||||||
Mcu.Pin4=PC0
|
Mcu.Pin4=PC0
|
||||||
Mcu.Pin40=PA14
|
Mcu.Pin40=PA13
|
||||||
Mcu.Pin41=PA15
|
Mcu.Pin41=PA14
|
||||||
Mcu.Pin42=PC10
|
Mcu.Pin42=PA15
|
||||||
Mcu.Pin43=PC11
|
Mcu.Pin43=PC10
|
||||||
Mcu.Pin44=PC12
|
Mcu.Pin44=PC11
|
||||||
Mcu.Pin45=PD0
|
Mcu.Pin45=PC12
|
||||||
Mcu.Pin46=PD1
|
Mcu.Pin46=PD0
|
||||||
Mcu.Pin47=PD2
|
Mcu.Pin47=PD1
|
||||||
Mcu.Pin48=PD3
|
Mcu.Pin48=PD2
|
||||||
Mcu.Pin49=PD4
|
Mcu.Pin49=PD3
|
||||||
Mcu.Pin5=PC1
|
Mcu.Pin5=PC1
|
||||||
Mcu.Pin50=PD5
|
Mcu.Pin50=PD4
|
||||||
Mcu.Pin51=PD6
|
Mcu.Pin51=PD5
|
||||||
Mcu.Pin52=PD7
|
Mcu.Pin52=PD6
|
||||||
Mcu.Pin53=PB3
|
Mcu.Pin53=PD7
|
||||||
Mcu.Pin54=PB4
|
Mcu.Pin54=PB3
|
||||||
Mcu.Pin55=PB5
|
Mcu.Pin55=PB4
|
||||||
Mcu.Pin56=PB6
|
Mcu.Pin56=PB5
|
||||||
Mcu.Pin57=PB7
|
Mcu.Pin57=PB6
|
||||||
Mcu.Pin58=PE0
|
Mcu.Pin58=PB7
|
||||||
Mcu.Pin59=PE1
|
Mcu.Pin59=PE0
|
||||||
Mcu.Pin6=PA1
|
Mcu.Pin6=PA1
|
||||||
Mcu.Pin60=VP_FREERTOS_VS_CMSIS_V1
|
Mcu.Pin60=PE1
|
||||||
Mcu.Pin61=VP_LWIP_VS_Enabled
|
Mcu.Pin61=VP_FREERTOS_VS_CMSIS_V1
|
||||||
Mcu.Pin62=VP_SYS_VS_tim4
|
Mcu.Pin62=VP_LWIP_VS_Enabled
|
||||||
Mcu.Pin63=VP_TIM2_VS_ClockSourceINT
|
Mcu.Pin63=VP_SYS_VS_tim4
|
||||||
Mcu.Pin64=VP_TIM3_VS_ClockSourceINT
|
Mcu.Pin64=VP_TIM2_VS_ClockSourceINT
|
||||||
|
Mcu.Pin65=VP_TIM3_VS_ClockSourceINT
|
||||||
Mcu.Pin7=PA2
|
Mcu.Pin7=PA2
|
||||||
Mcu.Pin8=PA7
|
Mcu.Pin8=PA7
|
||||||
Mcu.Pin9=PC4
|
Mcu.Pin9=PC4
|
||||||
Mcu.PinsNb=65
|
Mcu.PinsNb=66
|
||||||
Mcu.ThirdPartyNb=0
|
Mcu.ThirdPartyNb=0
|
||||||
Mcu.UserConstants=
|
Mcu.UserConstants=
|
||||||
Mcu.UserName=STM32F407VGTx
|
Mcu.UserName=STM32F407VGTx
|
||||||
|
@ -287,7 +288,6 @@ NVIC.SavedPendsvIrqHandlerGenerated=true
|
||||||
NVIC.SavedSvcallIrqHandlerGenerated=true
|
NVIC.SavedSvcallIrqHandlerGenerated=true
|
||||||
NVIC.SavedSystickIrqHandlerGenerated=true
|
NVIC.SavedSystickIrqHandlerGenerated=true
|
||||||
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:false\:true\:false\:true\:false
|
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:false\:true\:false\:true\:false
|
||||||
NVIC.TIM3_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
|
||||||
NVIC.TIM4_IRQn=true\:15\:0\:false\:false\:true\:false\:false\:true\:true
|
NVIC.TIM4_IRQn=true\:15\:0\:false\:false\:true\:false\:false\:true\:true
|
||||||
NVIC.TimeBase=TIM4_IRQn
|
NVIC.TimeBase=TIM4_IRQn
|
||||||
NVIC.TimeBaseIP=TIM4
|
NVIC.TimeBaseIP=TIM4
|
||||||
|
@ -338,6 +338,11 @@ PA9.GPIOParameters=GPIO_Label
|
||||||
PA9.GPIO_Label=USB_TX
|
PA9.GPIO_Label=USB_TX
|
||||||
PA9.Mode=Asynchronous
|
PA9.Mode=Asynchronous
|
||||||
PA9.Signal=USART1_TX
|
PA9.Signal=USART1_TX
|
||||||
|
PB0.GPIOParameters=GPIO_Speed,GPIO_Label
|
||||||
|
PB0.GPIO_Label=T3_CH3_BUZZER
|
||||||
|
PB0.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH
|
||||||
|
PB0.Locked=true
|
||||||
|
PB0.Signal=S_TIM3_CH3
|
||||||
PB1.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label
|
PB1.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label
|
||||||
PB1.GPIO_Label=LED3_R
|
PB1.GPIO_Label=LED3_R
|
||||||
PB1.GPIO_PuPd=GPIO_PULLUP
|
PB1.GPIO_PuPd=GPIO_PULLUP
|
||||||
|
@ -359,12 +364,18 @@ PB2.GPIO_Speed=GPIO_SPEED_FREQ_MEDIUM
|
||||||
PB2.Locked=true
|
PB2.Locked=true
|
||||||
PB2.PinState=GPIO_PIN_SET
|
PB2.PinState=GPIO_PIN_SET
|
||||||
PB2.Signal=GPIO_Output
|
PB2.Signal=GPIO_Output
|
||||||
|
PB3.GPIOParameters=GPIO_PuPd
|
||||||
|
PB3.GPIO_PuPd=GPIO_PULLUP
|
||||||
PB3.Locked=true
|
PB3.Locked=true
|
||||||
PB3.Mode=Full_Duplex_Master
|
PB3.Mode=Full_Duplex_Master
|
||||||
PB3.Signal=SPI1_SCK
|
PB3.Signal=SPI1_SCK
|
||||||
|
PB4.GPIOParameters=GPIO_PuPd
|
||||||
|
PB4.GPIO_PuPd=GPIO_PULLUP
|
||||||
PB4.Locked=true
|
PB4.Locked=true
|
||||||
PB4.Mode=Full_Duplex_Master
|
PB4.Mode=Full_Duplex_Master
|
||||||
PB4.Signal=SPI1_MISO
|
PB4.Signal=SPI1_MISO
|
||||||
|
PB5.GPIOParameters=GPIO_PuPd
|
||||||
|
PB5.GPIO_PuPd=GPIO_PULLUP
|
||||||
PB5.Locked=true
|
PB5.Locked=true
|
||||||
PB5.Mode=Full_Duplex_Master
|
PB5.Mode=Full_Duplex_Master
|
||||||
PB5.Signal=SPI1_MOSI
|
PB5.Signal=SPI1_MOSI
|
||||||
|
@ -609,8 +620,8 @@ ProjectManager.MainLocation=Core/Src
|
||||||
ProjectManager.NoMain=false
|
ProjectManager.NoMain=false
|
||||||
ProjectManager.PreviousToolchain=
|
ProjectManager.PreviousToolchain=
|
||||||
ProjectManager.ProjectBuild=false
|
ProjectManager.ProjectBuild=false
|
||||||
ProjectManager.ProjectFileName=semi-finished_product_testing.ioc
|
ProjectManager.ProjectFileName=signal_generator.ioc
|
||||||
ProjectManager.ProjectName=semi-finished_product_testing
|
ProjectManager.ProjectName=signal_generator
|
||||||
ProjectManager.ProjectStructure=
|
ProjectManager.ProjectStructure=
|
||||||
ProjectManager.RegisterCallBack=
|
ProjectManager.RegisterCallBack=
|
||||||
ProjectManager.StackSize=0x400
|
ProjectManager.StackSize=0x400
|
||||||
|
@ -663,6 +674,8 @@ SH.S_TIM1_CH2.0=TIM1_CH2,Encoder_Interface
|
||||||
SH.S_TIM1_CH2.ConfNb=1
|
SH.S_TIM1_CH2.ConfNb=1
|
||||||
SH.S_TIM2_CH1_ETR.0=TIM2_CH1,PWM Generation1 CH1
|
SH.S_TIM2_CH1_ETR.0=TIM2_CH1,PWM Generation1 CH1
|
||||||
SH.S_TIM2_CH1_ETR.ConfNb=1
|
SH.S_TIM2_CH1_ETR.ConfNb=1
|
||||||
|
SH.S_TIM3_CH3.0=TIM3_CH3,PWM Generation3 CH3
|
||||||
|
SH.S_TIM3_CH3.ConfNb=1
|
||||||
SPI1.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_256
|
SPI1.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_256
|
||||||
SPI1.CLKPhase=SPI_PHASE_2EDGE
|
SPI1.CLKPhase=SPI_PHASE_2EDGE
|
||||||
SPI1.CLKPolarity=SPI_POLARITY_HIGH
|
SPI1.CLKPolarity=SPI_POLARITY_HIGH
|
||||||
|
@ -678,10 +691,11 @@ TIM2.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
|
||||||
TIM2.IPParameters=Channel-PWM Generation1 CH1,Period,Pulse-PWM Generation1 CH1
|
TIM2.IPParameters=Channel-PWM Generation1 CH1,Period,Pulse-PWM Generation1 CH1
|
||||||
TIM2.Period=119
|
TIM2.Period=119
|
||||||
TIM2.Pulse-PWM\ Generation1\ CH1=60
|
TIM2.Pulse-PWM\ Generation1\ CH1=60
|
||||||
TIM3.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_ENABLE
|
TIM3.Channel-PWM\ Generation3\ CH3=TIM_CHANNEL_3
|
||||||
TIM3.IPParameters=Prescaler,Period,AutoReloadPreload
|
TIM3.IPParameters=Channel-PWM Generation3 CH3,Prescaler,Period,Pulse-PWM Generation3 CH3
|
||||||
TIM3.Period=999
|
TIM3.Period=370
|
||||||
TIM3.Prescaler=55295
|
TIM3.Prescaler=54
|
||||||
|
TIM3.Pulse-PWM\ Generation3\ CH3=92
|
||||||
UART4.IPParameters=VirtualMode
|
UART4.IPParameters=VirtualMode
|
||||||
UART4.VirtualMode=Asynchronous
|
UART4.VirtualMode=Asynchronous
|
||||||
UART5.BaudRate=1200
|
UART5.BaudRate=1200
|
||||||
|
|
Loading…
Reference in New Issue