Adafruit SSD1325 Library
Adafruit_SSD1325.h
Go to the documentation of this file.
1 
4 #ifndef _Adafruit_SSD1325_H_
5 #define _Adafruit_SSD1325_H_
6 
7 #include "Arduino.h"
8 
9 #ifdef __arm__
10 #define _BV(b) (1 << (b))
11 #endif
12 
13 #include <Adafruit_GFX.h>
14 
15 #define BLACK 0
16 #define WHITE 1
17 
18 /*=========================================================================
19  SSD1325 Displays
20  -----------------------------------------------------------------------
21  The driver is used in multiple displays (128x64, 128x32, etc.).
22  Select the appropriate display below to create an appropriately
23  sized framebuffer, etc.
24 
25  SSD1325_128_64 128x64 pixel display
26 
27  SSD1325_128_32 128x32 pixel display
28 
29  You also need to set the LCDWIDTH and LCDHEIGHT defines to an
30  appropriate size
31 
32  -----------------------------------------------------------------------*/
33 #define SSD1325_128_64
34 /*=========================================================================*/
35 
36 #if defined SSD1325_128_64 && defined SSD1325_128_32
37 #error "Only one SSD1325 display can be specified at once in SSD1325.h"
38 #endif
39 #if !defined SSD1325_128_64 && !defined SSD1325_128_32
40 #error "At least one SSD1325 display must be specified in SSD1325.h"
41 #endif
42 
43 #if defined SSD1325_128_64
44 #define SSD1325_LCDWIDTH 128
45 #define SSD1325_LCDHEIGHT 64
46 #endif
47 #if defined SSD1325_128_32
48 #define SSD1325_LCDWIDTH 128
49 #define SSD1325_LCDHEIGHT 32
50 #endif
51 
52 #define SSD1325_SETCOLADDR 0x15
53 #define SSD1325_SETROWADDR 0x75
54 #define SSD1325_SETCONTRAST 0x81
55 #define SSD1325_SETCURRENT 0x84
56 
57 #define SSD1325_SETREMAP 0xA0
58 #define SSD1325_SETSTARTLINE 0xA1
59 #define SSD1325_SETOFFSET 0xA2
60 #define SSD1325_NORMALDISPLAY 0xA4
61 #define SSD1325_DISPLAYALLON 0xA5
62 #define SSD1325_DISPLAYALLOFF 0xA6
63 #define SSD1325_INVERTDISPLAY 0xA7
64 #define SSD1325_SETMULTIPLEX 0xA8
65 #define SSD1325_MASTERCONFIG 0xAD
66 #define SSD1325_DISPLAYOFF 0xAE
67 #define SSD1325_DISPLAYON 0xAF
68 
69 #define SSD1325_SETPRECHARGECOMPENABLE \
70  0xB0
71 #define SSD1325_SETPHASELEN 0xB1
72 #define SSD1325_SETROWPERIOD 0xB2
73 #define SSD1325_SETCLOCK 0xB3
74 #define SSD1325_SETPRECHARGECOMP 0xB4
75 #define SSD1325_SETGRAYTABLE 0xB8
76 #define SSD1325_SETPRECHARGEVOLTAGE 0xBC
77 #define SSD1325_SETVCOMLEVEL 0xBE
78 #define SSD1325_SETVSL 0xBF
79 
80 #define SSD1325_GFXACCEL 0x23
81 #define SSD1325_DRAWRECT 0x24
82 #define SSD1325_COPY 0x25
83 
84 
88 class Adafruit_SSD1325 : public Adafruit_GFX {
89 public:
98  Adafruit_SSD1325(int8_t SID, int8_t SCLK, int8_t DC, int8_t RST, int8_t CS)
99  : Adafruit_GFX(128, 64), sid(SID), sclk(SCLK), dc(DC), rst(RST), cs(CS) {}
100 
108  Adafruit_SSD1325(int8_t SID, int8_t SCLK, int8_t DC, int8_t RST)
109  : Adafruit_GFX(128, 64), sid(SID), sclk(SCLK), dc(DC), rst(RST), cs(-1) {}
116  Adafruit_SSD1325(int8_t DC, int8_t RST, int8_t CS)
117  : Adafruit_GFX(128, 64), sid(-1), sclk(-1), dc(DC), rst(RST), cs(CS) {}
118 
122  void begin(void);
127  void command(uint8_t c);
132  void data(uint8_t c);
133 
137  void clearDisplay(void);
142  void invertDisplay(uint8_t i);
147  void setBrightness(uint8_t i);
151  void display();
152 
159  void drawPixel(int16_t x, int16_t y, uint16_t color);
160 
161 private:
162  int8_t sid, sclk, dc, rst, cs;
163  void spixfer(uint8_t x);
164 #ifdef __AVR__
165  volatile uint8_t *mosiport, *clkport;
166  uint8_t mosipinmask, clkpinmask;
167 #endif
168 };
169 
170 #endif
void display()
Push data currently in RAM to SSD1325 display.
Definition: Adafruit_SSD1325.cpp:325
void command(uint8_t c)
Issue single command to SSD1325.
Definition: Adafruit_SSD1325.cpp:279
void data(uint8_t c)
Send data to SSD1325.
Definition: Adafruit_SSD1325.cpp:302
void invertDisplay(uint8_t i)
High-level command that enables or disables invert mode (WoB vs BoW)
Definition: Adafruit_SSD1325.cpp:271
Adafruit_SSD1325(int8_t DC, int8_t RST, int8_t CS)
Constructor for SSD1325 display.
Definition: Adafruit_SSD1325.h:116
void setBrightness(uint8_t i)
Sets the display brightness.
Adafruit_SSD1325(int8_t SID, int8_t SCLK, int8_t DC, int8_t RST, int8_t CS)
Constructor for SSD1325 display.
Definition: Adafruit_SSD1325.h:98
void clearDisplay(void)
High-level command to clear the display.
Definition: Adafruit_SSD1325.cpp:372
Adafruit_SSD1325(int8_t SID, int8_t SCLK, int8_t DC, int8_t RST)
Constructor for SSD1325 display.
Definition: Adafruit_SSD1325.h:108
void begin(void)
Allocate and initialize display.
Definition: Adafruit_SSD1325.cpp:184
void drawPixel(int16_t x, int16_t y, uint16_t color)
Set/clear/invert a single pixel.
Definition: Adafruit_SSD1325.cpp:148
Class that stores state and functions for interacting with SSD1325 OLED displays. ...
Definition: Adafruit_SSD1325.h:88