2023-10-01 01:56:55 +08:00
|
|
|
|
|
|
|
|
#include "u_types.h"
|
|
|
|
|
#include "u_prot.h"
|
|
|
|
|
#include "u_mm.h"
|
|
|
|
|
#include "u_sleep.h"
|
2023-10-02 00:22:13 +08:00
|
|
|
#include "u_drv.h"
|
|
|
|
|
|
2023-10-01 01:56:55 +08:00
|
|
|
#include "led.h"
|
|
|
|
|
#include "relay.h"
|
|
|
|
|
#include "soft_iic.h"
|
|
|
|
|
#include "spl06.h"
|
2023-10-02 00:22:13 +08:00
|
|
|
#include "adc.h"
|
|
|
|
|
#include "usart3.h"
|
|
|
|
|
#include "usart2.h"
|
|
|
|
|
#include "uart4.h"
|
|
|
|
|
#include "uart5.h"
|
2023-10-02 22:15:06 +08:00
|
|
|
#include "rs485.h"
|
2023-10-02 00:22:13 +08:00
|
|
|
#include "input_ck.h"
|
|
|
|
|
#include "wk2xx_hw.h"
|
2023-10-02 12:33:13 +08:00
|
|
|
#include "hmi_lcd_process.h"
|
2023-10-02 22:15:06 +08:00
|
|
|
#include "music_control.h"
|
2023-10-03 15:51:31 +08:00
|
|
|
#include "MDM_RTU_APP.h"
|
2023-10-05 23:10:18 +08:00
|
|
|
#include "e180-zg120.h"
|
|
|
|
|
#include "timer.h"
|
2023-10-06 21:18:23 +08:00
|
|
|
#include "sysinfo.h"
|
2023-10-01 01:56:55 +08:00
|
|
|
#include <assert.h>
|
|
|
|
|
|
2023-10-02 22:15:06 +08:00
|
|
|
void music2_send_bytes(u8 *bytes, int len)
|
|
|
|
|
{
|
2023-10-03 15:51:31 +08:00
|
|
|
/*在下面调用bsp的发送函数*/
|
|
|
|
|
wk_TxChars(2, len, bytes);
|
|
|
|
|
// 等待发送完成
|
|
|
|
|
wk_wait_tx_done(2);
|
2023-10-02 22:15:06 +08:00
|
|
|
}
|
|
|
|
|
|
2023-10-01 01:56:55 +08:00
|
|
|
void drv_init(void)
|
|
|
|
|
{
|
2023-10-02 00:22:13 +08:00
|
|
|
u_drv_init();
|
2023-10-01 01:56:55 +08:00
|
|
|
led_init();
|
|
|
|
|
relay_init();
|
|
|
|
|
IIC_Init();
|
2023-10-02 00:22:13 +08:00
|
|
|
adc_init();
|
2023-10-02 22:15:06 +08:00
|
|
|
queue_reset();
|
2023-10-02 00:22:13 +08:00
|
|
|
init_usart2(115200);
|
2023-10-02 22:15:06 +08:00
|
|
|
init_usart3(115200);
|
2023-10-02 00:22:13 +08:00
|
|
|
init_uart4(115200);
|
|
|
|
|
ext_input_check();
|
|
|
|
|
wk2xx_hw_init();
|
2023-10-06 21:18:23 +08:00
|
|
|
rs485_init();
|
2023-10-02 22:15:06 +08:00
|
|
|
Wk_DeInit(1);
|
|
|
|
|
Wk_DeInit(2);
|
|
|
|
|
Wk_DeInit(3);
|
|
|
|
|
Wk_DeInit(4);
|
|
|
|
|
Wk_Init(1);
|
|
|
|
|
Wk_Init(2);
|
|
|
|
|
Wk_Init(3);
|
|
|
|
|
Wk_Init(4);
|
|
|
|
|
Wk_SetBaud(1, B115200);
|
|
|
|
|
Wk_SetBaud(2, B115200);
|
|
|
|
|
Wk_SetBaud(3, B115200);
|
|
|
|
|
Wk_SetBaud(4, B9600);
|
2023-10-02 00:22:13 +08:00
|
|
|
|
2023-10-01 01:56:55 +08:00
|
|
|
spl0601_init();
|
2023-10-02 12:33:13 +08:00
|
|
|
LCD_init();
|
2023-10-02 22:15:06 +08:00
|
|
|
|
2023-10-06 21:18:23 +08:00
|
|
|
if (sys_info_read() < 0)
|
|
|
|
|
{
|
|
|
|
|
sys_info_save();
|
|
|
|
|
bluetooth_set_CP(0, "02");
|
|
|
|
|
bluetooth_set_CP(1, "02");
|
|
|
|
|
}
|
2023-10-02 22:15:06 +08:00
|
|
|
|
|
|
|
|
bluetooth_init_cfg(0, usart2_send_bytes);
|
|
|
|
|
bluetooth_init_cfg(1, music2_send_bytes);
|
2023-10-03 15:51:31 +08:00
|
|
|
|
|
|
|
|
MDM_RTU_APPInit();
|
2023-10-05 23:10:18 +08:00
|
|
|
|
|
|
|
|
// timer_init();
|
|
|
|
|
|
2023-10-06 16:29:34 +08:00
|
|
|
mod_reset(0, 0xffff, 0);
|
|
|
|
|
mod_set_node_type(COD_TYPE);
|
|
|
|
|
mod_reset(0, 0xffff, 0);
|
|
|
|
|
mod_start_cfg_net(2);
|
|
|
|
|
|
|
|
|
|
local_read_net_node_0x22_all();
|
2023-10-01 01:56:55 +08:00
|
|
|
}
|