| | |
| | | } |
| | | |
| | | } |
| | | HIDO_TimerTick(); |
| | | // HIDO_TimerTick(); |
| | | nomove_count++; |
| | | } |
| | | uint8_t flag_sleeptimer,flag_secondtask,secondtask_count; |
| | |
| | | static void sleep_timer_callback(void *dev, uint32_t time) |
| | | { |
| | | g_start_send_flag=1; |
| | | HIDO_TimerTick(); |
| | | // #ifdef DEBUG_BOXING |
| | | //// gpio_pin_clr(IO_PIN_5);//测试 |
| | | // gpio_pin_set(IO_PIN_5);//测试 |
| | | // lora_wg_up=1; |
| | | |
| | | lora_tx_flag++; |
| | | lora_tx_flag=1; |
| | | // lora_qiehuan++; |
| | | // IO_control_init(); |
| | | // UWBPoll(); |
| | |
| | | // g_com_map[GROUP_ID]=1; |
| | | dev_id=g_com_map[DEV_ID];//这里不太对 |
| | | group_id=g_com_map[GROUP_ID];//组ID |
| | | g_com_map[LORA_POWER]=22; |
| | | tag_frequency = 1000/g_com_map[COM_INTERVAL];//测距频率这个存的是测距时间 |
| | | memcpy(&disoffset,&g_com_map[DIST_OFFSET],2); |
| | | // g_com_map[ALARM_DISTANCE1] = 40; |
| | |
| | | /********************************************************************************************************/ |
| | | /********************************************************************************************************/ |
| | | /********************************************************************************************************/ |
| | | //static uint16_t delaytime = 771; |
| | | //extern uint16_t wg_report_freq,wg_report_id; |
| | | //extern uint32_t wg_lost_count; |
| | | //extern uint8_t shengji_flag; |
| | | //extern uint8_t lora_jianting_flag,report_ancnum; |
| | | //uint8_t imu_enable,motor_enable; |
| | | //uint32_t time_flag_lorarx=0; |
| | | //uint32_t lora_huanxing_count=0; |
| | | //uint16_t Lora_wangguanid=0; |
| | | //wg_state_enum wg_state = WG_Lost; |
| | | //uint16_t wangguan_up_id; |
| | | //uint8_t LoraUp_flag; |
| | | //uint16_t rec_wenjian_daxiao; |
| | | //uint16_t recnum[3]; |
| | | //uint16_t recv_flag=0; |
| | | //uint16_t tx_flag=0; |
| | | //uint16_t CRC16=0; |
| | | //uint16_t DEST_ID=0; |
| | | //uint16_t rec_value,rec_delaytime,rx_count,datalen_offset; |
| | | //uint16_t Loratx_flag=0; |
| | | //uint16_t Lorarx_flag=0; |
| | | //uint16_t Lorarx_time_out_flag=0; |
| | | //uint8_t tx_buf[5]={0,1,0,1,1}; |
| | | //uint32_t sleep_time_count=0; |
| | | //uint32_t uwb_ceju_count=0; |
| | | |
| | | wg_state_enum wg_state = WG_Lost; |
| | | /********************************************************************************************************/ |
| | | static void Lora_irq_handler(enum IO_PIN_T pin) |
| | |
| | | uint8_t TXBuffer[8]={0,1,2,3,4,5,6,7}; |
| | | uint8_t test_buf[10]={0,1,1,1,1,1,1,1,1,1}; |
| | | int main(void) |
| | | |
| | | { |
| | | board_clock_run(); |
| | | // boot_deinit(); |
| | |
| | | //board_led_init(); |
| | | spi_init(); |
| | | Board_LORA_NVIC_Init(Lora_irq_handler); |
| | | pca_input_detection_init(pca_handler); |
| | | IIC2_Init(); |
| | | Accelerometer_Init(); |
| | | PCA9555_init(); |
| | | Lora_1268_Init(); |
| | | SwitchLoraSettings(478,7,22); |
| | | // SwitchLoraSettings(473,7,0); |
| | | Program_Init(); |
| | | |
| | | sleep_timer_open(true, SLEEP_TIMER_MODE_RELOAD, sleep_timer_callback); |
| | | sleep_timer_start(__MS_TO_32K_CNT(1000));//测试 |
| | | |
| | | |
| | | |
| | | Uwbinit(); |
| | | OpenUWB(); |
| | | |
| | | while (1) |
| | | { |
| | | Lora_Tx_Poll(); |
| | | // uwb_app_poll(); |
| | | IdleTask(); |
| | | } |
| | | } |