| | |
| | | extern uint8_t lora_tx_flag; |
| | | static void sleep_timer_callback(void *dev, uint32_t time) |
| | | { |
| | | |
| | | |
| | | g_start_send_flag=1; |
| | | // HIDO_TimerGetTick(); |
| | | HIDO_TimerTick(); |
| | |
| | | { |
| | | stationary_flag = 0; |
| | | } |
| | | nomove_count++; |
| | | // nomove_count++; |
| | | #ifdef DEBUG_BOXING |
| | | // gpio_pin_clr(BOXING_PIN);//测试 |
| | | gpio_pin_set(BOXING_PIN);//测试 |
| | | #endif |
| | | delay_us(1000); |
| | | } |
| | | |
| | | void phy_timer_callback(uint32_t time) |
| | | { |
| | | lora_tx_flag++; |
| | | } |
| | | //void phy_timer_callback(uint32_t time) |
| | | //{ |
| | | // lora_tx_flag++; |
| | | //} |
| | | |
| | | void uart0_receive_callback() |
| | | { |
| | |
| | | g_com_map[STATIONARY_TIME] = 10; |
| | | // g_com_map[GROUP_ID]=1; |
| | | dev_id=g_com_map[DEV_ID];//这里不太对 |
| | | group_id=g_com_map[GROUP_ID];//组ID |
| | | // group_id=g_com_map[GROUP_ID];//组ID |
| | | group_id=0x04; |
| | | tag_frequency = 1000/g_com_map[COM_INTERVAL];//测距频率这个存的是测距时间 |
| | | memcpy(&disoffset,&g_com_map[DIST_OFFSET],2); |
| | | // g_com_map[ALARM_DISTANCE1] = 40; |
| | |
| | | uart_receive(UART_ID0,m_EUART_DMA_RXBuf,EUART_RX_BUF_SIZE,uart0_receive_callback);//开启dma |
| | | |
| | | //串口1 |
| | | io_pin_mux_set(UART1_RX, IO_FUNC4); |
| | | io_pin_mux_set(UART1_TX, IO_FUNC4); |
| | | // io_pin_mux_set(UART1_RX, IO_FUNC4); |
| | | // io_pin_mux_set(UART1_TX, IO_FUNC4); |
| | | } |
| | | void spi_init() |
| | | { |
| | |
| | | Board_gpio_init(); |
| | | //board_led_init(); |
| | | spi_init(); |
| | | |
| | | |
| | | Board_LORA_NVIC_Init(Lora_irq_handler); |
| | | pca_input_detection_init(pca_handler); |
| | | IIC2_Init(); |
| | |
| | | sleep_timer_open(true, SLEEP_TIMER_MODE_RELOAD, sleep_timer_callback); |
| | | sleep_timer_start(__MS_TO_32K_CNT(1000));//测试 |
| | | |
| | | |
| | | #ifdef DEBUG_BOXING |
| | | io_pin_mux_set(BOXING_PIN,IO_FUNC0); |
| | | gpio_pin_set_dir(BOXING_PIN,GPIO_DIR_OUT,0); |
| | | io_pull_set(BOXING_PIN,IO_PULL_DOWN,IO_PULL_UP_LEVEL4); |
| | | #endif |
| | | Uwbinit(); |
| | | OpenUWB(); |
| | | while (1) |
| | | { |
| | | #ifdef DEBUG_BOXING |
| | | gpio_pin_clr(BOXING_PIN);//测试 |
| | | // gpio_pin_set(BOXING_PIN);//测试 |
| | | #endif |
| | | Lora_Tx_Poll(); |
| | | uwb_app_poll(); |
| | | IdleTask(); |