set32l010 oled
Dependents: oled_test8_16x24_010_1
SSD1308.cpp@0:e65e15783b26, 2022-08-05 (annotated)
- Committer:
- caa45040
- Date:
- Fri Aug 05 10:30:55 2022 +0000
- Revision:
- 0:e65e15783b26
- Child:
- 1:ad63de2ea3ff
stm32l010 oled reset_ta_i_sa_ku
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
caa45040 | 0:e65e15783b26 | 1 | |
caa45040 | 0:e65e15783b26 | 2 | #include "mbed.h" |
caa45040 | 0:e65e15783b26 | 3 | #include "SSD1308.h" |
caa45040 | 0:e65e15783b26 | 4 | |
caa45040 | 0:e65e15783b26 | 5 | //#include "font_8x8.h" |
caa45040 | 0:e65e15783b26 | 6 | #include "font_16x24.h" |
caa45040 | 0:e65e15783b26 | 7 | |
caa45040 | 0:e65e15783b26 | 8 | |
caa45040 | 0:e65e15783b26 | 9 | //i2c initialization |
caa45040 | 0:e65e15783b26 | 10 | //I2C i2c(I2C_SDA, I2C_SCL); //767 |
caa45040 | 0:e65e15783b26 | 11 | //I2C i2c(PA_10, PA_9); //010 |
caa45040 | 0:e65e15783b26 | 12 | |
caa45040 | 0:e65e15783b26 | 13 | |
caa45040 | 0:e65e15783b26 | 14 | //void fff(char *str1) |
caa45040 | 0:e65e15783b26 | 15 | //{ |
caa45040 | 0:e65e15783b26 | 16 | // printf(str1);//debug |
caa45040 | 0:e65e15783b26 | 17 | //} |
caa45040 | 0:e65e15783b26 | 18 | |
caa45040 | 0:e65e15783b26 | 19 | |
caa45040 | 0:e65e15783b26 | 20 | |
caa45040 | 0:e65e15783b26 | 21 | /** |
caa45040 | 0:e65e15783b26 | 22 | *@brief Constructor |
caa45040 | 0:e65e15783b26 | 23 | *@param I2C *i2c reference to i2c |
caa45040 | 0:e65e15783b26 | 24 | *@param uint8_t deviceAddress slaveaddress |
caa45040 | 0:e65e15783b26 | 25 | */ |
caa45040 | 0:e65e15783b26 | 26 | //SSD1308::SSD1308(I2C *i2c, uint8_t deviceAddress) : _i2c(i2c) { |
caa45040 | 0:e65e15783b26 | 27 | SSD1308::SSD1308( I2C *i2c ,uint8_t deviceAddress) { |
caa45040 | 0:e65e15783b26 | 28 | |
caa45040 | 0:e65e15783b26 | 29 | _i2c = i2c; |
caa45040 | 0:e65e15783b26 | 30 | |
caa45040 | 0:e65e15783b26 | 31 | _writeOpcode = deviceAddress & 0xFE; // low order bit = 0 for write |
caa45040 | 0:e65e15783b26 | 32 | _readOpcode = deviceAddress | 0x01; // low order bit = 1 for read |
caa45040 | 0:e65e15783b26 | 33 | |
caa45040 | 0:e65e15783b26 | 34 | initialize(); |
caa45040 | 0:e65e15783b26 | 35 | }//SSD1308 |
caa45040 | 0:e65e15783b26 | 36 | |
caa45040 | 0:e65e15783b26 | 37 | //イニシャライズ |
caa45040 | 0:e65e15783b26 | 38 | void SSD1308::initialize() |
caa45040 | 0:e65e15783b26 | 39 | { |
caa45040 | 0:e65e15783b26 | 40 | |
caa45040 | 0:e65e15783b26 | 41 | //fff("initialize\r\n");//debug |
caa45040 | 0:e65e15783b26 | 42 | |
caa45040 | 0:e65e15783b26 | 43 | //リセット対策 |
caa45040 | 0:e65e15783b26 | 44 | wait_ms(100); |
caa45040 | 0:e65e15783b26 | 45 | _i2c->write(_writeOpcode, "\200\215\200\024\200\257", 6); |
caa45040 | 0:e65e15783b26 | 46 | wait_ms(100); |
caa45040 | 0:e65e15783b26 | 47 | _i2c->write(_writeOpcode, "\200\215\200\024\200\257", 6); |
caa45040 | 0:e65e15783b26 | 48 | wait_ms(100); |
caa45040 | 0:e65e15783b26 | 49 | _i2c->write(_writeOpcode, "\200\215\200\024\200\257", 6); |
caa45040 | 0:e65e15783b26 | 50 | wait_ms(100); |
caa45040 | 0:e65e15783b26 | 51 | |
caa45040 | 0:e65e15783b26 | 52 | |
caa45040 | 0:e65e15783b26 | 53 | |
caa45040 | 0:e65e15783b26 | 54 | setHorizontalAddressingMode(); //メモリーアクセスモード |
caa45040 | 0:e65e15783b26 | 55 | |
caa45040 | 0:e65e15783b26 | 56 | clearDisplay(); |
caa45040 | 0:e65e15783b26 | 57 | |
caa45040 | 0:e65e15783b26 | 58 | //setInverted(false); //反転 |
caa45040 | 0:e65e15783b26 | 59 | |
caa45040 | 0:e65e15783b26 | 60 | setDisplayOn(); |
caa45040 | 0:e65e15783b26 | 61 | |
caa45040 | 0:e65e15783b26 | 62 | //fff("\r\n"); |
caa45040 | 0:e65e15783b26 | 63 | |
caa45040 | 0:e65e15783b26 | 64 | //charge pump add=>ca45040 |
caa45040 | 0:e65e15783b26 | 65 | _i2c->write(_writeOpcode, "\200\215\200\024", 4); //0x80,0x8d,0x80,0x14 |
caa45040 | 0:e65e15783b26 | 66 | //set access |
caa45040 | 0:e65e15783b26 | 67 | //setDisplayFlip(false, false); |
caa45040 | 0:e65e15783b26 | 68 | |
caa45040 | 0:e65e15783b26 | 69 | |
caa45040 | 0:e65e15783b26 | 70 | |
caa45040 | 0:e65e15783b26 | 71 | }//initialize |
caa45040 | 0:e65e15783b26 | 72 | |
caa45040 | 0:e65e15783b26 | 73 | //クリアディスプレー |
caa45040 | 0:e65e15783b26 | 74 | void SSD1308::clearDisplay() |
caa45040 | 0:e65e15783b26 | 75 | { |
caa45040 | 0:e65e15783b26 | 76 | |
caa45040 | 0:e65e15783b26 | 77 | //fff("clearDisplay\r\n");//debug |
caa45040 | 0:e65e15783b26 | 78 | |
caa45040 | 0:e65e15783b26 | 79 | //setDisplayOff(); |
caa45040 | 0:e65e15783b26 | 80 | setPageAddress(0, MAX_PAGE); // all pages |
caa45040 | 0:e65e15783b26 | 81 | setColumnAddress(0, MAX_COL); // all columns |
caa45040 | 0:e65e15783b26 | 82 | |
caa45040 | 0:e65e15783b26 | 83 | /* |
caa45040 | 0:e65e15783b26 | 84 | for (uint8_t page = 0; page < PAGES; page++) { |
caa45040 | 0:e65e15783b26 | 85 | for (uint8_t col = 0; col < COLUMNS; col++) { |
caa45040 | 0:e65e15783b26 | 86 | _sendData(0x00); |
caa45040 | 0:e65e15783b26 | 87 | } |
caa45040 | 0:e65e15783b26 | 88 | } |
caa45040 | 0:e65e15783b26 | 89 | */ |
caa45040 | 0:e65e15783b26 | 90 | |
caa45040 | 0:e65e15783b26 | 91 | //128*64/8=1024 |
caa45040 | 0:e65e15783b26 | 92 | char databytes[2] = { DATA_MODE, 0x00 }; |
caa45040 | 0:e65e15783b26 | 93 | for (int icount = 0; icount < 1024; icount++) { |
caa45040 | 0:e65e15783b26 | 94 | //_sendData(0x00); |
caa45040 | 0:e65e15783b26 | 95 | |
caa45040 | 0:e65e15783b26 | 96 | _i2c->write(_writeOpcode, databytes, 2); |
caa45040 | 0:e65e15783b26 | 97 | |
caa45040 | 0:e65e15783b26 | 98 | } |
caa45040 | 0:e65e15783b26 | 99 | |
caa45040 | 0:e65e15783b26 | 100 | //setDisplayOn(); |
caa45040 | 0:e65e15783b26 | 101 | }//clearDisplay |
caa45040 | 0:e65e15783b26 | 102 | |
caa45040 | 0:e65e15783b26 | 103 | //ライトビットマップ |
caa45040 | 0:e65e15783b26 | 104 | void SSD1308::writeBitmap(uint8_t* data, |
caa45040 | 0:e65e15783b26 | 105 | uint8_t start_page, uint8_t end_page, |
caa45040 | 0:e65e15783b26 | 106 | uint8_t start_col, uint8_t end_col) |
caa45040 | 0:e65e15783b26 | 107 | { |
caa45040 | 0:e65e15783b26 | 108 | |
caa45040 | 0:e65e15783b26 | 109 | //fff(" writeBitmap\r\n");//debug |
caa45040 | 0:e65e15783b26 | 110 | |
caa45040 | 0:e65e15783b26 | 111 | int count = (end_page - start_page + 1) * (end_col - start_col + 1); |
caa45040 | 0:e65e15783b26 | 112 | |
caa45040 | 0:e65e15783b26 | 113 | //setDisplayOff(); |
caa45040 | 0:e65e15783b26 | 114 | setPageAddress(start_page, end_page); // set page window |
caa45040 | 0:e65e15783b26 | 115 | setColumnAddress(start_col, end_col); // set column window |
caa45040 | 0:e65e15783b26 | 116 | |
caa45040 | 0:e65e15783b26 | 117 | |
caa45040 | 0:e65e15783b26 | 118 | |
caa45040 | 0:e65e15783b26 | 119 | char databytes[2] = { DATA_MODE, 0 }; |
caa45040 | 0:e65e15783b26 | 120 | for (int i=0; i<count; i++) { |
caa45040 | 0:e65e15783b26 | 121 | //_sendData(data[i]); // Write Data |
caa45040 | 0:e65e15783b26 | 122 | |
caa45040 | 0:e65e15783b26 | 123 | databytes[1] = data[i]; |
caa45040 | 0:e65e15783b26 | 124 | _i2c->write(_writeOpcode, databytes, 2); |
caa45040 | 0:e65e15783b26 | 125 | |
caa45040 | 0:e65e15783b26 | 126 | } |
caa45040 | 0:e65e15783b26 | 127 | |
caa45040 | 0:e65e15783b26 | 128 | |
caa45040 | 0:e65e15783b26 | 129 | //setDisplayOn(); |
caa45040 | 0:e65e15783b26 | 130 | }//writeBitmap |
caa45040 | 0:e65e15783b26 | 131 | |
caa45040 | 0:e65e15783b26 | 132 | |
caa45040 | 0:e65e15783b26 | 133 | //ライトビッグキャラ |
caa45040 | 0:e65e15783b26 | 134 | void SSD1308::writeBigChar(uint8_t row, uint8_t col, char chr) |
caa45040 | 0:e65e15783b26 | 135 | { |
caa45040 | 0:e65e15783b26 | 136 | |
caa45040 | 0:e65e15783b26 | 137 | //fff("writeBigChar\r\n");//debug |
caa45040 | 0:e65e15783b26 | 138 | |
caa45040 | 0:e65e15783b26 | 139 | |
caa45040 | 0:e65e15783b26 | 140 | writeBitmap((uint8_t*) font_16x24[int(chr) - FONT16x24_START], |
caa45040 | 0:e65e15783b26 | 141 | row, (row + FONT16x24_BYTES - 1), |
caa45040 | 0:e65e15783b26 | 142 | col, (col + FONT16x24_WIDTH - 1)); |
caa45040 | 0:e65e15783b26 | 143 | |
caa45040 | 0:e65e15783b26 | 144 | |
caa45040 | 0:e65e15783b26 | 145 | }//writeBigChar |
caa45040 | 0:e65e15783b26 | 146 | |
caa45040 | 0:e65e15783b26 | 147 | |
caa45040 | 0:e65e15783b26 | 148 | /* |
caa45040 | 0:e65e15783b26 | 149 | //センドコマンド コマンドx1 |
caa45040 | 0:e65e15783b26 | 150 | void SSD1308::_sendCommand(uint8_t command) |
caa45040 | 0:e65e15783b26 | 151 | { |
caa45040 | 0:e65e15783b26 | 152 | char databytes[2] = { COMMAND_MODE, command }; |
caa45040 | 0:e65e15783b26 | 153 | i2c.write(_writeOpcode,databytes, 2); |
caa45040 | 0:e65e15783b26 | 154 | //_i2c.write(_writeOpcode, databytes, 2); // Write command |
caa45040 | 0:e65e15783b26 | 155 | }// |
caa45040 | 0:e65e15783b26 | 156 | */ |
caa45040 | 0:e65e15783b26 | 157 | |
caa45040 | 0:e65e15783b26 | 158 | |
caa45040 | 0:e65e15783b26 | 159 | |
caa45040 | 0:e65e15783b26 | 160 | /* |
caa45040 | 0:e65e15783b26 | 161 | //センドコマンド コマンドx1 パラメーターx1 |
caa45040 | 0:e65e15783b26 | 162 | void SSD1308::_sendCommand(uint8_t command, uint8_t param1) |
caa45040 | 0:e65e15783b26 | 163 | { |
caa45040 | 0:e65e15783b26 | 164 | char databytes[4] = { COMMAND_MODE, command, COMMAND_MODE, param1 }; |
caa45040 | 0:e65e15783b26 | 165 | |
caa45040 | 0:e65e15783b26 | 166 | i2c.write(_writeOpcode, databytes, 4); |
caa45040 | 0:e65e15783b26 | 167 | //_i2c.write(_writeOpcode, databytes, 4); // Write command |
caa45040 | 0:e65e15783b26 | 168 | |
caa45040 | 0:e65e15783b26 | 169 | }// |
caa45040 | 0:e65e15783b26 | 170 | */ |
caa45040 | 0:e65e15783b26 | 171 | |
caa45040 | 0:e65e15783b26 | 172 | /* |
caa45040 | 0:e65e15783b26 | 173 | //センドコマンド コマンドx1 パラメーターx2 |
caa45040 | 0:e65e15783b26 | 174 | void SSD1308::_sendCommand(uint8_t command, uint8_t param1, uint8_t param2) |
caa45040 | 0:e65e15783b26 | 175 | { |
caa45040 | 0:e65e15783b26 | 176 | char databytes[6] = { COMMAND_MODE, command, COMMAND_MODE, param1, COMMAND_MODE, param2 }; |
caa45040 | 0:e65e15783b26 | 177 | i2c.write(_writeOpcode, databytes, 6); |
caa45040 | 0:e65e15783b26 | 178 | //_i2c.write(_writeOpcode, databytes, 6); // Write command |
caa45040 | 0:e65e15783b26 | 179 | |
caa45040 | 0:e65e15783b26 | 180 | }// |
caa45040 | 0:e65e15783b26 | 181 | */ |
caa45040 | 0:e65e15783b26 | 182 | |
caa45040 | 0:e65e15783b26 | 183 | /* |
caa45040 | 0:e65e15783b26 | 184 | //センドコマンド コマンドx1 パラメーターx5 |
caa45040 | 0:e65e15783b26 | 185 | void SSD1308::_sendCommand(uint8_t command, uint8_t param1, uint8_t param2, |
caa45040 | 0:e65e15783b26 | 186 | uint8_t param3, uint8_t param4, |
caa45040 | 0:e65e15783b26 | 187 | uint8_t param5) |
caa45040 | 0:e65e15783b26 | 188 | { |
caa45040 | 0:e65e15783b26 | 189 | char databytes[12] = { COMMAND_MODE, command, COMMAND_MODE, param1, COMMAND_MODE, param2, |
caa45040 | 0:e65e15783b26 | 190 | COMMAND_MODE, param3, COMMAND_MODE, param4, COMMAND_MODE, param5 }; |
caa45040 | 0:e65e15783b26 | 191 | i2c.write(_writeOpcode, databytes, 12); |
caa45040 | 0:e65e15783b26 | 192 | //_i2c.write(_writeOpcode, databytes, 12); // Write command |
caa45040 | 0:e65e15783b26 | 193 | }// |
caa45040 | 0:e65e15783b26 | 194 | */ |
caa45040 | 0:e65e15783b26 | 195 | |
caa45040 | 0:e65e15783b26 | 196 | /* |
caa45040 | 0:e65e15783b26 | 197 | //センドコマンド コマンドx1 パラメーターx6 |
caa45040 | 0:e65e15783b26 | 198 | void SSD1308::_sendCommand(uint8_t command, uint8_t param1, uint8_t param2, |
caa45040 | 0:e65e15783b26 | 199 | uint8_t param3, uint8_t param4, |
caa45040 | 0:e65e15783b26 | 200 | uint8_t param5, uint8_t param6) |
caa45040 | 0:e65e15783b26 | 201 | { |
caa45040 | 0:e65e15783b26 | 202 | char databytes[14] = { COMMAND_MODE, command, COMMAND_MODE, param1, COMMAND_MODE, param2, |
caa45040 | 0:e65e15783b26 | 203 | COMMAND_MODE, param3, COMMAND_MODE, param4, COMMAND_MODE, param5, COMMAND_MODE, param6 }; |
caa45040 | 0:e65e15783b26 | 204 | i2c.write(_writeOpcode, databytes, 14); |
caa45040 | 0:e65e15783b26 | 205 | //_i2c.write(_writeOpcode, databytes, 14); // Write command |
caa45040 | 0:e65e15783b26 | 206 | |
caa45040 | 0:e65e15783b26 | 207 | }// |
caa45040 | 0:e65e15783b26 | 208 | */ |
caa45040 | 0:e65e15783b26 | 209 | |
caa45040 | 0:e65e15783b26 | 210 | /* |
caa45040 | 0:e65e15783b26 | 211 | //センドデータ コマンドx1 |
caa45040 | 0:e65e15783b26 | 212 | void SSD1308::_sendData(uint8_t data) |
caa45040 | 0:e65e15783b26 | 213 | { |
caa45040 | 0:e65e15783b26 | 214 | char databytes[2] = { DATA_MODE, data }; |
caa45040 | 0:e65e15783b26 | 215 | i2c.write(_writeOpcode, databytes, 2); |
caa45040 | 0:e65e15783b26 | 216 | //_i2c.write(_writeOpcode, databytes, 2); // Write Data |
caa45040 | 0:e65e15783b26 | 217 | }// |
caa45040 | 0:e65e15783b26 | 218 | */ |
caa45040 | 0:e65e15783b26 | 219 | |
caa45040 | 0:e65e15783b26 | 220 | /* |
caa45040 | 0:e65e15783b26 | 221 | //センドデータ コマンドx1 データ |
caa45040 | 0:e65e15783b26 | 222 | void SSD1308::_sendData(uint8_t len, uint8_t* data) |
caa45040 | 0:e65e15783b26 | 223 | { |
caa45040 | 0:e65e15783b26 | 224 | for (int i=0; i<len ; i++) { |
caa45040 | 0:e65e15783b26 | 225 | _sendData(data[i]); // Write Data |
caa45040 | 0:e65e15783b26 | 226 | } |
caa45040 | 0:e65e15783b26 | 227 | }//_sendData |
caa45040 | 0:e65e15783b26 | 228 | */ |
caa45040 | 0:e65e15783b26 | 229 | |
caa45040 | 0:e65e15783b26 | 230 | //セット |
caa45040 | 0:e65e15783b26 | 231 | void SSD1308::setHorizontalAddressingMode() |
caa45040 | 0:e65e15783b26 | 232 | { |
caa45040 | 0:e65e15783b26 | 233 | |
caa45040 | 0:e65e15783b26 | 234 | //fff("setHorizontalAddressingMode\r\n");//debug |
caa45040 | 0:e65e15783b26 | 235 | |
caa45040 | 0:e65e15783b26 | 236 | setMemoryAddressingMode(HORIZONTAL_ADDRESSING_MODE); |
caa45040 | 0:e65e15783b26 | 237 | }//setHorizontalAddressingMode |
caa45040 | 0:e65e15783b26 | 238 | |
caa45040 | 0:e65e15783b26 | 239 | //セットメモリーアドレシングモード |
caa45040 | 0:e65e15783b26 | 240 | void SSD1308::setMemoryAddressingMode(uint8_t mode) |
caa45040 | 0:e65e15783b26 | 241 | { |
caa45040 | 0:e65e15783b26 | 242 | |
caa45040 | 0:e65e15783b26 | 243 | //fff("setMemoryAddressingMode\r\n"); |
caa45040 | 0:e65e15783b26 | 244 | |
caa45040 | 0:e65e15783b26 | 245 | //_sendCommand(SET_MEMORY_ADDRESSING_MODE, mode); |
caa45040 | 0:e65e15783b26 | 246 | |
caa45040 | 0:e65e15783b26 | 247 | |
caa45040 | 0:e65e15783b26 | 248 | char databytes[4] = { COMMAND_MODE, SET_MEMORY_ADDRESSING_MODE, COMMAND_MODE, mode }; |
caa45040 | 0:e65e15783b26 | 249 | |
caa45040 | 0:e65e15783b26 | 250 | _i2c->write(_writeOpcode, databytes, 4); |
caa45040 | 0:e65e15783b26 | 251 | |
caa45040 | 0:e65e15783b26 | 252 | |
caa45040 | 0:e65e15783b26 | 253 | |
caa45040 | 0:e65e15783b26 | 254 | }//setMemoryAddressingMode |
caa45040 | 0:e65e15783b26 | 255 | |
caa45040 | 0:e65e15783b26 | 256 | //セットページアドレス |
caa45040 | 0:e65e15783b26 | 257 | void SSD1308::setPageAddress(uint8_t start, uint8_t end) |
caa45040 | 0:e65e15783b26 | 258 | { |
caa45040 | 0:e65e15783b26 | 259 | |
caa45040 | 0:e65e15783b26 | 260 | //fff("setPageAddress\r\n"); |
caa45040 | 0:e65e15783b26 | 261 | |
caa45040 | 0:e65e15783b26 | 262 | //_sendCommand(SET_PAGE_ADDRESS, start, end); |
caa45040 | 0:e65e15783b26 | 263 | |
caa45040 | 0:e65e15783b26 | 264 | char databytes[6] = { COMMAND_MODE, SET_PAGE_ADDRESS, COMMAND_MODE, start, COMMAND_MODE, end }; |
caa45040 | 0:e65e15783b26 | 265 | _i2c->write(_writeOpcode, databytes, 6); |
caa45040 | 0:e65e15783b26 | 266 | |
caa45040 | 0:e65e15783b26 | 267 | |
caa45040 | 0:e65e15783b26 | 268 | |
caa45040 | 0:e65e15783b26 | 269 | }//setPageAddress |
caa45040 | 0:e65e15783b26 | 270 | |
caa45040 | 0:e65e15783b26 | 271 | //セットカラムアクセス |
caa45040 | 0:e65e15783b26 | 272 | void SSD1308::setColumnAddress(uint8_t start, uint8_t end) |
caa45040 | 0:e65e15783b26 | 273 | { |
caa45040 | 0:e65e15783b26 | 274 | |
caa45040 | 0:e65e15783b26 | 275 | //fff("setColumnAddress"); |
caa45040 | 0:e65e15783b26 | 276 | |
caa45040 | 0:e65e15783b26 | 277 | //_sendCommand(SET_COLUMN_ADDRESS, start, end); |
caa45040 | 0:e65e15783b26 | 278 | |
caa45040 | 0:e65e15783b26 | 279 | char databytes[6] = { COMMAND_MODE, SET_COLUMN_ADDRESS, COMMAND_MODE, start, COMMAND_MODE, end }; |
caa45040 | 0:e65e15783b26 | 280 | _i2c->write(_writeOpcode, databytes, 6); |
caa45040 | 0:e65e15783b26 | 281 | |
caa45040 | 0:e65e15783b26 | 282 | |
caa45040 | 0:e65e15783b26 | 283 | }//setColumnAddress |
caa45040 | 0:e65e15783b26 | 284 | |
caa45040 | 0:e65e15783b26 | 285 | //セットディスプレーオン |
caa45040 | 0:e65e15783b26 | 286 | void SSD1308::setDisplayOn() |
caa45040 | 0:e65e15783b26 | 287 | { |
caa45040 | 0:e65e15783b26 | 288 | |
caa45040 | 0:e65e15783b26 | 289 | //fff("setDisplayOn\r\n");//debug |
caa45040 | 0:e65e15783b26 | 290 | |
caa45040 | 0:e65e15783b26 | 291 | //_sendCommand(SET_DISPLAY_POWER_ON); |
caa45040 | 0:e65e15783b26 | 292 | |
caa45040 | 0:e65e15783b26 | 293 | |
caa45040 | 0:e65e15783b26 | 294 | char databytes[2] = { COMMAND_MODE, SET_DISPLAY_POWER_ON }; |
caa45040 | 0:e65e15783b26 | 295 | _i2c->write(_writeOpcode,databytes, 2); |
caa45040 | 0:e65e15783b26 | 296 | |
caa45040 | 0:e65e15783b26 | 297 | }//setDisplayOn |
caa45040 | 0:e65e15783b26 | 298 | |
caa45040 | 0:e65e15783b26 | 299 | |
caa45040 | 0:e65e15783b26 | 300 | /* |
caa45040 | 0:e65e15783b26 | 301 | //セットディスプレーオフ |
caa45040 | 0:e65e15783b26 | 302 | void SSD1308::setDisplayOff() |
caa45040 | 0:e65e15783b26 | 303 | { |
caa45040 | 0:e65e15783b26 | 304 | _sendCommand(SET_DISPLAY_POWER_OFF); |
caa45040 | 0:e65e15783b26 | 305 | }//setDisplayOff |
caa45040 | 0:e65e15783b26 | 306 | */ |
caa45040 | 0:e65e15783b26 | 307 | |
caa45040 | 0:e65e15783b26 | 308 | /* |
caa45040 | 0:e65e15783b26 | 309 | //セットディスプレー Flip |
caa45040 | 0:e65e15783b26 | 310 | void SSD1308::setDisplayFlip(bool left, bool down) |
caa45040 | 0:e65e15783b26 | 311 | { |
caa45040 | 0:e65e15783b26 | 312 | if (left) { |
caa45040 | 0:e65e15783b26 | 313 | // column address 0 is mapped to SEG0 (Reset) |
caa45040 | 0:e65e15783b26 | 314 | _sendCommand(SET_SEGMENT_REMAP_0); |
caa45040 | 0:e65e15783b26 | 315 | } else { |
caa45040 | 0:e65e15783b26 | 316 | // column address 127 is mapped to SEG0 |
caa45040 | 0:e65e15783b26 | 317 | _sendCommand(SET_SEGMENT_REMAP_127); |
caa45040 | 0:e65e15783b26 | 318 | } |
caa45040 | 0:e65e15783b26 | 319 | |
caa45040 | 0:e65e15783b26 | 320 | if (down) { |
caa45040 | 0:e65e15783b26 | 321 | // Reset mode |
caa45040 | 0:e65e15783b26 | 322 | _sendCommand(SET_COMMON_REMAP_0); |
caa45040 | 0:e65e15783b26 | 323 | } else { |
caa45040 | 0:e65e15783b26 | 324 | // Flip Up/Down (Need to rewrite display before H effect shows) |
caa45040 | 0:e65e15783b26 | 325 | _sendCommand(SET_COMMON_REMAP_63); |
caa45040 | 0:e65e15783b26 | 326 | } |
caa45040 | 0:e65e15783b26 | 327 | |
caa45040 | 0:e65e15783b26 | 328 | }//setDisplayFlip |
caa45040 | 0:e65e15783b26 | 329 | */ |