mirror of
https://github.com/adafruit/Adafruit_SSD1306.git
synced 2026-07-27 20:05:50 +00:00
Macro for Wire.write to Wire.send in TWI
Current library does not compile in <1.0 because it references Wire.write(), which was called Wire.send() in <1.0 -- added a macro to wrap the change.
This commit is contained in:
@@ -312,8 +312,8 @@ void Adafruit_SSD1306::ssd1306_command(uint8_t c) {
|
||||
// I2C
|
||||
uint8_t control = 0x00; // Co = 0, D/C = 0
|
||||
Wire.beginTransmission(_i2caddr);
|
||||
Wire.write(control);
|
||||
Wire.write(c);
|
||||
WIRE_WRITE(control);
|
||||
WIRE_WRITE(c);
|
||||
Wire.endTransmission();
|
||||
}
|
||||
}
|
||||
@@ -426,8 +426,8 @@ void Adafruit_SSD1306::ssd1306_data(uint8_t c) {
|
||||
// I2C
|
||||
uint8_t control = 0x40; // Co = 0, D/C = 1
|
||||
Wire.beginTransmission(_i2caddr);
|
||||
Wire.write(control);
|
||||
Wire.write(c);
|
||||
WIRE_WRITE(control);
|
||||
WIRE_WRITE(c);
|
||||
Wire.endTransmission();
|
||||
}
|
||||
}
|
||||
@@ -469,9 +469,9 @@ void Adafruit_SSD1306::display(void) {
|
||||
for (uint16_t i=0; i<(SSD1306_LCDWIDTH*SSD1306_LCDHEIGHT/8); i++) {
|
||||
// send a bunch of data in one xmission
|
||||
Wire.beginTransmission(_i2caddr);
|
||||
Wire.write(0x40);
|
||||
WIRE_WRITE(0x40);
|
||||
for (uint8_t x=0; x<16; x++) {
|
||||
Wire.write(buffer[i]);
|
||||
WIRE_WRITE(buffer[i]);
|
||||
i++;
|
||||
}
|
||||
i--;
|
||||
|
||||
@@ -18,8 +18,10 @@ All text above, and the splash screen must be included in any redistribution
|
||||
|
||||
#if ARDUINO >= 100
|
||||
#include "Arduino.h"
|
||||
#define WIRE_WRITE Wire.write
|
||||
#else
|
||||
#include "WProgram.h"
|
||||
#define WIRE_WRITE Wire.send
|
||||
#endif
|
||||
|
||||
#ifdef __SAM3X8E__
|
||||
|
||||
Reference in New Issue
Block a user