51 |
51 |
52 |
52 |
53 static const uint8_t oledInit[] = { |
53 static const uint8_t oledInit[] = { |
54 SSD1322_CMD_SET_COMMAND_LOCK, 1, 0x12, /* Unlock OLED driver IC*/ |
54 SSD1322_CMD_SET_COMMAND_LOCK, 1, 0x12, /* Unlock OLED driver IC*/ |
55 SSD1322_CMD_SET_DISPLAY_OFF, 0, |
55 SSD1322_CMD_SET_DISPLAY_OFF, 0, |
56 SSD1322_CMD_SET_CLOCK_DIVIDER, 1, 0x91, |
56 SSD1322_CMD_SET_CLOCK_DIVIDER, 1, 0x91,//0xF0, //max freq, was 0x91, |
57 SSD1322_CMD_SET_MULTIPLEX_RATIO, 1, 0x3F, /*duty = 1/64*,64 COMS are enabled*/ |
57 SSD1322_CMD_SET_MULTIPLEX_RATIO, 1, 0x3F, /*duty = 1/64*,64 COMS are enabled*/ |
58 SSD1322_CMD_SET_DISPLAY_OFFSET, 1, 0x00, |
58 SSD1322_CMD_SET_DISPLAY_OFFSET, 1, 0x00, |
59 SSD1322_CMD_SET_DISPLAY_START_LINE, 1, 0x00, /*set start line position*/ |
59 SSD1322_CMD_SET_DISPLAY_START_LINE, 1, 0x00, /*set start line position*/ |
60 SSD1322_CMD_SET_REMAP, 2, 0x14, // Horizontal address increment, |
60 SSD1322_CMD_SET_REMAP, 2, 0x14, // Horizontal address increment, |
61 // Disable Column Address Re-map, |
61 // Disable Column Address Re-map, |
362 memcpy((void*)_trBuffer, |
362 memcpy((void*)_trBuffer, |
363 (const void*)_pixelBuffer, |
363 (const void*)_pixelBuffer, |
364 DISPLAY_BUFFER_ELEMENTS * sizeof(DISPLAY_BUFFER_TYPE)); |
364 DISPLAY_BUFFER_ELEMENTS * sizeof(DISPLAY_BUFFER_TYPE)); |
365 wr_cmd8(SSD1322_CMD_WRITE_RAM); |
365 wr_cmd8(SSD1322_CMD_WRITE_RAM); |
366 |
366 |
|
367 #ifdef DEVICE_SPI_ASYNCH |
|
368 _CS = 0; |
|
369 _spi.transfer((uint8_t*) _trBuffer, 64*128, (uint8_t*) NULL, 0, _spiEventCb); |
|
370 #else |
367 i = 0; |
371 i = 0; |
368 for(y=0; y<64; y++) |
372 for(y=0; y<64; y++) |
369 for(x=0; x<128; x++) |
373 for(x=0; x<128; x++) |
370 wr_data8(_trBuffer[i++]); |
374 wr_data8(_trBuffer[i++]); |
|
375 #endif |
371 } |
376 } |
372 |
377 |
373 void SSD1322::copy_to_lcd(unsigned char from_col, unsigned char to_col, |
378 void SSD1322::copy_to_lcd(unsigned char from_col, unsigned char to_col, |
374 unsigned char from_row, unsigned char to_row) |
379 unsigned char from_row, unsigned char to_row) |
375 { |
380 { |