29 void setPins(uint8_t clk, uint8_t mos, uint8_t res = 255, uint8_t dc = 255,
44 if (resPin != 255) { pinMode(resPin, OUTPUT); }
45 pinMode(clkPin, OUTPUT);
46 digitalWrite(clkPin, LOW);
47 pinMode(mosPin, OUTPUT);
48 if (dcPin != 255) { pinMode(dcPin, OUTPUT); }
49 if (csPin != 255) { pinMode(csPin, OUTPUT); }
55 if (resPin == 255) {
return; }
56 digitalWrite(resPin, LOW);
57 delayMicroseconds(10);
58 digitalWrite(resPin, HIGH);
59 delayMicroseconds(10);
70 pinMode(clkPin, OUTPUT);
71 digitalWrite(clkPin, LOW);
72 pinMode(mosPin, OUTPUT);
73 if (csPin != 255) { digitalWrite(csPin, LOW); }
80 if (csPin != 255) { digitalWrite(csPin, HIGH); }
88 if (dcPin != 255) { digitalWrite(dcPin, LOW); }
96 if (dcPin != 255) { digitalWrite(dcPin, HIGH); }
105 digitalWrite(clkPin, LOW);
106 digitalWrite(mosPin, dataMode);
107 digitalWrite(clkPin, HIGH);
110 digitalWrite(clkPin, LOW);
111 digitalWrite(mosPin, d >> 7 & 1);
112 digitalWrite(clkPin, HIGH);
114 digitalWrite(clkPin, LOW);
115 digitalWrite(mosPin, d >> 6 & 1);
116 digitalWrite(clkPin, HIGH);
118 digitalWrite(clkPin, LOW);
119 digitalWrite(mosPin, d >> 5 & 1);
120 digitalWrite(clkPin, HIGH);
122 digitalWrite(clkPin, LOW);
123 digitalWrite(mosPin, d >> 4 & 1);
124 digitalWrite(clkPin, HIGH);
126 digitalWrite(clkPin, LOW);
127 digitalWrite(mosPin, d >> 3 & 1);
128 digitalWrite(clkPin, HIGH);
130 digitalWrite(clkPin, LOW);
131 digitalWrite(mosPin, d >> 2 & 1);
132 digitalWrite(clkPin, HIGH);
134 digitalWrite(clkPin, LOW);
135 digitalWrite(mosPin, d >> 1 & 1);
136 digitalWrite(clkPin, HIGH);
138 digitalWrite(clkPin, LOW);
139 digitalWrite(mosPin, d >> 0 & 1);
140 digitalWrite(clkPin, HIGH);
144 uint8_t clkPin = 13, mosPin = 13, resPin = 255, dcPin = 255, csPin = 255;
170 PololuSH1106(uint8_t clk, uint8_t mos, uint8_t res = 255, uint8_t dc = 255,
SH1106 core class implemented using Arduino I/O functions.
void sh1106TransferEnd()
This function is called by PololuSH1106Main to end a data transfer to the SH1106.
void sh1106DataMode()
This function is called by PololuSH1106Main to indicate that the bytes it is about to pass to sh1106W...
void sh1106CommandMode()
This function is called by PololuSH1106Main to indicate that the bytes it is about to pass to sh1106W...
void setPins(uint8_t clk, uint8_t mos, uint8_t res=255, uint8_t dc=255, uint8_t cs=255)
Configures what pins this class will use.
void initPins()
This function is called by PololuSH1106Main to perform any initializations that might be needed for t...
void sh1106TransferStart()
This function is called by PololuSH1106Main to start a data transfer to the SH1106.
void sh1106Write(uint8_t d)
This function is called by PololuSH1106Main to write commands or data to the SH1106.
void reset()
This function is called by PololuSH1106Main to reset the SH1106.
Generic SH1106 class implemented using Arduino I/O functions.
PololuSH1106(uint8_t clk, uint8_t mos, uint8_t res=255, uint8_t dc=255, uint8_t cs=255)
Creates a new instance of PololuSH1106.
This class makes it easy to display text and graphics on a 128x64 SH1106 OLED.
PololuSH1106Core core
This object handles all low-level communication with the SH1106.