Example #1
0
void _backlight_on(void)
{
    GPIOB_PIN(1) = (1 << 1);
#ifdef HAVE_LCD_ENABLE
    lcd_enable(true);
#endif
}
Example #2
0
void _backlight_off(void)
{
#ifdef HAVE_LCD_ENABLE
    lcd_enable(false);
#endif
    GPIOB_PIN(1) = 0;
}
/* writes a command byte to the LCD */
static void lcd_write_cmd(uint8_t byte)
{
    /* wait until not busy */
    while (SSP_SR & (1<<4));

    /* LCD command mode */
    GPIOB_PIN(2) = 0;
    
    /* write data */
    SSP_DATA = byte;
    
    /* wait until not busy */
    while (SSP_SR & (1<<4));

    /* LCD data mode */
    GPIOB_PIN(2) = (1 << 2);
}
Example #4
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;
}
Example #5
0
bool _backlight_init()
{
    /* GPIO B1 controls backlight */
    GPIOB_DIR |= (1 << 1);
    ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91);
    GPIOB_PIN(1) = (1 << 1);
    
    return true;
}
Example #6
0
void lcd_write_command(int byte)
{
    while(SSP_SR & (1<<4))  /* BSY flag */
        ;

    GPIOB_PIN(2) = 0;
    SSP_DATA = byte;

    while(SSP_SR & (1<<4))  /* BSY flag */
        ;
}
Example #7
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();
}
Example #8
0
void lcd_write_data(const fb_data* p_bytes, int count)
{
    GPIOB_PIN(2) = (1<<2);

    while (count--)
    {
        while(!(SSP_SR & (1<<1)))   /* wait until transmit FIFO is not full */
            ;

        SSP_DATA = *p_bytes++;
    }
}
Example #9
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);
}
Example #10
0
int lcd_hw_init(void)
{
/* DBOP initialisation, do what OF does */
    bitset32(&CCU_IO, 1<<12); /* ?? */
    CGU_DBOP |= /*(1<<3)*/ 0x18 | AS3525_DBOP_DIV;

    DBOP_CTRL      = 0x51004;
    DBOP_TIMPOL_01 = 0x36A12F;
    DBOP_TIMPOL_23 = 0xE037E037;

    GPIOB_DIR |= (1<<2)|(1<<5);
    GPIOB_PIN(5) = (1<<5);

    return 0;
}
Example #11
0
void lcd_write_command(int byte)
{
    volatile int i = 0;
    while(i<LCD_DELAY) i++;

    /* unset D/C# (data or command) */
    GPIOB_PIN(2) = 0;
    DBOP_TIMPOL_23 = 0xE0370036;

    /* Write command */
    DBOP_DOUT8 = byte;

    /* While push fifo is not empty */
    while ((DBOP_STAT & (1<<10)) == 0)
        ;

    DBOP_TIMPOL_23 = 0xE037E037;
}
Example #12
0
void lcd_write_data(const fb_data* p_bytes, int count)
{
    volatile int i = 0;
    while(i<LCD_DELAY) i++;

    /* set D/C# (data or command) */
    GPIOB_PIN(2) = (1<<2);

    while (count--)
    {
        /* Write pixels */
        DBOP_DOUT8 = *p_bytes;

        p_bytes++; /* next packed pixels */

        /* Wait if push fifo is full */
        while ((DBOP_STAT & (1<<6)) != 0);
    }
    /* While push fifo is not empty */
    while ((DBOP_STAT & (1<<10)) == 0);
}
/* 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;
}