void LEDx_ONOFF(u8 numx) { static uint32_t Ledx_temp; static u8 Ledx_sta=1,busy=0; static u8 num; num = numx; if(Ledx_sta) { if(!busy) { Ledx_temp = time_nowMs(); busy = 1; } else if((Ledx_temp+200) < time_nowMs()) { switch (num) { case 1 : LED_B_ON; break; case 2 : LED_R_ON; break; case 3 : LED_G_ON; break; default : ; } busy = 0; Ledx_sta = 0; } } else { if(!busy) { Ledx_temp = time_nowMs(); busy = 1; } else if((Ledx_temp + 200) < time_nowMs()) { switch (num) { case 1 : LED_B_OFF; break; case 2 : LED_R_OFF; break; case 3 : LED_G_OFF; break; default : ; } busy = 0; Ledx_sta = 1; } } }
int32_t hmc5883_isDataReady(void) { static uint32_t target = 0; uint32_t now = time_nowMs(); if(target <= now) { target = now + 20;//50Hz // return 1; } return 0; }
int32_t mpu6050_dataIsReady(void) { static uint32_t target = 0; uint32_t now = time_nowMs(); if(target <= now) { target = now + 3;//333Hz // return 1; } return 0; }