yincheng.zhong
2024-04-11 9e3a42e5b5975b5abc42f9b60d90c9346fe9f83a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
            ancsync_time=((sync_timer+0)*1000+tmp_time);
            current_count=HAL_LPTIM_ReadCounter(&hlptim1);
        //    count_offset=sync_count-current_count-143;
        //    current_slottimes=(ancsync_time-10000)/(g_com_map[COM_INTERVAL]*1000);
            nextpoll_delaytime=tyncpoll_time*1000+g_com_map[COM_INTERVAL]*1000-((ancsync_time-10000)%(g_com_map[COM_INTERVAL]*1000))-5150;
            if(abs(ancsync_time-910000)<1000)
            {
            nextpoll_delaytime+=10000;
            }        
            if(nextpoll_delaytime<2000)
            {
                nextpoll_delaytime+=g_com_map[COM_INTERVAL]*1000;
            }
            lastpoll_count= current_count+(nextpoll_delaytime)/LPTIMER_LSB;
            if(lastpoll_count>LPTIMER_1S_COUNT)
                lastpoll_count-=LPTIMER_1S_COUNT;
            __HAL_LPTIM_COMPARE_SET(&hlptim1, lastpoll_count);