void LiveInLight (void){ PORTB &= ~(1<<LedPin); // Light-up LED PWMStop(); while (1){ EnableInput (); DeepSleep(); DisableInput (); if (Valto != None) { EventHandler (); // if key pressed then shutdown if (Valto==KeyPressed) break; } } PWMStart(250); PORTB |= (1<<LedPin); // Shutdown LED }
void LightUp (void){ uint8_t i; PWMStart(0); // Enable shutdown at Light-up for (i=0; i<=250; i++){ PWMSet (i); EnableInput (); if (i<PWMStepOver) Wait (PWMSlowDelay); else Wait (PWMQuickDelay); DisableInput (); if (Valto != None) { EventHandler (); // if key pressed then shutdown if (Valto==KeyPressed) break; } } }
void InitAll() { __disable_irq(); TimInit(); PWMStart(); InputDecoder(); UartInit(); FlashInit(); SDFatFSInit(); printf("mpu6050 id:0x%x\r\n",MPU6050_Init()); IMU_Init(); UIInit(); sys.status = READY; HAL_ADC_Start(&hadc1); printf("init finish!\r\n"); __enable_irq(); }