| | |
| | | #define NSH1 0x0001 |
| | | #define GP 0x0002 |
| | | #define FLASH_HARDWARE_VERSION_MAP (uint32_t)0x08004F00 //硬件版本号和批次信息位置 |
| | | //#define DEBUG_MODE |
| | | #define DEBUG_MODE |
| | | /* USER CODE END Includes */ |
| | | |
| | | /* Private typedef -----------------------------------------------------------*/ |
| | |
| | | slot_startcount=tyncpoll_time*1000/LPTIMER_LSB; |
| | | lastpoll_time=tyncpoll_time; |
| | | tag_frequency = 1000/g_com_map[COM_INTERVAL]; |
| | | bigslot_num = TOTAL_SLOTNUM/tag_frequency; |
| | | // bigslot_num = TOTAL_SLOTNUM/tag_frequency; |
| | | total_slotnum = 1000/g_com_map[COM_INTERVAL]; |
| | | nomovesleeptime = g_com_map[NOMOVESLEEP_TIME]; |
| | | if(active_flag==0) |
| | |
| | | } |
| | | extern uint8_t tx_near_msg[80],stationary_flag; |
| | | float key_keeptime; |
| | | uint16_t current_count1; |
| | | uint16_t lpcount1; |
| | | void HAL_LPTIM_CompareMatchCallback(LPTIM_HandleTypeDef *hlptim) |
| | | { |
| | | static uint8_t i=0; |
| | |
| | | g_start_send_flag=1; |
| | | current_slotnum++; |
| | | // SetNextPollTime(tyncpoll_time); |
| | | |
| | | current_count1=HAL_LPTIM_ReadCounter(&hlptim1); |
| | | lpcount1 = current_count1+32.768*g_com_map[COM_INTERVAL];; |
| | | if(lpcount1>=32768) |
| | | { |
| | | lpcount1 -=32768; |
| | | } |
| | | __HAL_LPTIM_COMPARE_SET(&hlptim1, lpcount1); |
| | | |
| | | |
| | | nomove_count+=(float)g_com_map[COM_INTERVAL]/1000; |
| | | if(motor_keeptime>0) |
| | | { |
| | |
| | | } |
| | | if(nomove_count>=nomovesleeptime-1&&imu_enable) |
| | | { |
| | | tx_near_msg[TAGSTATE] = tx_near_msg[TAGSTATE]|GOINGSLEEPBIT; |
| | | // tx_near_msg[TAGSTATE] = tx_near_msg[TAGSTATE]|GOINGSLEEPBIT; |
| | | } |
| | | if(nomove_count>nomovesleeptime&&imu_enable) |
| | | { |