Exemple #1
0
void lcd_init_device(void)
{

#ifdef BOOTLOADER /* Bother at all to do this again? */
/* Init GPIO ports */
    lcd_init_gpio();
    lcd_power_on();
    lcd_display_on();
#else

    power_on = true;
    display_on = true;

    lcd_set_invert_display(false);
    lcd_set_flip(false);
#endif
}
Exemple #2
0
void lcd_enable(bool on)
{
/* Disabled until properly working */
return;
    if (on == lcd_on)
        return;

    if (on)
    {
        lcd_display_on(false);  /* Turn on display */
        lcd_update();      /* Resync display */
        send_event(LCD_EVENT_ACTIVATION, NULL);
    }
    else
    {
        lcd_display_off();  /* Turn off display */
    }
}
/**
 * Lousy function for automatic LCD initialization
 */
void lcd_initialize(void) {

    unsigned char i;

    // set relevant pins as outputs
    LCD_DATA_DDR = ~DATA_MASK;
    LCD_RS_DDR = 0;
    LCD_RW_DDR = 0;
    LCD_EN_DDR = 0;
    LCD_BL_DDR = 0;

    // initialize the display_config
    for (i = 0; i < 6; i++) {
        display_config[i] = 0x00;
    }

    LCD_RS = 0;
    LCD_RW = 0;

    // set 4-bit mode
    _send_nibble(0b0010);

    // function set
    lcd_flags_set(FUNCTION_SET, DATA_LENGTH | CHAR_FONT, 0);
    lcd_flags_set(FUNCTION_SET, DISPLAY_LINES, 1);

    lcd_backlight_on();
    lcd_display_on();
    lcd_cursor_off();
    lcd_blinking_off();

    lcd_flags_set(ENTRY_MODE, CURSOR_INCREMENT, 1);
    lcd_flags_set(ENTRY_MODE, ENABLE_SHIFTING, 0);

    lcd_clear();
    lcd_return_home();
}
Exemple #4
0
/**
 * \brief Application entry point for spi_touchscreen example.
 *
 * \return Unused (ANSI-C compatibility).
 */
int main(void)
{
    uint8_t uc_result;

    sysclk_init();
    board_init();

    configure_console();

    /* Enable clocks for push buttons management */
    pmc_enable_periph_clk(ID_PIOA);
    pmc_enable_periph_clk(ID_PIOB);
    pmc_enable_periph_clk(ID_PIOC);

    /* Output example information */
    puts(STRING_HEADER);

    /* Configure systick for 1 ms. */
    puts("Configure system tick to get 1ms tick period.\r");
    if (SysTick_Config(sysclk_get_cpu_hz() / 1000)) {
        puts("Systick configuration error\r");
        while (1);
    }

    /* Switch off backlight */
    aat31xx_disable_backlight();

    lcd_init();

    lcd_set_foreground_color(UNI_COLOR_WHITE);
    lcd_draw_filled_rectangle(0, 0, LCD_WIDTH, LCD_HEIGHT);

    /* Turn on LCD */
    lcd_display_on();

    /* Switch on backlight */
    aat31xx_set_backlight(AAT31XX_MAX_BACKLIGHT_LEVEL);

    /* Initializes the PIO interrupt management for touchscreen driver */
    pio_handler_set_priority(PIOA, PIOA_IRQn, IRQ_PRIOR_PIO);
    pio_handler_set_priority(PIOB, PIOB_IRQn, IRQ_PRIOR_PIO);
    pio_handler_set_priority(PIOC, PIOC_IRQn, IRQ_PRIOR_PIO);

    /* Initialize touchscreen without calibration */
    rtouch_init(LCD_WIDTH, LCD_HEIGHT);
    rtouch_enable();
    rtouch_set_event_handler(event_handler);

    while (1) {
        uc_result = rtouch_calibrate();
        if (uc_result == 0) {
            puts("Calibration successful !\r");
            break;
        } else {
            puts("Calibration failed; error delta is too big ! Please retry calibration procedure...\r");
        }
    }

    while (1) {
    }
}
Exemple #5
0
void lcd_init_device(void)
{    
    if(!_lcd_enabled())
    {
        lcd_display_on(true);
        
        enable_venc(true);
        
        /* Set LCD values in Video Encoder */
        IO_VID_ENC_VMOD &= 0x8800; /* Clear all values */
        IO_VID_ENC_VMOD |= (VENC_VMOD_DACPD | VENC_VMOD_VMD | VENC_VMOD_ITLC | VENC_VMOD_VDMD(2)); /* set mode to RGB666 parallel 16 bit */
        IO_VID_ENC_VDCTL &= 0x8FE8; /* Clear all values */
        IO_VID_ENC_VDCTL |= (VENC_VDCTL_VCLKP | VENC_VDCTL_DOMD(2)),
        IO_VID_ENC_VDPRO = VENC_VDPRO_PFLTR;
        IO_VID_ENC_SYNCTL &= 0xE000; /* Clear all values */
        IO_VID_ENC_SYNCTL |= (VENC_SYNCTL_VPL | VENC_SYNCTL_HPL);
        IO_VID_ENC_HSDLY = 0;
        IO_VID_ENC_HSPLS = 0x12;
        IO_VID_ENC_HSTART = 0x1B;
        IO_VID_ENC_HVALID = 0x140;
        IO_VID_ENC_HINT = 0x168;
        IO_VID_ENC_VSDLY = 0;
        IO_VID_ENC_VSPLS = 3;
        IO_VID_ENC_VSTART = 5;
        IO_VID_ENC_VVALID = 0xF0;
        IO_VID_ENC_VINT = 0x118;
        IO_VID_ENC_RGBCTL &= 0x088; /* Clear all values */
        IO_VID_ENC_RGBCTL |= VENC_RGBCTL_DFLTR;
        IO_VID_ENC_RGBCLP = VENC_RGBCLP_UCLIP(0xFF);
        IO_VID_ENC_LCDOUT &= 0xFE00; /* Clear all values */
        IO_VID_ENC_LCDOUT |= (VENC_LCDOUT_OEE | VENC_LCDOUT_FIDS);
        IO_VID_ENC_DCLKCTL &= 0xC0C0; /* Clear all values */
        IO_VID_ENC_DCLKCTL |= VENC_DCLKCTL_DCKEC;
        IO_VID_ENC_DCLKPTN0 = 1;
        DM320_REG(0x0864) = 0; /* ???? */
    }
    else
        lcd_on = true;

    /* Based on lcd-mr500.c from Catalin Patulea */
    /* Clear the Frame */
    memset16(FRAME, 0x0000, LCD_WIDTH*LCD_HEIGHT);
    
    IO_OSD_MODE = 0x00ff;
    IO_OSD_VIDWINMD = 0x0002;
    IO_OSD_OSDWINMD0 = 0x2001;
    IO_OSD_OSDWINMD1 = 0x0002;
    IO_OSD_ATRMD = 0x0000;
    IO_OSD_RECTCUR = 0x0000;

    unsigned int addr;
    IO_OSD_OSDWIN0OFST = (LCD_WIDTH*16) / 256;
    addr = ((unsigned int)FRAME-CONFIG_SDRAM_START) / 32;
    IO_OSD_OSDWINADH = addr >> 16;
    IO_OSD_OSDWIN0ADL = addr & 0xFFFF;

#ifndef ZEN_VISION
    IO_OSD_BASEPX = 26;
    IO_OSD_BASEPY = 5;
#else
    IO_OSD_BASEPX = 80;
    IO_OSD_BASEPY = 0;
#endif

    IO_OSD_OSDWIN0XP = 0;
    IO_OSD_OSDWIN0YP = 0;
    IO_OSD_OSDWIN0XL = LCD_WIDTH;
    IO_OSD_OSDWIN0YL = LCD_HEIGHT;

    IO_VID_ENC_VDCTL |= VENC_VDCTL_VCLKE; /* Enable VCLK */
    IO_VID_ENC_VMOD |= VENC_VMOD_VENC; /* Enable video encoder */
    IO_VID_ENC_SYNCTL |= VENC_SYNCTL_SYE; /* Enable sync output */
    IO_VID_ENC_VDCTL &= ~VENC_VDCTL_DOMD(3); /* Normal digital data output */
}