static void _ll_buttonlight_off(void)
{
    if (c200v2_variant == 1) {
        /* Main buttonlight is on A5 */
        GPIOA_PIN(5) = 0;
    } else {
        /* Needed for buttonlight and MicroSD to work at the same time */
        /* Turn ROD control off, as the OF does */
        SD_MCI_POWER &= ~(1<<7);
        GPIOD_PIN(7) = 0;
        GPIOD_DIR &= ~(1<<7);
    }
}
Esempio n. 2
0
int button_read_device(void)
{
    int buttons = 0;

    /*  Buttons do not appear to need reset */
    /*  D6 does not appear to need special handling */
#if 0
    GPIOB_PIN(0) = 1;                   /* set B0  */

    int delay = 500;
    do {
        asm volatile("nop\n");
    } while (delay--);
#endif
    if GPIOD_PIN(6)                     /* read D6  */
        buttons |= BUTTON_POWER;
#if 0
    GPIOB_PIN(0) = 0;                   /* unset B0  */

    delay = 240;
    do {
        asm volatile("nop\n");
    } while (delay--);
#endif

    if GPIOA_PIN(1)
        buttons |= BUTTON_HOME;
    if GPIOA_PIN(6)
        buttons |= BUTTON_VOL_DOWN;
    if GPIOA_PIN(7)
        buttons |= BUTTON_VOL_UP;

     if GPIOC_PIN(1)
        buttons |= BUTTON_DOWN;
    if GPIOC_PIN(2)
        buttons |= BUTTON_UP;
    if GPIOC_PIN(3)
        buttons |= BUTTON_LEFT;
    if GPIOC_PIN(4)
        buttons |= BUTTON_SELECT;
    if GPIOC_PIN(5)
        buttons |= BUTTON_RIGHT;

  return buttons;
}