Exemplo n.º 1
0
void SwitchLEDExample()
{
	LED_Init();
	Switch_Init();

	unsigned char switch_state = 0;
	unsigned char switch_on;

	LED_Off(LED0|LED1|LED2|LED3);

	while (1)
	{
		switch_on = Switch_On(SWITCH2);

		if (!switch_state && switch_on)
		{
			LED_On(LED0|LED1|LED2|LED3);
			switch_state = 1;
		}
		else if (switch_state && ~switch_on)
		{
			LED_Off(LED0|LED1|LED2|LED3);
			switch_state = 0;
		}
	}
}
Exemplo n.º 2
0
Arquivo: Blinky.c Projeto: mad-et/ex
/*----------------------------------------------------------------------------
 *      Thread 4 'phaseD': Phase D output
 *---------------------------------------------------------------------------*/
void phaseD (void  const *argument) {
  for (;;) {
    osSignalWait(0x0001, osWaitForever);    /* wait for an event flag 0x0001 */
    Switch_On (LED_D);
    signal_func(tid_phaseA);                /* call common signal function   */
    Switch_Off(LED_D);
  }
}
Exemplo n.º 3
0
Arquivo: Blinky.c Projeto: mad-et/ex
/*----------------------------------------------------------------------------
 *      Thread 5 'clock': Signal Clock
 *---------------------------------------------------------------------------*/
void clock (void  const *argument) {
  for (;;) {
    osSignalWait(0x0100, osWaitForever);    /* wait for an event flag 0x0100 */
    Switch_On (LED_CLK);
    osDelay(80);                            /* delay  80ms                   */
    Switch_Off(LED_CLK);
  }
}