| | |
| | | }; |
| | | void uart_receive_callback(void *dev, uint32_t err_code) |
| | | { |
| | | uart_receive(UART_ID1,m_EUART_DMA_RXBuf,EUART_RX_BUF_SIZE,uart_receive_callback); |
| | | uart_receive(UART_ID0,m_EUART_DMA_RXBuf,EUART_RX_BUF_SIZE,uart_receive_callback); |
| | | } |
| | | void mcu_deep_sleep(void) |
| | | { |
| | |
| | | |
| | | } |
| | | #define BIND_COUNT_NUM 50 |
| | | uint8_t bind_flag,bind_count=BIND_COUNT_NUM; |
| | | uint8_t bind_flag=1,bind_count=BIND_COUNT_NUM; |
| | | extern uint8_t find_flag; |
| | | void SecondTask(void) |
| | | {static uint8_t second_count; |
| | |
| | | if(bind_count--<=0) |
| | | { |
| | | bind_count=BIND_COUNT_NUM; |
| | | copy_taglist_to_flash(); |
| | | copy_taglist_to_flash(); |
| | | sys_reset(0); |
| | | bind_flag=0; |
| | | } |
| | | } |
| | |
| | | } |
| | | void IdleTask(void) |
| | | { |
| | | if(read_5v_input_pca()) |
| | | { |
| | | if(state5v==0) |
| | | { |
| | | state5v=1; |
| | | state5V_prase_flag=state5v; |
| | | gps_prase_flag=0;//解除gps解析 |
| | | uart1_change_from_gps_to_debug();//测试 |
| | | PCA9555_Set_One_Value_Output(MCU_A,1);//输出高电平切换为5V输入 |
| | | } |
| | | }else { |
| | | if(state5v==1) |
| | | { |
| | | g_com_map[MODBUS_MODE] = 0; |
| | | state5v=0; |
| | | state5V_prase_flag=state5v; |
| | | gps_prase_flag=1;//恢复gps解析 |
| | | uart1_change_from_debug_to_gps();//测试 |
| | | PCA9555_Set_One_Value_Output(MCU_A,0);//输出低电平切换为GPS |
| | | } |
| | | } |
| | | UART_CheckReceive(); |
| | | //if(read_5v_input_pca()) |
| | | // { |
| | | // if(state5v==0) |
| | | // { |
| | | // state5v=1; |
| | | // state5V_prase_flag=state5v; |
| | | // gps_prase_flag=0;//解除gps解析 |
| | | // uart1_change_from_gps_to_debug();//测试 |
| | | // PCA9555_Set_One_Value_Output(MCU_A,1);//输出高电平切换为5V输入 |
| | | // } |
| | | // }else { |
| | | // if(state5v==1) |
| | | // { |
| | | // g_com_map[MODBUS_MODE] = 0; |
| | | // state5v=0; |
| | | // state5V_prase_flag=state5v; |
| | | // gps_prase_flag=1;//恢复gps解析 |
| | | // uart1_change_from_debug_to_gps();//测试 |
| | | // PCA9555_Set_One_Value_Output(MCU_A,0);//输出低电平切换为GPS |
| | | // } |
| | | // } |
| | | UART0_CheckReceive(); |
| | | } |
| | | void boot_deinit(void) |
| | | { |
| | |
| | | board_clock_run(); |
| | | boot_deinit(); |
| | | board_pins_config(); |
| | | board_debug_console_open_baud(TRACE_PORT_UART1,BAUD_115200); |
| | | board_debug_console_open_baud(TRACE_PORT_UART0,BAUD_115200); |
| | | // Reset reason |
| | | reset_cause_get(); |
| | | reset_cause_clear(); |
| | |
| | | //uart_open(UART_ID1, &test_uart_cfg); |
| | | // uart1_change_from_gps_to_debug(); |
| | | //Uart1GpsRecDebugSend(); |
| | | uart_receive(UART_ID1,m_EUART_DMA_RXBuf,EUART_RX_BUF_SIZE,uart_receive_callback); |
| | | uart_receive(UART_ID0,m_EUART_DMA_RXBuf,EUART_RX_BUF_SIZE,uart_receive_callback); |
| | | |
| | | // Initialize low power mode |
| | | power_init(); |