From 0febd6dee0da4760266ca50f5dfcf96200bc1f9e Mon Sep 17 00:00:00 2001 From: Stanley Huang Date: Tue, 10 Sep 2013 12:56:36 +0800 Subject: fix addressing issue with MEGA --- obdlogger/MicroLCD.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'obdlogger/MicroLCD.cpp') diff --git a/obdlogger/MicroLCD.cpp b/obdlogger/MicroLCD.cpp index 19a45fa..da1cdc2 100644 --- a/obdlogger/MicroLCD.cpp +++ b/obdlogger/MicroLCD.cpp @@ -307,7 +307,7 @@ size_t LCD_SSD1306::write(uint8_t c) if (c > 0x20 && c < 0x7f) { c -= 0x21; for (byte i = 0; i < 5; i++) { - byte d = pgm_read_byte_near(&font5x8[c][i]); + byte d = pgm_read_byte(&font5x8[c][i]); Wire.write(d); if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d); } @@ -335,7 +335,7 @@ size_t LCD_SSD1306::write(uint8_t c) Wire.beginTransmission(_i2caddr); Wire.write(0x40); for (byte i = 0; i <= 14; i += 2) { - byte d = pgm_read_byte_near(&font8x16_terminal[c][i]); + byte d = pgm_read_byte(&font8x16_terminal[c][i]); Wire.write(d); if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d); } @@ -348,7 +348,7 @@ size_t LCD_SSD1306::write(uint8_t c) Wire.beginTransmission(_i2caddr); Wire.write(0x40); for (byte i = 1; i <= 15; i += 2) { - byte d = pgm_read_byte_near(&font8x16_terminal[c][i]); + byte d = pgm_read_byte(&font8x16_terminal[c][i]); Wire.write(d); if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d); } @@ -396,7 +396,7 @@ void LCD_SSD1306::writeDigit(byte n) if (n <= 9) { n += '0' - 0x21; for (byte i = 0; i < 5; i++) { - Wire.write(pgm_read_byte_near(&font5x8[n][i])); + Wire.write(pgm_read_byte(&font5x8[n][i])); } Wire.write(0); } else { @@ -416,7 +416,7 @@ void LCD_SSD1306::writeDigit(byte n) Wire.beginTransmission(_i2caddr); Wire.write(0x40); for (i = 0; i < 16; i ++) { - byte d = pgm_read_byte_near(&digits16x24[n][i * 3]); + byte d = pgm_read_byte(&digits16x24[n][i * 3]); Wire.write(d); if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d); } @@ -429,7 +429,7 @@ void LCD_SSD1306::writeDigit(byte n) Wire.beginTransmission(_i2caddr); Wire.write(0x40); for (i = 0; i < 16; i ++) { - byte d = pgm_read_byte_near(&digits16x24[n][i * 3 + 1]); + byte d = pgm_read_byte(&digits16x24[n][i * 3 + 1]); Wire.write(d); if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d); } @@ -442,7 +442,7 @@ void LCD_SSD1306::writeDigit(byte n) Wire.beginTransmission(_i2caddr); Wire.write(0x40); for (i = 0; i < 16; i ++) { - byte d = pgm_read_byte_near(&digits16x24[n][i * 3 + 2]); + byte d = pgm_read_byte(&digits16x24[n][i * 3 + 2]); Wire.write(d); if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d); } @@ -493,7 +493,7 @@ void LCD_SSD1306::writeDigit(byte n) Wire.beginTransmission(_i2caddr); Wire.write(0x40); for (byte i = 0; i <= 14; i += 2) { - byte d = pgm_read_byte_near(&font8x16_terminal[n][i]); + byte d = pgm_read_byte(&font8x16_terminal[n][i]); Wire.write(d); if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d); } @@ -506,7 +506,7 @@ void LCD_SSD1306::writeDigit(byte n) Wire.beginTransmission(_i2caddr); Wire.write(0x40); for (byte i = 1; i <= 15; i += 2) { - byte d = pgm_read_byte_near(&font8x16_terminal[n][i]); + byte d = pgm_read_byte(&font8x16_terminal[n][i]); Wire.write(d); if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d); } @@ -545,7 +545,7 @@ void LCD_SSD1306::writeDigit(byte n) Wire.beginTransmission(_i2caddr); Wire.write(0x40); for (i = 0; i < 16; i ++) { - byte d = pgm_read_byte_near(&digits16x16[n][i]); + byte d = pgm_read_byte(&digits16x16[n][i]); Wire.write(d); if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d); } @@ -558,7 +558,7 @@ void LCD_SSD1306::writeDigit(byte n) Wire.beginTransmission(_i2caddr); Wire.write(0x40); for (; i < 32; i ++) { - byte d = pgm_read_byte_near(&digits16x16[n][i]); + byte d = pgm_read_byte(&digits16x16[n][i]); Wire.write(d); if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d); } @@ -593,7 +593,7 @@ void LCD_SSD1306::writeDigit(byte n) Wire.write(0x40); if (n <= 9) { for (byte i = 0; i < 8; i++) { - Wire.write(pgm_read_byte_near(&digits8x8[n][i])); + Wire.write(pgm_read_byte(&digits8x8[n][i])); } } else { for (byte i = 0; i < 8; i++) { @@ -631,7 +631,7 @@ void LCD_SSD1306::draw(const PROGMEM byte* buffer, byte x, byte y, byte width, b Wire.beginTransmission(_i2caddr); Wire.write(0x40); for (byte k = 0; k < width; k++, p++) { - Wire.write(pgm_read_byte_near(p)); + Wire.write(pgm_read_byte(p)); } Wire.endTransmission(); } -- cgit v1.2.3