Esempio n. 1
0
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
}
Esempio n. 2
0
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; 
		}
	}
}
Esempio n. 3
0
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();
}