| | |
| | | .flow = UART_FLOW_CONTROL_NONE, |
| | | .rx_level = UART_RXFIFO_CHAR_1, |
| | | .tx_level = UART_TXFIFO_EMPTY, |
| | | .baud = BAUD_9600, |
| | | .baud = BAUD_115200, |
| | | #if (TEST_UART_MODE == TEST_UART_POLL_MODE) |
| | | .dma_en = false, |
| | | .int_rx = false, |
| | |
| | | uint8_t bind_flag; |
| | | int8_t bind_count=BIND_COUNT_NUM; |
| | | extern uint8_t find_flag; |
| | | uint8_t poll_count,poll_flag; |
| | | void SecondTask(void) |
| | | {static uint8_t second_count; |
| | | if(second_count++>60) |
| | |
| | | second_count = 0; |
| | | MinuteTask(); |
| | | } |
| | | poll_flag=1; |
| | | // if(bind_flag) |
| | | // { |
| | | // if(bind_count--<=0) |
| | |
| | | ip3 = (g_com_map[TCP_IP_3]>>12&0xf)*1000+(g_com_map[TCP_IP_3]>>8&0xf)*100+(g_com_map[TCP_IP_3]>>4&0xf)*10+(g_com_map[TCP_IP_3]&0xf); |
| | | port = g_com_map[TCP_PORT]; |
| | | g_com_map[VERSION] = (1<<8)|0; |
| | | gpio_pin_set(CHANGE_UART_PIN);//;拉高打印输出 |
| | | LOG_INFO(TRACE_MODULE_APP,"设备ID: %x .\r\n",dev_id); |
| | | LOG_INFO(TRACE_MODULE_APP,"固件版本:MK_无感闸机 V%d.%d. \r\n",g_com_map[VERSION]>>8,g_com_map[VERSION]&0xff); |
| | | LOG_INFO(TRACE_MODULE_APP,"服务器地址: %d.%d.%d.%d:%d.\r\n",ip0,ip1,ip2,ip3,port); |
| | | while(uart_tx_in_progress(UART_ID0)); |
| | | gpio_pin_clr(CHANGE_UART_PIN);//;拉低输入 |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | // open system timer |
| | | //sys_timer_open(); |
| | | gpio_open(); |
| | | LED_output_init();//配置彩色灯引脚 |
| | | LED_output_init();//配置串口控制脚 |
| | | |
| | | adc_open(&usr_adc_cfg); |
| | | |
| | | Program_Init(); |
| | | //uart_open(UART_ID1, &test_uart_cfg); |
| | | // uart1_change_from_gps_to_debug(); |
| | | //Uart1GpsRecDebugSend(); |
| | | uart_receive(UART_ID0,m_EUART0_DMA_RXBuf,EUART0_RX_BUF_SIZE,uart0_receive_callback); |
| | | |
| | | uart_open(UART_ID1, &test_uart_cfg); |
| | | uart_receive(UART_ID1,m_EUART1_DMA_RXBuf,EUART1_RX_BUF_SIZE,uart1_receive_callback); |
| | | uart_receive(UART_ID0,m_EUART0_DMA_RXBuf,EUART0_RX_BUF_SIZE,uart0_receive_callback); |
| | | // Initialize low power mode |
| | | power_init(); |
| | | sleep_timer_open(true, SLEEP_TIMER_MODE_RELOAD, sleep_timer_callback); |
| | | sleep_timer_start(__MS_TO_32K_CNT(SLEEP_TIMER_NUM));//测试 |
| | | adc_get(&sample[0], NUM_SAMPLES, adc_callback);//adc采样 |
| | | //board_acceleration_detection_init(move_handler); |
| | | // pca_input_detection_init(pca_handler);//pca检测输入 |
| | | //board_4GUsart_detection_init(_4gUsart_handler); |
| | | //Uwb_init(); |
| | | uwb_open(); |
| | | Anchor_uwb_aoa_square_init(); |
| | | |
| | | OpenUWB(); |
| | | while (1) |
| | | { |
| | | uwb_app_poll(); |
| | | if(poll_flag) |
| | | { |
| | | CloseUWB();//关闭接收 |
| | | Tag_uwb_aoa_square_init(); |
| | | TagRange(); //做标签 |
| | | Anchor_uwb_aoa_square_init(); |
| | | poll_flag=0; |
| | | OpenUWB(); |
| | | } |
| | | if(flag_secondtask) |
| | | { |
| | | flag_secondtask = 0; |