2026-03-31 15:46:04 +08:00
|
|
|
|
/**
|
|
|
|
|
|
******************************************************************************
|
|
|
|
|
|
* @file user\driver\drv_init.c
|
|
|
|
|
|
* @author luhuaishuai
|
|
|
|
|
|
* @version v0.1
|
|
|
|
|
|
* @date 2026-1-12
|
|
|
|
|
|
* @brief Briefly describe the function of your function
|
|
|
|
|
|
******************************************************************************
|
|
|
|
|
|
*/
|
|
|
|
|
|
/* Includes -------------------------------------------------------------------*/
|
|
|
|
|
|
#include "drv_init.h"
|
|
|
|
|
|
#include <stdint.h>
|
2026-05-08 18:17:26 +08:00
|
|
|
|
#include "flash_config.h"
|
2026-03-31 15:46:04 +08:00
|
|
|
|
|
|
|
|
|
|
/* code -----------------------------------------------------------------------*/
|
2026-04-30 17:16:01 +08:00
|
|
|
|
void send_cmd_to_air724(uint8_t *cmd, uint16_t len)
|
|
|
|
|
|
{
|
|
|
|
|
|
Air724_Message_Send(cmd, len);
|
|
|
|
|
|
}
|
|
|
|
|
|
void send_server_address_to_air724(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
char ip[] = YKC_SERVER_IP;
|
|
|
|
|
|
char port[6];
|
|
|
|
|
|
sprintf(port, "%d", YKC_SERVER_PORT);
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t len = strlen(ip) + 1 + strlen(port);
|
|
|
|
|
|
uint8_t config_cmd[256] = {0x55, 0xAA, 0x04, 0x00, len};
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t pos = 5;
|
|
|
|
|
|
memcpy(&config_cmd[pos], ip, strlen(ip));
|
|
|
|
|
|
pos += strlen(ip);
|
|
|
|
|
|
config_cmd[pos++] = 0x00;
|
|
|
|
|
|
memcpy(&config_cmd[pos], port, strlen(port));
|
|
|
|
|
|
pos += strlen(port);
|
|
|
|
|
|
config_cmd[pos++] = 0xAA;
|
|
|
|
|
|
config_cmd[pos++] = 0x55;
|
|
|
|
|
|
send_cmd_to_air724(config_cmd, pos);
|
|
|
|
|
|
pos = 0;
|
|
|
|
|
|
memset(config_cmd, 0, sizeof(config_cmd));
|
|
|
|
|
|
}
|
2026-05-08 18:17:26 +08:00
|
|
|
|
|
2026-03-31 15:46:04 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* @brief drv_all_Init:所有传感器、外设芯片、外部设备初始化
|
|
|
|
|
|
*
|
|
|
|
|
|
* @note none
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param none
|
|
|
|
|
|
*
|
|
|
|
|
|
* @retval none
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
void drv_all_Init(void)
|
|
|
|
|
|
{
|
2026-04-30 17:16:01 +08:00
|
|
|
|
AIR724_RESET(); /* AIR724 复位 */
|
2026-05-08 18:17:26 +08:00
|
|
|
|
stm_flash_init();/* 初始化flash */
|
2026-03-31 15:46:04 +08:00
|
|
|
|
}
|