Example #1
0
// ----------- Initialise built in devices ------
void sysInitHardware(void){
	SWITCH_init(&_button_);
	setErrorLog(&uart1SendByte);
	rprintfInit(&uart1SendByte);
	uartInit(_C_uart1,115200);
	segled_init(&_led_display_);
}
Example #2
0
int main ()
{
	init_HSI ();
	init_PLL ();
	//encoder_init ();
	segled_init ();
	button_init ();
	tim14_init ();
	buffer (5632);
	
	while (1)
	{
		
		if (flag1==1)
		{
			GPIOA->ODR ^= 1 << 15;
			flag1=0;
		}	
		if (flag1==2)
		{
			NVIC_DisableIRQ(TIM14_IRQn);
			flag_seg ^= 1;	
			flag1=0;
			NVIC_EnableIRQ (TIM14_IRQn);
		}
			if (flag1==3)
		{
			NVIC_DisableIRQ(TIM14_IRQn);
			GPIOA->ODR |= 1 << 15;
			delay_ms (500);
			GPIOA->ODR &= ~(1 << 15);
			delay_ms (500);
			GPIOA->ODR |= 1 << 15;
			delay_ms (500);
			GPIOA->ODR &= ~(1 << 15);
			delay_ms (500);			
			flag1=0;
			NVIC_EnableIRQ (TIM14_IRQn);
		}	
			if (flag1==4)
		{
			NVIC_DisableIRQ(TIM14_IRQn);
			GPIOA->ODR |= 1 << 15;
			delay_ms (1500);
			GPIOA->ODR &= ~(1 << 15);
			delay_ms (1500);
			GPIOA->ODR |= 1 << 15;
			delay_ms (1500);
			GPIOA->ODR &= ~(1 << 15);
			delay_ms (1500);			
			flag1=0;
			NVIC_EnableIRQ (TIM14_IRQn);
		}			
	}
}