Exemple #1
0
/**
 * Little function to give visual feedback that the device is working.
 */
void hello( void ) {
	int i = 0;
	for ( i = 0; i < TOTAL_LEDS; i++ ) {
		toggle_led( i );
		delay(1000);
	}
	for ( i = 0; i < 3; i++ ) {
		toggle_all(); //off
		delay(1000);
		toggle_all(); //on
		delay(1000);
	}
	toggle_all(); //final off
}
Exemple #2
0
/*----------------------------------------------------------------------------
  MAIN function
 *----------------------------------------------------------------------------*/
int main(void){
	
	//Initialise LEDs, buttons and interrupts
	init_RGB();
	init_switches();
	init_interrupts();
	done = 0;
	
	while(1){
		switch(done){
			
			//Toggle corresponding bits depending on which button was pressed
			
			case 1:
				toggle_r();
				break;
			case 2:
				toggle_g();
				break;
			case 3:
				toggle_b();
				break;
			case 4:
				toggle_all();
				break;
		}
		
		done = 0;
		delay(1);
		
		if (done == 0) //if done == 0, processor goes to sleep
			__wfi();
	}
}