static void _ll_backlight_off(void)
{
    if (c200v2_variant == 0) {
        GPIOA_PIN(5) = 0;
    } else {
        GPIOA_PIN(7) = 0;
    }
}
static void _ll_backlight_on(void)
{
    if (c200v2_variant == 0) {
        GPIOA_PIN(5) = 1<<5;
    } else {
        GPIOA_PIN(7) = 1<<7;
    }
}
Ejemplo n.º 3
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;
}
Ejemplo n.º 4
0
void lcd_init_device(void)
{
    as3525_dbop_init();

    GPIOA_DIR |= (0x20|0x1);
    GPIOA_DIR &= ~(1<<3);
    GPIOA_PIN(3) = 0;
    GPIOA_PIN(0) = 1;
    GPIOA_PIN(4) = 0;

    GPIOB_DIR |= (1<<0)|(1<<2)|(1<<3);
    GPIOB_PIN(0) = 1<<0;
    GPIOB_PIN(2) = 1<<2;
    GPIOB_PIN(3) = 1<<3;

    GPIOA_PIN(4) = 1<<4;
    GPIOA_PIN(5) = 1<<5;

    fuze_display_on();
}
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);
    }
}
Ejemplo n.º 6
0
void lcd_hw_init(void)
{
    CGU_PERI |= CGU_SSP_CLOCK_ENABLE;

    SSP_CPSR = AS3525_SSP_PRESCALER;    /* OF = 0x10 */
    SSP_CR0 = (1<<7) | (1<<6) | 7;  /* Motorola SPI frame format, 8 bits */
    SSP_CR1 = (1<<3) | (1<<1);  /* SSP Operation enabled */
    SSP_IMSC = 0;       /* No interrupts */

    GPIOA_DIR |= (1<<5);
    GPIOB_DIR |= (1<<2) | (1<<7);
    GPIOB_PIN(7) = 0;
    GPIOA_PIN(5) = (1<<5);
}
Ejemplo n.º 7
0
bool button_hold(void)
{
#ifndef BOOTLOADER
    static bool hold_button_old = false;
#endif
    bool hold_button = false;

    GPIOA_PIN(6) = (1<<6);
    if (GPIOA_PIN(2))
        hold_button = true;
    GPIOA_PIN(6) = 0x00;

#ifndef BOOTLOADER
    /* light handling */
    if (hold_button != hold_button_old)
    {
        hold_button_old = hold_button;
        backlight_hold_changed(hold_button);
    }
#endif /* BOOTLOADER */

    return hold_button;
}
/* initialises the host lcd hardware, returns the lcd type */
static int lcd_hw_init(void)
{
    /* configure SSP */
    bitset32(&CGU_PERI, CGU_SSP_CLOCK_ENABLE);
    SSP_CPSR = 4;           /* TODO: use AS3525_SSP_PRESCALER, OF uses 8 */
    SSP_CR0 =   (0 << 8) |  /* SCR, serial clock rate divider = 1 */
                (1 << 7) |  /* SPH, phase = 1 */
                (1 << 6) |  /* SPO, polarity = 1 */
                (0 << 4) |  /* FRF, frame format = motorola SPI */
                (7 << 0);   /* DSS, data size select = 8 bits */
    SSP_CR1 =   (1 << 3) |  /* SOD, slave output disable = 1 */
                (0 << 2) |  /* MS, master/slave = master */
                (1 << 1) |  /* SSE, synchronous serial port enabled = true */
                (0 << 0);   /* LBM, loopback mode = normal */
    SSP_IMSC &= ~0xF;       /* disable interrupts */
    SSP_DMACR &= ~0x3;      /* disable DMA */

    /* GPIO A3 is ??? but needs to be set */
    GPIOA_DIR |= (1 << 3);
    GPIOA_PIN(3) = (1 << 3);

    /* configure GPIO B2 (lcd D/C#) as output */
    GPIOB_DIR |= (1<<2);

    /* configure GPIO B3 (lcd type detect) as input */
    GPIOB_DIR &= ~(1<<3);
    
    /* configure GPIO A5 (lcd reset#) as output and perform lcd reset */
    GPIOA_DIR |= (1 << 5);
    GPIOA_PIN(5) = 0;
    sleep(HZ * 50/1000);
    GPIOA_PIN(5) = (1 << 5);

    /* detect lcd type on GPIO B3 */    
    return GPIOB_PIN(3) ? 1 : 0;
}
Ejemplo n.º 9
0
void _buttonlight_off(void)
{
    GPIOA_DIR |= (1<<5);
    GPIOA_PIN(5) = 0;       /* set pin a5 low */
}
Ejemplo n.º 10
0
void _buttonlight_on(void)
{
    GPIOA_DIR |= (1<<5);
    GPIOA_PIN(5) = (1<<5);  /* set pin a5 high */
}
Ejemplo n.º 11
0
void button_init_device(void)
{
    GPIOA_DIR |= (1<<1);     
    GPIOA_PIN(1) = (1<<1);
}
Ejemplo n.º 12
0
int button_read_device(void)
{
    int result = BUTTON_NONE;
    if(button_hold())
        return result;

    /* direct GPIO connections */
    if (GPIOA_PIN(3))
        result |= BUTTON_POWER;

    /* This is a keypad using A4-A6 as columns and A0-A2 as rows */
    GPIOA_PIN(4) = (1<<4);
    btn_delay();

    /* A4A0 is unused */

    if (GPIOA_PIN(1))
        result |= BUTTON_VOL_DOWN;

    if (GPIOA_PIN(2))
        result |= BUTTON_UP;

    GPIOA_PIN(4) = 0x00;

    GPIOA_PIN(5) = (1<<5);
    btn_delay();

    if (GPIOA_PIN(0))
        result |= BUTTON_LEFT;

    if (GPIOA_PIN(1))
        result |= BUTTON_SELECT;

    if (GPIOA_PIN(2))
        result |= BUTTON_RIGHT;

    GPIOA_PIN(5) = 0x00;


    GPIOA_PIN(6) = (1<<6);
    btn_delay();

    if (GPIOA_PIN(0))
        result |= BUTTON_DOWN;

    if (GPIOA_PIN(1))
        result |= BUTTON_VOL_UP;

    /* hold button is read in button_hold() */

    GPIOA_PIN(6) = 0x00;

    return result;
}