daily pastebin goal
72%
SHARE
TWEET

OLED init

a guest Jan 23rd, 2019 62 in 9 hours
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. static void ssd1306_init(void)
  2. {
  3. #if 0
  4.     static const unsigned char init[] = {
  5.         0xA4,   // Display framebuffer
  6.         0xA6,   // Dispaly normal (not inverted)
  7.         0xAF,   // Display on
  8.     };
  9. #endif
  10. #if 1
  11.     static const unsigned char init[] = {
  12.         0xAE,           // Display off
  13.         0xD5, 0x80,     // Clock divider
  14.         0xA8, 0x3F,     // Multiplex
  15.         0xD3, 0x00,     // Offset
  16.         0x40,           // Start line
  17.         0x8D, 0x14,     // Chargepump internal Vcc
  18.         //0x8D, 0x10,   // Chargepump external Vcc
  19.         //0x20, 0x00,   // Horizontal address mode
  20.         0x20, 0x02,     // Page address mode
  21.         0xA1,           // Segremap
  22.         0xC8,           // Comscandec
  23.         0xDA, 0x12,     // Setcompins
  24.         //0x81, 0x7F,   // Contrast (default)
  25.         0x81, 0xCF,     // Contrast Internal Vcc
  26.         //0x81, 0x9F,   // Contrast External Vcc
  27.         0xD9, 0xF1,     // Precharge internal Vcc
  28.         //0xD9, 0x22,   // Precharge external Vcc (default)
  29.         //0xDB, 0x40,   // Set Vcom deselect
  30.         0xDB, 0x20,     // Set Vcom deselect (default)
  31.         0xA4,           // Display from framebuffer
  32.         0xA6,           // Display normal (not inverted)
  33.         //0xA7,         // Display inverted
  34.         0xAF            // Display on
  35.     };
  36. #endif
  37.  
  38.     lcd_write(init, sizeof(init), lcd_command);
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top