| | |
| | | #include "HIDO_Timer.h" |
| | | #include "TCPClient.h" |
| | | |
| | | #define DEBUG_MODE |
| | | //#define DEBUG_MODE |
| | | extern int simple_main(void); |
| | | extern int temp_main(void); |
| | | #define TEST_UART_POLL_MODE 0 |
| | |
| | | } |
| | | //UWB更新列表 |
| | | TagListUpdate(); |
| | | //GPS_Poll(); |
| | | gps_power_state=1;//测试gps长开 |
| | | GPS_Poll(); |
| | | //gps_power_state=1;//测试gps长开 |
| | | //UWB状态检测 |
| | | |
| | | if(IfTCPConnected()) |
| | |
| | | |
| | | static void sleep_timer_callback(void *dev, uint32_t time) |
| | | { |
| | | IO_control_init(); |
| | | // IO_control_init(); |
| | | if(tt) |
| | | UWBPoll(); |
| | | //车载poll |
| | |
| | | nomove_count=0; |
| | | } |
| | | uint8_t flag_4G_recdata; |
| | | static void _4gUsart_handler(enum IO_PIN_T pin) |
| | | void _4gUsart_handler(enum IO_PIN_T pin) |
| | | { |
| | | LOG_INFO(TRACE_MODULE_APP, "4G RX 唤醒\r\n"); |
| | | flag_4G_recdata = 1; |
| | |
| | | uint8_t flag_4guart_needinit=0; |
| | | uint8_t index1,index2,index3; |
| | | int tt2; |
| | | int test1,test3; |
| | | uint32_t test4; |
| | | int main(void) |
| | | { |
| | | board_clock_run(); |
| | |
| | | //board_led_init(); |
| | | |
| | | adc_open(&usr_adc_cfg); |
| | | |
| | | IIC2_Init(); |
| | | Accelerometer_Init(); |
| | | IO_control_init(); |
| | | io_pin_mux_set(SCL_PIN, IO_FUNC0);//测试测距波形 |
| | | gpio_pin_set_dir(SCL_PIN , GPIO_DIR_OUT, 0); |
| | | io_pull_set(SCL_PIN , IO_PULL_DOWN, IO_PULL_UP_LEVEL4); |
| | | gps_air780_power_change(1,1);//开启gps,4G |
| | | gps_air780_power_change(0,1);//开启gps,4G |
| | | //加速度计初始化必须在IO_control_init之前因为复用SDA引脚 |
| | | adc_get(&sample[0], NUM_SAMPLES, adc_callback);//adc采样 |
| | | Program_Init(); |
| | |
| | | sleep_timer_start(__MS_TO_32K_CNT(SLEEP_TIMER_NUM));//测试 |
| | | // board_5V_input_init(voltage_input_handler); |
| | | board_acceleration_detection_init(move_handler); |
| | | board_4GUsart_detection_init(_4gUsart_handler); |
| | | // LOG_INFO(TRACE_MODULE_APP, "测试进入app"); |
| | | |
| | | board_4GUsart_detection_init(_4gUsart_handler); |
| | | while (1) |
| | | { |
| | | tt2 = gpio_pin_get_val(_4G_USART_RX_Pin); |
| | |
| | | { |
| | | flag_4G_recdata = 2; |
| | | |
| | | LOG_INFO(TRACE_MODULE_APP, "运行Socket_RecvAll\r\n"); |
| | | LOG_INFO(TRACE_MODULE_APP, "运行Socket_RecvAll tt2 %d\r\n",tt2); |
| | | Socket_RecvAll(); |
| | | } |
| | | air780_led_on(); |
| | |
| | | index1=IfTCPConnected(); |
| | | index2=AIR780E_IsIPIdle(); |
| | | index3=Socket_IsSendQueueEmpty(0); |
| | | if(delaysleep_count==0) |
| | | if(!gps_power_state&&(IfTCPConnected()&&AIR780E_IsIPIdle()&&Socket_IsSendQueueEmpty(0))) |
| | | { |
| | | test1=gpio_pin_get_val(_4G_USART_RX_Pin); |
| | | uint32_t lock; |
| | | flag_4guart_needinit = 1; |
| | | //flag_4guart_needinit = 1; |
| | | Internet_Poll(); |
| | | HIDO_ATLitePoll(); |
| | | HIDO_TimerPoll(); |
| | | TCPClient_Poll(); |
| | | // power_wakeup_enable((enum POWER_WAKEUP_SOURCE_T)_4G_USART_RX_Pin, POWER_WAKEUP_LEVEL_LOW); |
| | | LOG_INFO(TRACE_MODULE_APP, "进入休眠\r\n"); |
| | | |
| | | // delay_us(300000); |
| | | trace_flush(); |
| | | lock = int_lock(); |
| | | power_enter_power_down_mode(0); |
| | | uart_receive(UART_ID1,m_EUART_DMA_RXBuf,EUART_RX_BUF_SIZE,uart_receive_callback); |
| | | test3=gpio_pin_get_val(_4G_USART_RX_Pin); |
| | | LOG_INFO(TRACE_MODULE_APP, "进入休眠\r\n"); |
| | | int_unlock(lock); |
| | | } |
| | | |