1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
static void lcd_v2_set_gram_area(int x_start, int y_start, int x_end, int y_end)
{
    lcdctrl_bypass(1);
    LCDC_CTRL |= RGB24B;

    lcd_write_reg(0x36, x_end);   /* H end address */
    lcd_write_reg(0x37, x_start); /* H start address */
    lcd_write_reg(0x38, y_end);   /* V end address */
    lcd_write_reg(0x39, y_start); /* V start address */

    /* set GRAM address */
    lcd_write_reg(0x20, (y_start * LCD_WIDTH + x_start) & 0xff);
    lcd_write_reg(0x21, (y_start * LCD_WIDTH + x_start) >> 8);

    lcd_cmd(0x22);
    LCDC_CTRL &= ~RGB24B;
}