Скачиваний:
10
Добавлен:
05.09.2014
Размер:
1 Кб
Скачать
/***************************************
*
*	   LETI traning 2011
*
***************************************/
#include "LPC17xx.h"                    /* LPC17xx definitions                */
#include "timer.h"     
#include "leds.h"     
#include "eint.h"     
#include "GLCD.h"
#include "states.h"    

extern int led;
extern int state;
extern char* s="Hello";
//---
void timer0_init(void) {
	
	LPC_TIM0->MCR = 3;	//setup
	LPC_TIM0->MR0 = 1 * (10000 / 4);	//1 sec

	NVIC_EnableIRQ((IRQn_Type) TIMER0_IRQn); //enable timer interrupt

 	LPC_TIM0->TCR = 1;//start
}

//--
void TIMER0_IRQHandler (void) __irq {

 	LPC_TIM0->IR = 1;	//clear int	
	switch (state){
	case STATE_HELLO:
	GLCD_Clear(White);
	GLCD_SetTextColor(Black);
	GLCD_DisplayString(1,1,(unsigned char*)s);
	   	state= STATE_HELLO_CV;
		break;
	    case STATE_HELLO_CV:
		GLCD_Clear(White);
	GLCD_SetTextColor(Blue);
	GLCD_DisplayString(1,1,(unsigned char*)s);
	   	state= STATE_HELLO;
		break;}	
}
Соседние файлы в папке src