Exemplo n.º 1
0
void ledInit(void) {
	locked_led(1);		// turn on Locked led
	unlocked_led(0);	// turn off unlocked
	hold_led(1);    // hold on
	repair_led(1); // repair on
	pin_led(0); // pin off
	noconn_led(1); // no conn off
	Lite(0); // front and back led lighting off
}
Exemplo n.º 2
0
void turnOffLEDS(void) {
	locked_led(0);		// turn off Locked led
	unlocked_led(0);	// turn off unlocked
	hold_led(0);    // hold off
	repair_led(0); // repair off
	pin_led(0); // pin off
	noconn_led(0); // no conn off
	Lite(0); // front and back led lighting off
	
}
Exemplo n.º 3
0
int
main (void)
{
  int t, firstrun;
  volatile int i;

  /* Initialize GPIO (sets up clock) */
  GPIOInit ();
  /* initialize  pins */
  pin_init ();
  /* setup SPI chipselect pins */
  spi_init_pin (SPI_CS_NRF);

  /* blink as a sign of boot to detect crashes */
  for (t = 0; t < 10; t++)
    {
      pin_led (GPIO_LED0);
      for (i = 0; i < 100000; i++);
      pin_led (GPIO_LEDS_OFF);
      for (i = 0; i < 100000; i++);
    }

  /* Init USB HID interface */
  hid_init ();
  /* Init SPI */
  spi_init ();
  /* Init OpenBeacon nRF24L01 interface */
  nRFAPI_Init (81, broadcast_mac, sizeof (broadcast_mac), 0);
  /* Init 3D acceleration sensor */
  acc_init ();
  /* Init Storage */
  storage_init ();
  /* Init Bluetooth */
  bt_init ();

  /* main loop */
  t = 0;
  firstrun = 1;
  while (1)
    {
      /* blink LED0 on every 32th run - FIXME later with sleep */
      if ((t++ & 0x1F) == 0)
	{
	  pin_led (GPIO_LED0);
	  for (i = 0; i < 100000; i++);
	  pin_led (GPIO_LEDS_OFF);
	}
      for (i = 0; i < 200000; i++);

      if (UARTCount)
	{
	  /* blink LED1 upon Bluetooth command */
	  pin_led (GPIO_LED1);

	  /* show help screen upon Bluetooth connect */
	  if (firstrun)
	    {
	      debug_printf ("press 'H' for help...\n# ");
	      firstrun = 0;
	    }
	  else
	    /* execute menue command with last character received */
	    main_menue (UARTBuffer[UARTCount - 1]);

	  /* LED1 off again */
	  pin_led (GPIO_LEDS_OFF);

	  /* clear UART buffer */
	  UARTCount = 0;
	}
    }
}