#ifndef TFT_H #define TFT_H #include #include #define TFT_WIDTH 480 #define TFT_HEIGHT 320 enum tft_command { NOP = 0x00, SWRESET = 0x01, RDDID = 0x04, RDNUMPE = 0x05, RDRED = 0x06, RDGREEN = 0x07, RDBLUE = 0x08, RDDPM = 0x0A, RDDMADCTL = 0x0B, RDDCOLMOD = 0x0C, RDDIM = 0x0D, RDDSM = 0x0E, RDDSDR = 0x0F, SPLIN = 0x10, SLPOUT = 0x11, PTLON = 0x12, NORON = 0x13, INVOFF = 0x20, INVON = 0x21, ALLPOFF = 0x22, ALLPON = 0x23, GAMSET = 0x26, DISPOFF = 0x28, DISPON = 0x29, CASET = 0x2A, PASET = 0x2B, RAMWR = 0x2C, RAMRD = 0x2E, PLTAR = 0x30, VSCRDEF = 0x33, TEOFF = 0x34, TEON = 0x35, MADCTL = 0x36, VSCRSADD = 0x37, IDMOFF = 0x38, IDMON = 0x39, COLMOD = 0x3A, CONRAMWR = 0x3C, CONRAMRD = 0x3E, TESL = 0x44, GETSL = 0x45, WRDISBV = 0x51, RDDISBV = 0x52, WRCTRLD = 0x53, RDCTRLD = 0x54, WRCABC = 0x55, RDCABC = 0x56, WRCABCMB = 0x5E, RDCABCMB = 0x5F, RDABVCSDR = 0x68, RDBWLK = 0x70, RDBKX = 0x71, RDBKY = 0x72, RDWX = 0x73, RDWY = 0x74, RDRGLB = 0x75, RDRX = 0x76, RDRY = 0x77, RDGX = 0x78, RDGY = 0x79, RDBALB = 0x7A, RDBX = 0x7B, RDBY = 0x7C, RDAX = 0x7D, RDAY = 0x7E, RDID1 = 0xDA, RDID2 = 0xDB, RDID3 = 0xDC, SETOSC = 0xB0, SETPOWER = 0xB1, SETDISCTRL = 0xB2, SETRGB = 0xB3, SETCYC = 0xB4, SETBGP = 0xB5, SETCOM = 0xB6, SETOTP = 0xB7, SETEXTC = 0xB9, SETSTBA = 0xC0, SETDGC = 0xC1, SETID = 0xC3, SETDDB = 0xC4, SETCABC = 0xC9, SETPANEL = 0xCC, SETGAMMA = 0xE0, SETIMAGE = 0xE9, SETMESSI = 0xEA, SETCOLOR = 0xEB }; enum pixel_format { BIT12 = 0x03, BIT16 = 0x05, BIT18 = 0x06, BIT24 = 0x07 }; static inline void tft_ram_wr(void) { tft_ctrl = RAMWR; } static inline void tft_pixel(uint8_t r, uint8_t g, uint8_t b) { tft_data = r; tft_data = g; tft_data = b; } void tft_set_area(unsigned int x, unsigned int y, unsigned int w, unsigned int h); void tft_init(void); void clear_screen(void); #endif // TFT_H