1
Dependents: BLE_TemperatureObserver
Adafruit_UC1601S.cpp@24:44e1681fa0cd, 2019-12-15 (annotated)
- Committer:
- mamont090671
- Date:
- Sun Dec 15 13:48:33 2019 +0000
- Revision:
- 24:44e1681fa0cd
- Parent:
- 22:818c271c30fa
+ssd1306
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JojoS |
22:818c271c30fa | 1 | /********************************************************************* |
JojoS |
22:818c271c30fa | 2 | This is a library for our Monochrome OLEDs based on SSD1306 drivers |
JojoS |
22:818c271c30fa | 3 | |
JojoS |
22:818c271c30fa | 4 | Pick one up today in the adafruit shop! |
JojoS |
22:818c271c30fa | 5 | ------> http://www.adafruit.com/category/63_98 |
JojoS |
22:818c271c30fa | 6 | |
JojoS |
22:818c271c30fa | 7 | These displays use SPI to communicate, 4 or 5 pins are required to |
JojoS |
22:818c271c30fa | 8 | interface |
JojoS |
22:818c271c30fa | 9 | |
JojoS |
22:818c271c30fa | 10 | Adafruit invests time and resources providing this open source code, |
JojoS |
22:818c271c30fa | 11 | please support Adafruit and open-source hardware by purchasing |
JojoS |
22:818c271c30fa | 12 | products from Adafruit! |
JojoS |
22:818c271c30fa | 13 | |
JojoS |
22:818c271c30fa | 14 | Written by Limor Fried/Ladyada for Adafruit Industries. |
JojoS |
22:818c271c30fa | 15 | BSD license, check license.txt for more information |
JojoS |
22:818c271c30fa | 16 | All text above, and the splash screen below must be included in any redistribution |
JojoS |
22:818c271c30fa | 17 | *********************************************************************/ |
JojoS |
22:818c271c30fa | 18 | |
JojoS |
22:818c271c30fa | 19 | /* |
JojoS |
22:818c271c30fa | 20 | * Modified by JojoS 03/07/2015 |
JojoS |
22:818c271c30fa | 21 | * add flipVertical option to constructor |
JojoS |
22:818c271c30fa | 22 | * add use of 'rst' is optional, maybe NC in constructor |
JojoS |
22:818c271c30fa | 23 | * add command SSD1306_SETPAGESTARTADDRESS to reset page start address (important when no hardware reset is uesed) |
JojoS |
22:818c271c30fa | 24 | */ |
JojoS |
22:818c271c30fa | 25 | |
JojoS |
22:818c271c30fa | 26 | #include "mbed.h" |
JojoS |
22:818c271c30fa | 27 | #include "Adafruit_UC1601S.h" |
JojoS |
22:818c271c30fa | 28 | |
JojoS |
22:818c271c30fa | 29 | Adafruit_UC1601S::Adafruit_UC1601S(PinName reset, uint8_t rawHeight, uint8_t rawWidth, bool flipVertical) |
JojoS |
22:818c271c30fa | 30 | : Adafruit_GFX(rawWidth, rawHeight) |
JojoS |
22:818c271c30fa | 31 | , _reset(reset, false) |
JojoS |
22:818c271c30fa | 32 | , _flipVertical(flipVertical) |
JojoS |
22:818c271c30fa | 33 | { |
JojoS |
22:818c271c30fa | 34 | // display memory is organized in 1 byte = 8 columns |
JojoS |
22:818c271c30fa | 35 | int heightBytes = rawHeight / 8; |
JojoS |
22:818c271c30fa | 36 | if (rawHeight % 8) // correction if height is not byte aligned |
JojoS |
22:818c271c30fa | 37 | heightBytes++; |
JojoS |
22:818c271c30fa | 38 | buffer.resize(rawWidth * heightBytes); |
JojoS |
22:818c271c30fa | 39 | } |
JojoS |
22:818c271c30fa | 40 | |
JojoS |
22:818c271c30fa | 41 | void Adafruit_UC1601S::begin() { |
JojoS |
22:818c271c30fa | 42 | if (_reset.is_connected()) {// reset input is not present on every UC1601S display board, so usage is optional |
JojoS |
22:818c271c30fa | 43 | _reset = 1; |
JojoS |
22:818c271c30fa | 44 | // VDD (3.3V) goes high at start, lets just chill for a ms |
JojoS |
22:818c271c30fa | 45 | wait_ms(1); |
JojoS |
22:818c271c30fa | 46 | // bring reset low |
JojoS |
22:818c271c30fa | 47 | _reset = 0; |
JojoS |
22:818c271c30fa | 48 | // wait 10ms |
JojoS |
22:818c271c30fa | 49 | wait_ms(10); |
JojoS |
22:818c271c30fa | 50 | // bring out of reset |
JojoS |
22:818c271c30fa | 51 | _reset = 1; |
JojoS |
22:818c271c30fa | 52 | // turn on VCC (9V?) |
JojoS |
22:818c271c30fa | 53 | } |
JojoS |
22:818c271c30fa | 54 | |
JojoS |
22:818c271c30fa | 55 | command(LCD_SET_TEMP_COMP | 0b00); // Set Temperature Comp. TC[1:0] |
JojoS |
22:818c271c30fa | 56 | command(LCD_SET_POWER_CTRL | 0b110); // Set Power Control PC[2:0] |
JojoS |
22:818c271c30fa | 57 | command(LCD_SET_LINE_ADDR | 0); // Set Scroll Line SL[5:0] |
JojoS |
22:818c271c30fa | 58 | command(LCD_SET_BIAS); // Set VBIAS Potentiometer (Double byte command) |
JojoS |
22:818c271c30fa | 59 | command(0xC0); // BIAS value |
JojoS |
22:818c271c30fa | 60 | command(LCD_SET_PARTITIAL_CTRL | 0); |
JojoS |
22:818c271c30fa | 61 | command(LCD_SET_RAM_ADDRESS_CTRL | 0b001); // |
JojoS |
22:818c271c30fa | 62 | command(LCD_SET_FRAME_RATE | 0); // Framerate 0: 80 fps 1: 100 fps |
JojoS |
22:818c271c30fa | 63 | command(LCD_SET_MAPPING_CTRL | (_flipVertical ? 0b000 : 0b100));// flip vertical / horizontal |
JojoS |
22:818c271c30fa | 64 | command(LCD_SET_BIAS_RATIO | 0); // 0: 6 1: 7 2: 8 3: 9 |
JojoS |
22:818c271c30fa | 65 | command(LCD_SET_COM_END); |
JojoS |
22:818c271c30fa | 66 | command(21); // Rows - 1 |
JojoS |
22:818c271c30fa | 67 | command(LCD_ENABLE_DISPLAY | 1); // enable display) |
JojoS |
22:818c271c30fa | 68 | } |
JojoS |
22:818c271c30fa | 69 | |
JojoS |
22:818c271c30fa | 70 | // Set a single pixel |
JojoS |
22:818c271c30fa | 71 | void Adafruit_UC1601S::drawPixel(int16_t x, int16_t y, uint16_t color) { |
JojoS |
22:818c271c30fa | 72 | if ((x < 0) || (x >= width()) || (y < 0) || (y >= height())) |
JojoS |
22:818c271c30fa | 73 | return; |
JojoS |
22:818c271c30fa | 74 | |
JojoS |
22:818c271c30fa | 75 | // check rotation, move pixel around if necessary |
JojoS |
22:818c271c30fa | 76 | switch (getRotation()) { |
JojoS |
22:818c271c30fa | 77 | case 1: |
JojoS |
22:818c271c30fa | 78 | swap(x, y); |
JojoS |
22:818c271c30fa | 79 | x = _rawWidth - x - 1; |
JojoS |
22:818c271c30fa | 80 | break; |
JojoS |
22:818c271c30fa | 81 | case 2: |
JojoS |
22:818c271c30fa | 82 | x = _rawWidth - x - 1; |
JojoS |
22:818c271c30fa | 83 | y = _rawHeight - y - 1; |
JojoS |
22:818c271c30fa | 84 | break; |
JojoS |
22:818c271c30fa | 85 | case 3: |
JojoS |
22:818c271c30fa | 86 | swap(x, y); |
JojoS |
22:818c271c30fa | 87 | y = _rawHeight - y - 1; |
JojoS |
22:818c271c30fa | 88 | break; |
JojoS |
22:818c271c30fa | 89 | } |
JojoS |
22:818c271c30fa | 90 | |
JojoS |
22:818c271c30fa | 91 | // x is which column |
JojoS |
22:818c271c30fa | 92 | if (color == WHITE) |
JojoS |
22:818c271c30fa | 93 | buffer[x + (y / 8) * _rawWidth] |= _BV((y % 8)); |
JojoS |
22:818c271c30fa | 94 | else |
JojoS |
22:818c271c30fa | 95 | // else black |
JojoS |
22:818c271c30fa | 96 | buffer[x + (y / 8) * _rawWidth] &= ~_BV((y % 8)); |
JojoS |
22:818c271c30fa | 97 | } |
JojoS |
22:818c271c30fa | 98 | |
JojoS |
22:818c271c30fa | 99 | void Adafruit_UC1601S::invertDisplay(bool i) { |
JojoS |
22:818c271c30fa | 100 | command(i ? LCD_INVERT_DISPLAY | 1 : LCD_INVERT_DISPLAY); |
JojoS |
22:818c271c30fa | 101 | } |
JojoS |
22:818c271c30fa | 102 | |
JojoS |
22:818c271c30fa | 103 | void Adafruit_UC1601S::flipVertical(bool flip) { |
JojoS |
22:818c271c30fa | 104 | _flipVertical = flip; |
JojoS |
22:818c271c30fa | 105 | if (flip) { |
JojoS |
22:818c271c30fa | 106 | command(LCD_SET_MAPPING_CTRL | 0b000);// flip vertical / horizontal |
JojoS |
22:818c271c30fa | 107 | command(LCD_SET_RAM_ADDRESS_CTRL | 0b101); // |
JojoS |
22:818c271c30fa | 108 | command(LCD_SET_COM_END); |
JojoS |
22:818c271c30fa | 109 | command(21); // Rows - 1 |
JojoS |
22:818c271c30fa | 110 | } else { |
JojoS |
22:818c271c30fa | 111 | command(LCD_SET_MAPPING_CTRL | 0b100);// flip vertical / horizontal |
JojoS |
22:818c271c30fa | 112 | command(LCD_SET_RAM_ADDRESS_CTRL | 0b001); // |
JojoS |
22:818c271c30fa | 113 | command(LCD_SET_COM_END); |
JojoS |
22:818c271c30fa | 114 | command(21); // Rows - 1 |
JojoS |
22:818c271c30fa | 115 | } |
JojoS |
22:818c271c30fa | 116 | } |
JojoS |
22:818c271c30fa | 117 | |
JojoS |
22:818c271c30fa | 118 | // Send the display buffer out to the display |
JojoS |
22:818c271c30fa | 119 | void Adafruit_UC1601S::display(void) { |
JojoS |
22:818c271c30fa | 120 | sendDisplayBuffer(); |
JojoS |
22:818c271c30fa | 121 | } |
JojoS |
22:818c271c30fa | 122 | |
JojoS |
22:818c271c30fa | 123 | // Clear the display buffer. Requires a display() call at some point afterwards |
JojoS |
22:818c271c30fa | 124 | void Adafruit_UC1601S::clearDisplay(void) { |
JojoS |
22:818c271c30fa | 125 | std::fill(buffer.begin(), buffer.end(), 0); |
JojoS |
22:818c271c30fa | 126 | } |
JojoS |
22:818c271c30fa | 127 | |
JojoS |
22:818c271c30fa | 128 | void Adafruit_UC1601S::splash(void) { |
JojoS |
22:818c271c30fa | 129 | #ifndef NO_SPLASH_ADAFRUIT |
JojoS |
22:818c271c30fa | 130 | const uint8_t adaFruitLogo[64 * 128 / 8] = { |
JojoS |
22:818c271c30fa | 131 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 132 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 133 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 134 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, |
JojoS |
22:818c271c30fa | 135 | 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 136 | 0x00, 0x80, 0x80, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 137 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 138 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 139 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 140 | 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xF8, 0xE0, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 141 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, |
JojoS |
22:818c271c30fa | 142 | 0x80, 0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0xFF, |
JojoS |
22:818c271c30fa | 143 | 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 144 | 0x80, 0xFF, 0xFF, 0x80, 0x80, 0x00, 0x80, 0x80, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x80, 0x80, |
JojoS |
22:818c271c30fa | 145 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x8C, 0x8E, 0x84, 0x00, 0x00, 0x80, 0xF8, |
JojoS |
22:818c271c30fa | 146 | 0xF8, 0xF8, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 147 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xE0, 0xE0, 0xC0, 0x80, |
JojoS |
22:818c271c30fa | 148 | 0x00, 0xE0, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 149 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xC7, 0x01, 0x01, |
JojoS |
22:818c271c30fa | 150 | 0x01, 0x01, 0x83, 0xFF, 0xFF, 0x00, 0x00, 0x7C, 0xFE, 0xC7, 0x01, 0x01, 0x01, 0x01, 0x83, 0xFF, |
JojoS |
22:818c271c30fa | 151 | 0xFF, 0xFF, 0x00, 0x38, 0xFE, 0xC7, 0x83, 0x01, 0x01, 0x01, 0x83, 0xC7, 0xFF, 0xFF, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 152 | 0x01, 0xFF, 0xFF, 0x01, 0x01, 0x00, 0xFF, 0xFF, 0x07, 0x01, 0x01, 0x01, 0x00, 0x00, 0x7F, 0xFF, |
JojoS |
22:818c271c30fa | 153 | 0x80, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x01, 0xFF, |
JojoS |
22:818c271c30fa | 154 | 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 155 | 0x03, 0x0F, 0x3F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE7, 0xC7, 0xC7, 0x8F, |
JojoS |
22:818c271c30fa | 156 | 0x8F, 0x9F, 0xBF, 0xFF, 0xFF, 0xC3, 0xC0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFC, 0xFC, |
JojoS |
22:818c271c30fa | 157 | 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xF8, 0xF8, 0xF0, 0xF0, 0xE0, 0xC0, 0x00, 0x01, 0x03, 0x03, 0x03, |
JojoS |
22:818c271c30fa | 158 | 0x03, 0x03, 0x01, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01, |
JojoS |
22:818c271c30fa | 159 | 0x03, 0x01, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01, 0x03, 0x03, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 160 | 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, |
JojoS |
22:818c271c30fa | 161 | 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x01, 0x03, 0x01, 0x00, 0x00, 0x00, 0x03, |
JojoS |
22:818c271c30fa | 162 | 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 163 | // 128x32^^^ 128x64vvv |
JojoS |
22:818c271c30fa | 164 | 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF9, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x1F, 0x0F, |
JojoS |
22:818c271c30fa | 165 | 0x87, 0xC7, 0xF7, 0xFF, 0xFF, 0x1F, 0x1F, 0x3D, 0xFC, 0xF8, 0xF8, 0xF8, 0xF8, 0x7C, 0x7D, 0xFF, |
JojoS |
22:818c271c30fa | 166 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x3F, 0x0F, 0x07, 0x00, 0x30, 0x30, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 167 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 168 | 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 169 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xC0, 0x00, |
JojoS |
22:818c271c30fa | 170 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 171 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 172 | 0x00, 0xC0, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x7F, 0x3F, 0x1F, |
JojoS |
22:818c271c30fa | 173 | 0x0F, 0x07, 0x1F, 0x7F, 0xFF, 0xFF, 0xF8, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xF8, 0xE0, |
JojoS |
22:818c271c30fa | 174 | 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 175 | 0x00, 0xFC, 0xFE, 0xFC, 0x0C, 0x06, 0x06, 0x0E, 0xFC, 0xF8, 0x00, 0x00, 0xF0, 0xF8, 0x1C, 0x0E, |
JojoS |
22:818c271c30fa | 176 | 0x06, 0x06, 0x06, 0x0C, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0xFC, |
JojoS |
22:818c271c30fa | 177 | 0xFE, 0xFC, 0x00, 0x18, 0x3C, 0x7E, 0x66, 0xE6, 0xCE, 0x84, 0x00, 0x00, 0x06, 0xFF, 0xFF, 0x06, |
JojoS |
22:818c271c30fa | 178 | 0x06, 0xFC, 0xFE, 0xFC, 0x0C, 0x06, 0x06, 0x06, 0x00, 0x00, 0xFE, 0xFE, 0x00, 0x00, 0xC0, 0xF8, |
JojoS |
22:818c271c30fa | 179 | 0xFC, 0x4E, 0x46, 0x46, 0x46, 0x4E, 0x7C, 0x78, 0x40, 0x18, 0x3C, 0x76, 0xE6, 0xCE, 0xCC, 0x80, |
JojoS |
22:818c271c30fa | 180 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 181 | 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x0F, 0x1F, 0x1F, 0x3F, 0x3F, 0x3F, 0x3F, 0x1F, 0x0F, 0x03, |
JojoS |
22:818c271c30fa | 182 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 183 | 0x00, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x03, 0x07, 0x0E, 0x0C, |
JojoS |
22:818c271c30fa | 184 | 0x18, 0x18, 0x0C, 0x06, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x01, 0x0F, 0x0E, 0x0C, 0x18, 0x0C, 0x0F, |
JojoS |
22:818c271c30fa | 185 | 0x07, 0x01, 0x00, 0x04, 0x0E, 0x0C, 0x18, 0x0C, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, |
JojoS |
22:818c271c30fa | 186 | 0x00, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x07, |
JojoS |
22:818c271c30fa | 187 | 0x07, 0x0C, 0x0C, 0x18, 0x1C, 0x0C, 0x06, 0x06, 0x00, 0x04, 0x0E, 0x0C, 0x18, 0x0C, 0x0F, 0x07, |
JojoS |
22:818c271c30fa | 188 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 189 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 190 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 191 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 192 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 193 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 194 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
JojoS |
22:818c271c30fa | 195 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
JojoS |
22:818c271c30fa | 196 | }; |
JojoS |
22:818c271c30fa | 197 | |
JojoS |
22:818c271c30fa | 198 | std::copy( |
JojoS |
22:818c271c30fa | 199 | &adaFruitLogo[0] |
JojoS |
22:818c271c30fa | 200 | , &adaFruitLogo[0] + (_rawHeight == 32 ? sizeof(adaFruitLogo)/2 : sizeof(adaFruitLogo)) |
JojoS |
22:818c271c30fa | 201 | , buffer.begin() |
JojoS |
22:818c271c30fa | 202 | ); |
JojoS |
22:818c271c30fa | 203 | #endif |
JojoS |
22:818c271c30fa | 204 | } |
JojoS |
22:818c271c30fa | 205 | |
JojoS |
22:818c271c30fa | 206 | /* |
JojoS |
22:818c271c30fa | 207 | * |
JojoS |
22:818c271c30fa | 208 | * I2C specific implementation |
JojoS |
22:818c271c30fa | 209 | * |
JojoS |
22:818c271c30fa | 210 | */ |
JojoS |
22:818c271c30fa | 211 | |
JojoS |
22:818c271c30fa | 212 | Adafruit_UC1601S_I2c::Adafruit_UC1601S_I2c(I2C &i2c, PinName reset, |
JojoS |
22:818c271c30fa | 213 | uint8_t i2cAddress, uint8_t rawHeight, |
JojoS |
22:818c271c30fa | 214 | uint8_t rawWidth, bool flipVertical) : |
JojoS |
22:818c271c30fa | 215 | Adafruit_UC1601S(reset, rawHeight, rawWidth, flipVertical), mi2c(i2c), mi2cAddress( |
JojoS |
22:818c271c30fa | 216 | i2cAddress) { |
JojoS |
22:818c271c30fa | 217 | begin(); |
JojoS |
22:818c271c30fa | 218 | splash(); |
JojoS |
22:818c271c30fa | 219 | display(); |
JojoS |
22:818c271c30fa | 220 | } |
JojoS |
22:818c271c30fa | 221 | |
JojoS |
22:818c271c30fa | 222 | void Adafruit_UC1601S_I2c::sendDisplayBuffer() { |
JojoS |
22:818c271c30fa | 223 | command(LCD_SET_PAGE_ADDR | 0); |
JojoS |
22:818c271c30fa | 224 | command(LCD_SET_COLUMN_ADDR_LSB | 0); |
JojoS |
22:818c271c30fa | 225 | command(LCD_SET_COLUMN_ADDR_MSB | 0); |
JojoS |
22:818c271c30fa | 226 | |
JojoS |
22:818c271c30fa | 227 | data(&buffer[0], buffer.size()); |
JojoS |
22:818c271c30fa | 228 | } |
JojoS |
22:818c271c30fa | 229 | |
JojoS |
22:818c271c30fa | 230 | void Adafruit_UC1601S_I2c::command(uint8_t c) { |
JojoS |
22:818c271c30fa | 231 | mi2c.write(mi2cAddress, (const char*) &c, 1); |
JojoS |
22:818c271c30fa | 232 | } |
JojoS |
22:818c271c30fa | 233 | |
JojoS |
22:818c271c30fa | 234 | void Adafruit_UC1601S_I2c::data(const uint8_t *c, int count) { |
JojoS |
22:818c271c30fa | 235 | mi2c.write(mi2cAddress + 2, (const char*) c, count); |
JojoS |
22:818c271c30fa | 236 | } |
JojoS |
22:818c271c30fa | 237 |