37 extern uint16_t ssd1306_color;
40 static uint8_t s_rotation = 0x00;
41 static uint8_t s_rgb_bit = 0b00001000;
42 static uint8_t s_rotate_output = 0;
45 static const PROGMEM uint8_t s_oled240x320_initData[] =
56 0xE0, CMD_ARG, 0x3F, CMD_ARG, 0x25, CMD_ARG, 0x1C,
57 CMD_ARG, 0x1E, CMD_ARG, 0x20, CMD_ARG, 0x12,
58 CMD_ARG, 0x2A, CMD_ARG, 0x90, CMD_ARG, 0x24,
59 CMD_ARG, 0x11, CMD_ARG, 0x00, CMD_ARG, 0x00,
60 CMD_ARG, 0x00, CMD_ARG, 0x00, CMD_ARG, 0x00,
61 0xE1, CMD_ARG, 0x20, CMD_ARG, 0x20, CMD_ARG, 0x20,
62 CMD_ARG, 0x20, CMD_ARG, 0x05, CMD_ARG, 0x00,
63 CMD_ARG, 0x15, CMD_ARG, 0xA7, CMD_ARG, 0x3D,
64 CMD_ARG, 0x18, CMD_ARG, 0x25, CMD_ARG, 0x2A,
65 CMD_ARG, 0x2B, CMD_ARG, 0x2B, CMD_ARG, 0x3A,
68 0xC0, CMD_ARG, 0x0A, CMD_ARG, 0x02,
70 0xC5, CMD_ARG, 0x50, CMD_ARG, 0x5B,
72 0x36, CMD_ARG, 0b10100000,
76 static lcduint_t s_column;
77 static lcduint_t s_page;
79 static void ili9341_setBlock(lcduint_t x, lcduint_t y, lcduint_t w)
104 static void ili9341_setBlock2(lcduint_t x, lcduint_t y, lcduint_t w)
108 lcduint_t rx = w ? (x + w - 1) : (width - 1);
129 static void ili9341_nextPage(
void)
135 static void ili9341_nextPage2(
void)
156 static void ili9341_sendPixels(uint8_t data)
158 for (uint8_t i=8; i>0; i--)
174 static void ili9341_sendPixelsBuffer(
const uint8_t *buffer, uint16_t len)
178 ili9341_sendPixels(*buffer);
183 static void ili9341_sendPixel8(uint8_t data)
190 static void ili9341_sendPixel16(uint16_t color)
201 s_rgb_bit = 0b00001000;
216 pinMode(rstPin, OUTPUT);
217 digitalWrite(rstPin, HIGH);
221 digitalWrite(rstPin, LOW);
223 digitalWrite(rstPin, HIGH);
234 if ((rotation^s_rotation) & 0x01)
240 s_rotation = (rotation & 0x03) | (s_rotation & 0x04);
249 ram_mode = 0b10100000;
252 ram_mode = 0b11010000;
255 ram_mode = 0b01100000;
258 ram_mode = 0b00000000;
261 ram_mode = s_rotate_output ? 0b11100100: 0b10000100;
264 ram_mode = 0b11100000;
267 ram_mode = 0b01010100;
270 ram_mode = 0b00100000;
281 s_rotate_output = on;
void ssd1306_configureSpiDisplay(const uint8_t *config, uint8_t configSize)
Sends configuration being passed to lcd display spi controller.
void(* send)(uint8_t data)
void ili9341_setRotation(uint8_t rotation)
Sets screen orientation (rotation)
void ili9341_240x320_spi_init(int8_t rstPin, int8_t cesPin, int8_t dcPin)
Inits 240x320 RGB TFT display over spi (based on ili9341 controller).
uint32_t s_ssd1306_spi_clock
void(* send_pixels16)(uint16_t data)
Sends RGB pixel encoded in 5-6-5 format to OLED driver. Sends RGB pixel encoded in 5-6-5 format to OL...
void(* set_block)(lcduint_t x, lcduint_t y, lcduint_t w)
Sets block in RAM of lcd display controller to write data to.
void ili9341_240x320_init(void)
Inits 240x320 RGB OLED display (based on ili9341 controller).
void(* send_pixels8)(uint8_t data)
Sends RGB pixel encoded in 3-3-2 format to OLED driver. Sends RGB pixel encoded in 3-3-2 format to OL...
void ssd1306_spiDataMode(uint8_t mode)
void(* send_pixels_buffer1)(const uint8_t *buffer, uint16_t len)
void(* send_pixels1)(uint8_t data)
void ili9341_setMode(lcd_mode_t mode)
Sets GDRAM autoincrement mode.
void ili9341_rotateOutput(uint8_t on)
Sets rotation of all output functions.
void ssd1306_spiInit(int8_t cesPin, int8_t dcPin)
ssd1306_lcd_t ssd1306_lcd
ssd1306_interface_t ssd1306_intf
void(* set_mode)(lcd_mode_t mode)
Sets library display mode for direct draw functions.