/** * \brief Read 16 bit data. */ static uint16_t ili9325_lcd_get_16(void) { uint16_t us_value; us_value = LCD_RD(); us_value = (us_value << 8) | LCD_RD(); return us_value; }
static inline unsigned short lcd_read (void) { unsigned short id; DATA_LCD_DDR = 0x00; LCD_RD(0) id=DATA_LCD_PIN &0x00FF; LCD_RD(1) LCD_RD(0) id=(id << 8) | (DATA_LCD_PIN &0x00FF); LCD_RD(1) return(id); }
/** * \brief Read data to LCD GRAM. * * \note Because pixel data LCD GRAM is 18-bits, so convertion to RGB 24-bits * will cause low color bit lose. * * \return color 24-bits RGB color. */ static uint32_t ili9325_read_ram(void) { uint8_t value[2]; uint32_t color; value[0] = LCD_RD(); /* dummy read */ value[1] = LCD_RD(); /* dummy read */ value[0] = LCD_RD(); /* data upper byte */ value[1] = LCD_RD(); /* data lower byte */ /* Convert RGB565 to RGB888 */ /* For BGR format */ color = ((value[0] & 0xF8)) | /* R */ ((value[0] & 0x07) << 13) | ((value[1] & 0xE0) << 5) | /* G */ ((value[1] & 0x1F) << 19); /* B */ return color; }
static inline void wr_dat (unsigned short c) { LCD_RS(1) LCD_RD(1) lcd_send(c); }
static inline void wr_cmd (unsigned char c) { LCD_RS(0) LCD_RD(1) lcd_send(c); }