44 Wire.setClock( 400000 );
48 Wire.beginTransmission(
address );
49 if( Wire.endTransmission() != 0 ){
163 Wire.beginTransmission(
address );
164 Wire.write( (uint8_t)0x40 );
169 for( i = 0; i < dataSize; i++ ){
176 Wire.endTransmission();
177 Wire.beginTransmission(
address );
178 Wire.write( (uint8_t)0x40 );
184 Wire.write( data[ i ] );
190 Wire.endTransmission();
197 Wire.beginTransmission(
address );
198 Wire.write( (uint8_t)0x00 );
199 Wire.write( command );
200 Wire.endTransmission();
262 for( x_iter = x; x_iter < ( x + w ); x_iter++ ){
264 for( y_iter = y; y_iter < ( y + h ); y_iter++ ){
280 for( x_iter = 0; x_iter < ( x + w ); x_iter++ ){
282 for( y_iter = 0; y_iter < ( y + h ); y_iter++ ){
299 uint8_t characterData[5];
305 characterData[ 0 ] = pgm_read_byte_near( ASCII + (uint8_t)( c - 32 ) * 5 );
306 characterData[ 1 ] = pgm_read_byte_near( ASCII + (uint8_t)( c - 32 ) * 5 + 1 );
307 characterData[ 2 ] = pgm_read_byte_near( ASCII + (uint8_t)( c - 32 ) * 5 + 2 );
308 characterData[ 3 ] = pgm_read_byte_near( ASCII + (uint8_t)( c - 32 ) * 5 + 3 );
309 characterData[ 4 ] = pgm_read_byte_near( ASCII + (uint8_t)( c - 32 ) * 5 + 4 );
312 for( i = 0; i < 5; i++ ){
315 for( j = 0; j < 8; j++ ){
318 if( !!( characterData[ i ] & ( 1 << j ) ) ^ ( !!
inverted ) ){
338 for( j = 0; j < 8; j++ ){
376 char charBuffer[ 22 ];
379 snprintf( charBuffer, 22,
"%d", d );
389 int m_new = 2 * ( y2 - y1 );
390 int slope_error_new = m_new - ( x2 - x1 );
394 for( x = x1; x <= x2; x++ ){
404 slope_error_new += m_new;
406 if( slope_error_new >= 0 ){
409 slope_error_new -= 2 * ( x2 - x1 );
void writeCharacter(uint8_t c)
Write a character to the display.
uint8_t cursorX
X-coordinate of the cursor.
void writeData(uint8_t *data, uint16_t dataSize)
Write data to the display.
bool inverted
If this flag is set, the draw logic will be inverted.
void displayOff()
Turn off the oled panel.
void line(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2)
Print line to the display.
bool begin()
Init function for the display.
uint8_t buffer[SSD1306_WIDTH *SSD1306_HEIGHT/8]
Pixel buffer.
void clearRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h)
Create a cleared rectangle.
void clearPixel(uint8_t x, uint8_t y)
Clear a pixel by location.
void displayOn()
Turn on the oled panel.
uint8_t address
Address of the display.
void update()
Update the content of the panel.
void setPixel(uint8_t x, uint8_t y)
Set a pixel by location.
uint8_t cursorY
Y-coordinate of the cursor.
void clear()
Clear the display.
ssd1306(uint8_t address_p)
Constructor.
void print(char *str)
Print a c-string tho the display.
void writeCommand(uint8_t c)
Write command to the display.
void fillRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h)
Create a filled rectangle.
#define SSD1306_HEIGHT
Height of the display module in pixels.
#define SSD1306_WIDTH
Width of the display module in pixels.