Basically i glued Peter Drescher and Simon Ford libs in a GraphicsDisplay class, then derived TFT or LCD class (which inherits Protocols class), then the most derived ones (Inits), which are per-display and are the only part needed to be adapted to diff hw.

Dependents:   afero_poc15_180216 afero_poc15_180223 afero_poc15_180302 afero_poc15_180403R ... more

Fork of UniGraphic by GraphicsDisplay

UniGraphic for La Suno Version.
To go with La Suno, WatchDog Reset functions were added in ILI9341.

Committer:
Rhyme
Date:
Thu Jun 18 02:25:31 2015 +0000
Revision:
23:d0eb35bbd2f3
Child:
24:1a2ebae1d289
SEPS225 added and still being worked

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rhyme 23:d0eb35bbd2f3 1 #include "mbed.h"
Rhyme 23:d0eb35bbd2f3 2
Rhyme 23:d0eb35bbd2f3 3 #include "SEPS225.h"
Rhyme 23:d0eb35bbd2f3 4
Rhyme 23:d0eb35bbd2f3 5 #ifndef OLED_LCD_REG_H_
Rhyme 23:d0eb35bbd2f3 6 #define OLED_LCD_REG_H_
Rhyme 23:d0eb35bbd2f3 7
Rhyme 23:d0eb35bbd2f3 8 #define CMD_INDEX 0x00
Rhyme 23:d0eb35bbd2f3 9 #define CMD_STATUS_RD 0x01
Rhyme 23:d0eb35bbd2f3 10 #define CMD_OSC_CTL 0x02
Rhyme 23:d0eb35bbd2f3 11 #define CMD_CLOCK_DIV 0x03
Rhyme 23:d0eb35bbd2f3 12 #define CMD_REDUCE_CURRENT 0x04
Rhyme 23:d0eb35bbd2f3 13 #define CMD_SOFT_RST 0x05
Rhyme 23:d0eb35bbd2f3 14 #define CMD_DISP_ON_OFF 0x06
Rhyme 23:d0eb35bbd2f3 15 #define CMD_PRECHARGE_TIME_R 0x08
Rhyme 23:d0eb35bbd2f3 16 #define CMD_PRECHARGE_TIME_G 0x09
Rhyme 23:d0eb35bbd2f3 17 #define CMD_PRECHARGE_TIME_B 0x0A
Rhyme 23:d0eb35bbd2f3 18 #define CMD_PRECHARGE_CURRENT_R 0x0B
Rhyme 23:d0eb35bbd2f3 19 #define CMD_PRECHARGE_CURRENT_G 0x0C
Rhyme 23:d0eb35bbd2f3 20 #define CMD_PRECHARGE_CURRENT_B 0x0D
Rhyme 23:d0eb35bbd2f3 21 #define CMD_DRIVING_CURRENT_R 0x10
Rhyme 23:d0eb35bbd2f3 22 #define CMD_DRIVING_CURRENT_G 0x11
Rhyme 23:d0eb35bbd2f3 23 #define CMD_DRIVING_CURRENT_B 0x12
Rhyme 23:d0eb35bbd2f3 24 #define CMD_DISPLAY_MODE_SET 0x13
Rhyme 23:d0eb35bbd2f3 25 #define CMD_RGB_IF 0x14
Rhyme 23:d0eb35bbd2f3 26 #define CMD_RGB_POL 0x15
Rhyme 23:d0eb35bbd2f3 27 #define CMD_MEMORY_WRITE_MODE 0x16
Rhyme 23:d0eb35bbd2f3 28 #define CMD_MX1_ADDR 0x17
Rhyme 23:d0eb35bbd2f3 29 #define CMD_MX2_ADDR 0x18
Rhyme 23:d0eb35bbd2f3 30 #define CMD_MY1_ADDR 0x19
Rhyme 23:d0eb35bbd2f3 31 #define CMD_MY2_ADDR 0x1A
Rhyme 23:d0eb35bbd2f3 32 #define CMD_MEMORY_ACCESS_POINTER_X 0x20
Rhyme 23:d0eb35bbd2f3 33 #define CMD_MEMORY_ACCESS_POINTER_Y 0x21
Rhyme 23:d0eb35bbd2f3 34 #define CMD_DDRAM_DATA_ACCESS_PORT 0x22
Rhyme 23:d0eb35bbd2f3 35 #define CMD_DUTY 0x28
Rhyme 23:d0eb35bbd2f3 36 #define CMD_DSL 0x29
Rhyme 23:d0eb35bbd2f3 37 #define CMD_D1_DDRAM_FAC 0x2E
Rhyme 23:d0eb35bbd2f3 38 #define CMD_D1_DDRAM_FAR 0x2F
Rhyme 23:d0eb35bbd2f3 39 #define CMD_D2_DDRAM_SAC 0x31
Rhyme 23:d0eb35bbd2f3 40 #define CMD_D2_DDRAM_SAR 0x32
Rhyme 23:d0eb35bbd2f3 41 #define CMD_SCR1_FX1 0x33
Rhyme 23:d0eb35bbd2f3 42 #define CMD_SCR1_FX2 0x34
Rhyme 23:d0eb35bbd2f3 43 #define CMD_SCR1_FY1 0x35
Rhyme 23:d0eb35bbd2f3 44 #define CMD_SCR1_FY2 0x36
Rhyme 23:d0eb35bbd2f3 45 #define CMD_SCR2_SX1 0x37
Rhyme 23:d0eb35bbd2f3 46 #define CMD_SCR2_SX2 0x38
Rhyme 23:d0eb35bbd2f3 47 #define CMD_SCR2_SY1 0x39
Rhyme 23:d0eb35bbd2f3 48 #define CMD_SCR2_SY2 0x3A
Rhyme 23:d0eb35bbd2f3 49 #define CMD_SCREEN_SAVER_CONTEROL 0x3B
Rhyme 23:d0eb35bbd2f3 50 #define CMD_SS_SLEEP_TIMER 0x3C
Rhyme 23:d0eb35bbd2f3 51 #define CMD_SCREEN_SAVER_MODE 0x3D
Rhyme 23:d0eb35bbd2f3 52 #define CMD_SS_SCR1_FU 0x3E
Rhyme 23:d0eb35bbd2f3 53 #define CMD_SS_SCR1_MXY 0x3F
Rhyme 23:d0eb35bbd2f3 54 #define CMD_SS_SCR2_FU 0x40
Rhyme 23:d0eb35bbd2f3 55 #define CMD_SS_SCR2_MXY 0x41
Rhyme 23:d0eb35bbd2f3 56 #define CMD_MOVING_DIRECTION 0x42
Rhyme 23:d0eb35bbd2f3 57 #define CMD_SS_SCR2_SX1 0x47
Rhyme 23:d0eb35bbd2f3 58 #define CMD_SS_SCR2_SX2 0x48
Rhyme 23:d0eb35bbd2f3 59 #define CMD_SS_SCR2_SY1 0x49
Rhyme 23:d0eb35bbd2f3 60 #define CMD_SS_SCR2_SY2 0x4A
Rhyme 23:d0eb35bbd2f3 61 #define CMD_IREF 0x80
Rhyme 23:d0eb35bbd2f3 62
Rhyme 23:d0eb35bbd2f3 63
Rhyme 23:d0eb35bbd2f3 64 #define LCD_RESET 0
Rhyme 23:d0eb35bbd2f3 65 #define LCD_CLEAR 1
Rhyme 23:d0eb35bbd2f3 66 #define LCD_PRINT 2
Rhyme 23:d0eb35bbd2f3 67
Rhyme 23:d0eb35bbd2f3 68
Rhyme 23:d0eb35bbd2f3 69 #define COLOR_RED 0xF100
Rhyme 23:d0eb35bbd2f3 70 #define COLOR_GREEN 0x07E0
Rhyme 23:d0eb35bbd2f3 71 #define COLOR_BLUE 0x001F
Rhyme 23:d0eb35bbd2f3 72 #define COLOR_CYAN 0x07FF
Rhyme 23:d0eb35bbd2f3 73 #define COLOR_MAGENTA 0xF11F
Rhyme 23:d0eb35bbd2f3 74 #define COLOR_YELLOW 0xFFE0
Rhyme 23:d0eb35bbd2f3 75 #define COLOR_BLACK 0x0000
Rhyme 23:d0eb35bbd2f3 76 #define COLOR_WHITE 0xFFFF
Rhyme 23:d0eb35bbd2f3 77
Rhyme 23:d0eb35bbd2f3 78 #define OLED_WIDTH 0x7F
Rhyme 23:d0eb35bbd2f3 79 #define OLED_HEIGHT 0x7F
Rhyme 23:d0eb35bbd2f3 80
Rhyme 23:d0eb35bbd2f3 81 #endif /* OLED_LCD_REG_H_ */
Rhyme 23:d0eb35bbd2f3 82
Rhyme 23:d0eb35bbd2f3 83 SEPS225::SEPS225(proto_t displayproto, PortName port, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const char *name, unsigned int LCDSIZE_X, unsigned int LCDSIZE_Y)
Rhyme 23:d0eb35bbd2f3 84 : TFT(displayproto, port, CS, reset, DC, WR, RD, LCDSIZE_X, LCDSIZE_Y, name)
Rhyme 23:d0eb35bbd2f3 85 {
Rhyme 23:d0eb35bbd2f3 86 hw_reset();
Rhyme 23:d0eb35bbd2f3 87 BusEnable(true);
Rhyme 23:d0eb35bbd2f3 88 identify(); // will collect tftID and set mipistd flag
Rhyme 23:d0eb35bbd2f3 89 init();
Rhyme 23:d0eb35bbd2f3 90 auto_gram_read_format();
Rhyme 23:d0eb35bbd2f3 91 set_orientation(0);
Rhyme 23:d0eb35bbd2f3 92 cls();
Rhyme 23:d0eb35bbd2f3 93 FastWindow(true); // most but not all controllers support this, even if datasheet tells they should.
Rhyme 23:d0eb35bbd2f3 94 locate(0,0);
Rhyme 23:d0eb35bbd2f3 95 }
Rhyme 23:d0eb35bbd2f3 96 SEPS225::SEPS225(proto_t displayproto, PinName* buspins, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const char *name, unsigned int LCDSIZE_X, unsigned int LCDSIZE_Y)
Rhyme 23:d0eb35bbd2f3 97 : TFT(displayproto, buspins, CS, reset, DC, WR, RD, LCDSIZE_X, LCDSIZE_Y, name)
Rhyme 23:d0eb35bbd2f3 98 {
Rhyme 23:d0eb35bbd2f3 99 hw_reset();
Rhyme 23:d0eb35bbd2f3 100 BusEnable(true);
Rhyme 23:d0eb35bbd2f3 101 identify(); // will collect tftID and set mipistd flag
Rhyme 23:d0eb35bbd2f3 102 init();
Rhyme 23:d0eb35bbd2f3 103 auto_gram_read_format();
Rhyme 23:d0eb35bbd2f3 104 set_orientation(0);
Rhyme 23:d0eb35bbd2f3 105 cls();
Rhyme 23:d0eb35bbd2f3 106 FastWindow(true); // most but not all controllers support this, even if datasheet tells they should.
Rhyme 23:d0eb35bbd2f3 107 locate(0,0);
Rhyme 23:d0eb35bbd2f3 108 }
Rhyme 23:d0eb35bbd2f3 109 SEPS225::SEPS225(proto_t displayproto, int Hz, PinName mosi, PinName miso, PinName sclk, PinName CS, PinName reset, PinName DC, const char *name, unsigned int LCDSIZE_X , unsigned int LCDSIZE_Y)
Rhyme 23:d0eb35bbd2f3 110 : TFT(displayproto, Hz, mosi, miso, sclk, CS, reset, DC, LCDSIZE_X, LCDSIZE_Y, name)
Rhyme 23:d0eb35bbd2f3 111 {
Rhyme 23:d0eb35bbd2f3 112 _cs = new DigitalOut(CS, 1) ;
Rhyme 23:d0eb35bbd2f3 113 _rs = new DigitalOut(DC, 1) ;
Rhyme 23:d0eb35bbd2f3 114
Rhyme 23:d0eb35bbd2f3 115 hw_reset(); //TFT class forwards to Protocol class
Rhyme 23:d0eb35bbd2f3 116 BusEnable(true); //TFT class forwards to Protocol class
Rhyme 23:d0eb35bbd2f3 117 identify(); // will collect tftID and set mipistd flag
Rhyme 23:d0eb35bbd2f3 118 init(); // per display custom init cmd sequence, implemented here
Rhyme 23:d0eb35bbd2f3 119 auto_gram_read_format();// try to get read gram pixel format, could be 16bit or 18bit, RGB or BGR. Will set flags accordingly
Rhyme 23:d0eb35bbd2f3 120 set_orientation(0); //TFT class does for MIPI standard and some ILIxxx
Rhyme 23:d0eb35bbd2f3 121 FastWindow(true); // most but not all controllers support this, even if datasheet tells they should.
Rhyme 23:d0eb35bbd2f3 122 cls();
Rhyme 23:d0eb35bbd2f3 123 locate(0,0);
Rhyme 23:d0eb35bbd2f3 124 }
Rhyme 23:d0eb35bbd2f3 125
Rhyme 23:d0eb35bbd2f3 126 // reset and init the lcd controller
Rhyme 23:d0eb35bbd2f3 127 void SEPS225::init()
Rhyme 23:d0eb35bbd2f3 128 {
Rhyme 23:d0eb35bbd2f3 129 #if 0
Rhyme 23:d0eb35bbd2f3 130 oled = new SPI(PIN_OLED_MOSI, PIN_OLED_MISO, PIN_OLED_SCLK) ;
Rhyme 23:d0eb35bbd2f3 131 oled_cs = new DigitalOut(PIN_OLED_CS, 1) ;
Rhyme 23:d0eb35bbd2f3 132 oled_rs = new DigitalOut(PIN_OLED_RS, 1) ;
Rhyme 23:d0eb35bbd2f3 133 oled->format(8, 0) ;
Rhyme 23:d0eb35bbd2f3 134 oled->frequency(1000000) ;
Rhyme 23:d0eb35bbd2f3 135 #endif
Rhyme 23:d0eb35bbd2f3 136
Rhyme 23:d0eb35bbd2f3 137 reg_write(CMD_REDUCE_CURRENT, 0x01) ; wait(0.01) ; // oled_delay(100000) ;
Rhyme 23:d0eb35bbd2f3 138 reg_write(CMD_REDUCE_CURRENT, 0x00) ; wait(0.01) ; // oled_delay(100000) ;
Rhyme 23:d0eb35bbd2f3 139
Rhyme 23:d0eb35bbd2f3 140 reg_write(CMD_OSC_CTL, 0x01) ;
Rhyme 23:d0eb35bbd2f3 141 reg_write(CMD_CLOCK_DIV, 0x30) ;
Rhyme 23:d0eb35bbd2f3 142 reg_write(CMD_PRECHARGE_TIME_R, 0x03) ;
Rhyme 23:d0eb35bbd2f3 143 reg_write(CMD_PRECHARGE_TIME_G, 0x04) ;
Rhyme 23:d0eb35bbd2f3 144 reg_write(CMD_PRECHARGE_TIME_B, 0x05) ;
Rhyme 23:d0eb35bbd2f3 145 // reg_write(CMD_PRECHARGE_TIME_R, 0x0E) ;
Rhyme 23:d0eb35bbd2f3 146 // reg_write(CMD_PRECHARGE_TIME_G, 0x0E) ;
Rhyme 23:d0eb35bbd2f3 147 // reg_write(CMD_PRECHARGE_TIME_B, 0x0E) ;
Rhyme 23:d0eb35bbd2f3 148 reg_write(CMD_PRECHARGE_CURRENT_R, 0x0B) ;
Rhyme 23:d0eb35bbd2f3 149 reg_write(CMD_PRECHARGE_CURRENT_G, 0x0B) ;
Rhyme 23:d0eb35bbd2f3 150 reg_write(CMD_PRECHARGE_CURRENT_B, 0x0B) ;
Rhyme 23:d0eb35bbd2f3 151 // reg_write(CMD_DRIVING_CURRENT_R, 0x3E) ;
Rhyme 23:d0eb35bbd2f3 152 // reg_write(CMD_DRIVING_CURRENT_G, 0x32) ;
Rhyme 23:d0eb35bbd2f3 153 // reg_write(CMD_DRIVING_CURRENT_B, 0x3D) ;
Rhyme 23:d0eb35bbd2f3 154 reg_write(CMD_DRIVING_CURRENT_R, 0x0B) ;
Rhyme 23:d0eb35bbd2f3 155 reg_write(CMD_DRIVING_CURRENT_G, 0x0B) ;
Rhyme 23:d0eb35bbd2f3 156 reg_write(CMD_DRIVING_CURRENT_B, 0x0B) ;
Rhyme 23:d0eb35bbd2f3 157 // Memory Write Mode
Rhyme 23:d0eb35bbd2f3 158 // 16bit * 1 transfer mode, R[5], G[6], B[5]
Rhyme 23:d0eb35bbd2f3 159 // H:Inc, V:Inc, Method:V
Rhyme 23:d0eb35bbd2f3 160 // reg_write(CMD_MEMORY_WRITE_MODE, 0x27) ;
Rhyme 23:d0eb35bbd2f3 161 reg_write(CMD_RGB_IF, 0x11) ;
Rhyme 23:d0eb35bbd2f3 162 // reg_write(CMD_MEMORY_WRITE_MODE, 0x66) ;
Rhyme 23:d0eb35bbd2f3 163 reg_write(CMD_MEMORY_WRITE_MODE, 0x26) ;
Rhyme 23:d0eb35bbd2f3 164 reg_write(CMD_IREF, 0x01) ; // Voltage ctrl by internal
Rhyme 23:d0eb35bbd2f3 165 //
Rhyme 23:d0eb35bbd2f3 166 reg_write(CMD_MX1_ADDR, 0x00) ;
Rhyme 23:d0eb35bbd2f3 167 reg_write(CMD_MX2_ADDR, 0x7F) ;
Rhyme 23:d0eb35bbd2f3 168 reg_write(CMD_MY1_ADDR, 0x00) ;
Rhyme 23:d0eb35bbd2f3 169 reg_write(CMD_MY2_ADDR, 0x7F) ;
Rhyme 23:d0eb35bbd2f3 170 reg_write(CMD_SCR1_FX1, 0x00) ;
Rhyme 23:d0eb35bbd2f3 171 reg_write(CMD_SCR1_FX2, 0x7F) ;
Rhyme 23:d0eb35bbd2f3 172 reg_write(CMD_SCR1_FY1, 0x00) ;
Rhyme 23:d0eb35bbd2f3 173 reg_write(CMD_SCR1_FY2, 0x7F) ;
Rhyme 23:d0eb35bbd2f3 174 reg_write(CMD_DSL, 0x00) ; // display start line
Rhyme 23:d0eb35bbd2f3 175 reg_write(CMD_DUTY, 0x7F) ; //
Rhyme 23:d0eb35bbd2f3 176 reg_write(CMD_DISPLAY_MODE_SET, 0x04) ; // was 0x00
Rhyme 23:d0eb35bbd2f3 177 // reg_write(CMD_DISPLAY_MODE_SET, 0x00) ; // was 0x00
Rhyme 23:d0eb35bbd2f3 178 reg_write(CMD_D1_DDRAM_FAC, 0x00) ;
Rhyme 23:d0eb35bbd2f3 179 reg_write(CMD_D1_DDRAM_FAR, 0x00) ;
Rhyme 23:d0eb35bbd2f3 180 // Clear
Rhyme 23:d0eb35bbd2f3 181 // oled_lcd_clear() ;
Rhyme 23:d0eb35bbd2f3 182 cls() ;
Rhyme 23:d0eb35bbd2f3 183
Rhyme 23:d0eb35bbd2f3 184 // DISP_ON_OFF
Rhyme 23:d0eb35bbd2f3 185 // reg_write(CMD_DISP_ON_OFF, 0x01) ;
Rhyme 23:d0eb35bbd2f3 186 }
Rhyme 23:d0eb35bbd2f3 187
Rhyme 23:d0eb35bbd2f3 188 /** Draw a pixel in the specified color.
Rhyme 23:d0eb35bbd2f3 189 * @param x is the horizontal offset to this pixel.
Rhyme 23:d0eb35bbd2f3 190 * @param y is the vertical offset to this pixel.
Rhyme 23:d0eb35bbd2f3 191 * @param color defines the color for the pixel.
Rhyme 23:d0eb35bbd2f3 192 */
Rhyme 23:d0eb35bbd2f3 193 void SEPS225::pixel(int x, int y, unsigned short color)
Rhyme 23:d0eb35bbd2f3 194 {
Rhyme 23:d0eb35bbd2f3 195 unsigned char data[2] ;
Rhyme 23:d0eb35bbd2f3 196 data[0] = (unsigned char)((color & 0xFF00) >> 8) ;
Rhyme 23:d0eb35bbd2f3 197 data[1] = (unsigned char)(color & 0x00FF) ;
Rhyme 23:d0eb35bbd2f3 198
Rhyme 23:d0eb35bbd2f3 199 reg_write(CMD_MEMORY_ACCESS_POINTER_X, x) ;
Rhyme 23:d0eb35bbd2f3 200 reg_write(CMD_MEMORY_ACCESS_POINTER_Y, y) ;
Rhyme 23:d0eb35bbd2f3 201 *_cs = 0 ;
Rhyme 23:d0eb35bbd2f3 202 *_rs = 0 ;
Rhyme 23:d0eb35bbd2f3 203 wr_cmd8(CMD_DDRAM_DATA_ACCESS_PORT) ;
Rhyme 23:d0eb35bbd2f3 204 *_rs = 1 ;
Rhyme 23:d0eb35bbd2f3 205
Rhyme 23:d0eb35bbd2f3 206 wr_data8(data[0]) ;
Rhyme 23:d0eb35bbd2f3 207 wr_data8(data[1]) ;
Rhyme 23:d0eb35bbd2f3 208 *_cs = 1 ;
Rhyme 23:d0eb35bbd2f3 209 }
Rhyme 23:d0eb35bbd2f3 210
Rhyme 23:d0eb35bbd2f3 211 void SEPS225::window(int x, int y, int w, int h)
Rhyme 23:d0eb35bbd2f3 212 {
Rhyme 23:d0eb35bbd2f3 213 reg_write(CMD_MX1_ADDR, x) ;
Rhyme 23:d0eb35bbd2f3 214 reg_write(CMD_MX2_ADDR, x+w-1) ;
Rhyme 23:d0eb35bbd2f3 215 reg_write(CMD_MY1_ADDR, y) ;
Rhyme 23:d0eb35bbd2f3 216 reg_write(CMD_MY2_ADDR, y+h-1) ;
Rhyme 23:d0eb35bbd2f3 217 }
Rhyme 23:d0eb35bbd2f3 218
Rhyme 23:d0eb35bbd2f3 219 void SEPS225::cls(void)
Rhyme 23:d0eb35bbd2f3 220 {
Rhyme 23:d0eb35bbd2f3 221 window(0, 0, OLED_WIDTH, OLED_HEIGHT) ;
Rhyme 23:d0eb35bbd2f3 222 reg_write(CMD_MEMORY_ACCESS_POINTER_X, 0) ;
Rhyme 23:d0eb35bbd2f3 223 reg_write(CMD_MEMORY_ACCESS_POINTER_Y, 0) ;
Rhyme 23:d0eb35bbd2f3 224 *_cs = 0 ;
Rhyme 23:d0eb35bbd2f3 225 *_rs = 0 ;
Rhyme 23:d0eb35bbd2f3 226 wr_cmd8(CMD_DDRAM_DATA_ACCESS_PORT) ;
Rhyme 23:d0eb35bbd2f3 227 *_rs = 1 ;
Rhyme 23:d0eb35bbd2f3 228 for (int i = 0 ; i < OLED_WIDTH * OLED_HEIGHT ; i++ ) {
Rhyme 23:d0eb35bbd2f3 229 write16(COLOR_BLACK) ;
Rhyme 23:d0eb35bbd2f3 230 }
Rhyme 23:d0eb35bbd2f3 231 *_cs = 1 ;
Rhyme 23:d0eb35bbd2f3 232 }
Rhyme 23:d0eb35bbd2f3 233
Rhyme 23:d0eb35bbd2f3 234 unsigned short SEPS225::pixelread(int x, int y)
Rhyme 23:d0eb35bbd2f3 235 {
Rhyme 23:d0eb35bbd2f3 236 unsigned short value = 0x0000 ;
Rhyme 23:d0eb35bbd2f3 237 //printf("SEPS225::pixelread not implemented\n\r") ;
Rhyme 23:d0eb35bbd2f3 238 return(value) ;
Rhyme 23:d0eb35bbd2f3 239 }
Rhyme 23:d0eb35bbd2f3 240
Rhyme 23:d0eb35bbd2f3 241 void SEPS225::window4read(int x, int y, int w, int h)
Rhyme 23:d0eb35bbd2f3 242 {
Rhyme 23:d0eb35bbd2f3 243 //printf("SEPS225::window4read not implemented\n\r") ;
Rhyme 23:d0eb35bbd2f3 244 }
Rhyme 23:d0eb35bbd2f3 245
Rhyme 23:d0eb35bbd2f3 246 void SEPS225::window_pushpixel(unsigned short color)
Rhyme 23:d0eb35bbd2f3 247 {
Rhyme 23:d0eb35bbd2f3 248 //printf("SEPS225::window_pushpixel(unsigned short color) not implemented\n\r") ;
Rhyme 23:d0eb35bbd2f3 249 *_cs = 0 ;
Rhyme 23:d0eb35bbd2f3 250 *_rs = 0 ;
Rhyme 23:d0eb35bbd2f3 251 wr_cmd8(CMD_DDRAM_DATA_ACCESS_PORT) ;
Rhyme 23:d0eb35bbd2f3 252 *_rs = 1 ;
Rhyme 23:d0eb35bbd2f3 253 wr_data16(color) ;
Rhyme 23:d0eb35bbd2f3 254 // write16(color) ;
Rhyme 23:d0eb35bbd2f3 255 *_cs = 1 ;
Rhyme 23:d0eb35bbd2f3 256 }
Rhyme 23:d0eb35bbd2f3 257
Rhyme 23:d0eb35bbd2f3 258 void SEPS225::window_pushpixel(unsigned short color, unsigned int count)
Rhyme 23:d0eb35bbd2f3 259 {
Rhyme 23:d0eb35bbd2f3 260 //printf("SEPS225::window_pushpixel(unsigned short color, unsigned int count) not implemented\n\r") ;
Rhyme 23:d0eb35bbd2f3 261 *_cs = 0 ;
Rhyme 23:d0eb35bbd2f3 262 *_rs = 0 ;
Rhyme 23:d0eb35bbd2f3 263 wr_cmd8(CMD_DDRAM_DATA_ACCESS_PORT) ;
Rhyme 23:d0eb35bbd2f3 264 *_rs = 1 ;
Rhyme 23:d0eb35bbd2f3 265 for (unsigned int i = 0 ; i < count ; i++ ) {
Rhyme 23:d0eb35bbd2f3 266 // write16(color) ;
Rhyme 23:d0eb35bbd2f3 267 wr_data16(color) ;
Rhyme 23:d0eb35bbd2f3 268 }
Rhyme 23:d0eb35bbd2f3 269 *_cs = 1 ;
Rhyme 23:d0eb35bbd2f3 270 }
Rhyme 23:d0eb35bbd2f3 271
Rhyme 23:d0eb35bbd2f3 272 void SEPS225::window_pushpixelbuf(unsigned short* color, unsigned int lenght)
Rhyme 23:d0eb35bbd2f3 273 {
Rhyme 23:d0eb35bbd2f3 274 //printf("SEPS225::window_pushpixelbuf(unsigned short color, unsigned int length) not implemented\n\r") ;
Rhyme 23:d0eb35bbd2f3 275 *_cs = 0 ;
Rhyme 23:d0eb35bbd2f3 276 *_rs = 0 ;
Rhyme 23:d0eb35bbd2f3 277 wr_cmd8(CMD_DDRAM_DATA_ACCESS_PORT) ;
Rhyme 23:d0eb35bbd2f3 278 *_rs = 1 ;
Rhyme 23:d0eb35bbd2f3 279 for (unsigned int i = 0 ; i < lenght ; i++ ) {
Rhyme 23:d0eb35bbd2f3 280 // write16(color[i]) ;
Rhyme 23:d0eb35bbd2f3 281 wr_data16(color[i]) ;
Rhyme 23:d0eb35bbd2f3 282 }
Rhyme 23:d0eb35bbd2f3 283 *_cs = 1 ;
Rhyme 23:d0eb35bbd2f3 284 }
Rhyme 23:d0eb35bbd2f3 285
Rhyme 23:d0eb35bbd2f3 286 void SEPS225::reg_write(unsigned char cmd, unsigned char data)
Rhyme 23:d0eb35bbd2f3 287 {
Rhyme 23:d0eb35bbd2f3 288 *_cs = 0 ;
Rhyme 23:d0eb35bbd2f3 289 *_rs = 0 ;
Rhyme 23:d0eb35bbd2f3 290 wr_cmd8(cmd) ;
Rhyme 23:d0eb35bbd2f3 291 *_rs = 1 ;
Rhyme 23:d0eb35bbd2f3 292 wr_data8(data) ;
Rhyme 23:d0eb35bbd2f3 293 *_cs = 1 ;
Rhyme 23:d0eb35bbd2f3 294 }
Rhyme 23:d0eb35bbd2f3 295
Rhyme 23:d0eb35bbd2f3 296 void SEPS225::display(int onoff)
Rhyme 23:d0eb35bbd2f3 297 {
Rhyme 23:d0eb35bbd2f3 298 reg_write(CMD_DISP_ON_OFF, onoff) ;
Rhyme 23:d0eb35bbd2f3 299 }
Rhyme 23:d0eb35bbd2f3 300
Rhyme 23:d0eb35bbd2f3 301 void SEPS225::cmd_write(unsigned char cmd)
Rhyme 23:d0eb35bbd2f3 302 {
Rhyme 23:d0eb35bbd2f3 303 *_cs = 0 ;
Rhyme 23:d0eb35bbd2f3 304 *_rs = 0 ;
Rhyme 23:d0eb35bbd2f3 305 wr_cmd8(cmd) ;
Rhyme 23:d0eb35bbd2f3 306 *_rs = 1 ;
Rhyme 23:d0eb35bbd2f3 307 *_cs = 1 ;
Rhyme 23:d0eb35bbd2f3 308 }
Rhyme 23:d0eb35bbd2f3 309
Rhyme 23:d0eb35bbd2f3 310 void SEPS225::data_write(unsigned char data)
Rhyme 23:d0eb35bbd2f3 311 {
Rhyme 23:d0eb35bbd2f3 312 *_cs = 0 ;
Rhyme 23:d0eb35bbd2f3 313 wr_data8(data) ;
Rhyme 23:d0eb35bbd2f3 314 *_cs = 1 ;
Rhyme 23:d0eb35bbd2f3 315 }
Rhyme 23:d0eb35bbd2f3 316
Rhyme 23:d0eb35bbd2f3 317 void SEPS225::write8(unsigned char data)
Rhyme 23:d0eb35bbd2f3 318 {
Rhyme 23:d0eb35bbd2f3 319 wr_data8(data) ;
Rhyme 23:d0eb35bbd2f3 320 }
Rhyme 23:d0eb35bbd2f3 321
Rhyme 23:d0eb35bbd2f3 322 void SEPS225::write16(unsigned short sdata)
Rhyme 23:d0eb35bbd2f3 323 {
Rhyme 23:d0eb35bbd2f3 324 wr_data8((sdata >> 8)&0xFF) ;
Rhyme 23:d0eb35bbd2f3 325 wr_data8(sdata & 0xFF) ;
Rhyme 23:d0eb35bbd2f3 326 }
Rhyme 23:d0eb35bbd2f3 327
Rhyme 23:d0eb35bbd2f3 328 void SEPS225::bufwrite8(unsigned char *data, unsigned long len)
Rhyme 23:d0eb35bbd2f3 329 {
Rhyme 23:d0eb35bbd2f3 330 unsigned long i;
Rhyme 23:d0eb35bbd2f3 331 for (i = 0 ; i < len ; i++ ) {
Rhyme 23:d0eb35bbd2f3 332 wr_data8(data[i]) ;
Rhyme 23:d0eb35bbd2f3 333 }
Rhyme 23:d0eb35bbd2f3 334 }
Rhyme 23:d0eb35bbd2f3 335
Rhyme 23:d0eb35bbd2f3 336 void SEPS225::bufwrite16(unsigned short *sdata, unsigned long len)
Rhyme 23:d0eb35bbd2f3 337 {
Rhyme 23:d0eb35bbd2f3 338 unsigned long i ;
Rhyme 23:d0eb35bbd2f3 339 for (i = 0 ; i < len ; i++) {
Rhyme 23:d0eb35bbd2f3 340 write8((*sdata >> 8)&0xFF) ;
Rhyme 23:d0eb35bbd2f3 341 write8(*sdata & 0xFF) ;
Rhyme 23:d0eb35bbd2f3 342 }
Rhyme 23:d0eb35bbd2f3 343 }