| | |
| | | #define TEST_UART_MODE TEST_UART_DMA_MODE |
| | | |
| | | #define NUM_SAMPLES 1 |
| | | #define SLEEP_START_TIME 30 |
| | | #define SLEEP_START_TIME 10 |
| | | #define FREQ_LOST_TIME 5 |
| | | #define NOTAG_FREQ 1 |
| | | uint8_t enable_sleep_count,sleep_flag; |
| | | //#define DEBUG_MODE |
| | | |
| | |
| | | uint8_t bat_percent; |
| | | extern uint32_t dev_id; |
| | | extern uint8_t group_id; |
| | | uint8_t tag_frequence; |
| | | extern float freqlost_count; |
| | | uint8_t tag_frequency; |
| | | void UartDeinit(void); |
| | | void UartInit(void); |
| | | void Program_Init(void); |
| | |
| | | static void sleep_timer_callback(void *dev, uint32_t time) |
| | | { |
| | | //sleep_timer_start(__MS_TO_32K_CNT(1000)); |
| | | static uint8_t lost_jumpcount=0; |
| | | enable_sleep_count++; |
| | | if(enable_sleep_count==SLEEP_START_TIME){ |
| | | |
| | | enable_sleep_count=0; |
| | | sleep_flag=1; |
| | | } |
| | | g_start_send_flag=1; |
| | | //LOG_INFO(TRACE_MODULE_APP, "Sleep timer interrupt callback\r\n"); |
| | | // if(freqlost_count++>FREQ_LOST_TIME) |
| | | // { |
| | | // tag_frequency = NOTAG_FREQ; |
| | | // if(lost_jumpcount++>=4) //无测距情况下,每5秒发一次; |
| | | // { |
| | | // lost_jumpcount = 0; |
| | | // g_start_send_flag=1; |
| | | // } |
| | | // }else{ |
| | | // g_start_send_flag=1; |
| | | // } |
| | | g_start_send_flag=1; |
| | | } |
| | | static void adc_callback(void *data, uint32_t number) |
| | | { |
| | |
| | | parameter_init();//g_com_map表初始化 |
| | | group_id=g_com_map[GROUP_ID]; |
| | | memcpy(&dev_id ,&g_com_map[DEV_ID],2); |
| | | tag_frequence=1000/g_com_map[COM_INTERVAL]; |
| | | tag_frequency=1000/g_com_map[COM_INTERVAL]; |
| | | g_com_map[VERSION] = (1<<8)|5; |
| | | LOG_INFO(TRACE_MODULE_APP,"设备ID: %x .\r\n",dev_id); |
| | | LOG_INFO(TRACE_MODULE_APP,"固件版本:UWB-标签 V%d.%d. \r\n",g_com_map[VERSION]>>8,g_com_map[VERSION]&0xff); |