Skip to content

Commit 35caa9b

Browse files
committed
Modified library to detect the microcontroller used and to add the pgmspace header file accordingly
1 parent 4815895 commit 35caa9b

File tree

7 files changed

+35
-10
lines changed

7 files changed

+35
-10
lines changed

library.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name=SparkFun Micro OLED Breakout
1+
name=SparkFun Micro OLED Breakout for ESP8266
22
version=1.1.1
33
author=SparkFun Electronics <techsupport@sparkfun.com>
4-
maintainer=SparkFun Electronics <sparkfun.com>
4+
maintainer=Emil Varughese <emil01@gmail.com>
55
sentence=Library for the <a href="https://www.sparkfun.com/products/13003">SparkFun Micro OLED Breakout</a>.
66
paragraph=Library for the Micro OLED Breakout, a monochrome, 0.66", 64x48 OLED display. Several basic functionlity examples included.
77
category=Display
8-
url=https://github.com/sparkfun/SparkFun_Micro_OLED_Arduino_Library
8+
url=https://github.com/emil01/SparkFun_Micro_OLED_Arduino_Library
99
architectures=*

src/SFE_MicroOLED.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ GNU General Public License for more details.
2828
You should have received a copy of the GNU General Public License
2929
along with this program. If not, see <http://www.gnu.org/licenses/>.
3030
******************************************************************************/
31-
32-
#include <avr/pgmspace.h>
31+
#include <Arduino.h>
32+
#ifdef __AVR__
33+
#include <avr/pgmspace.h>
34+
#else
35+
#include <pgmspace.h>
36+
#endif
3337
#include <SFE_MicroOLED.h>
3438

3539
// This fixed ugly GCC warning "only initialized variables can be placed into program memory area"

src/SFE_MicroOLED.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
3434

3535
#include <stdio.h>
3636
#include <Arduino.h>
37-
#include <avr/pgmspace.h>
37+
38+
#ifdef __AVR__
39+
#include <avr/pgmspace.h>
40+
#else
41+
#include <pgmspace.h>
42+
#endif
3843

3944
#define swap(a, b) { uint8_t t = a; a = b; b = t; }
4045

src/util/7segment.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
#ifndef FONT7SEGMENT_H
2020
#define FONT7SEGMENT_H
2121

22-
#include <avr/pgmspace.h>
22+
#ifdef __AVR__
23+
#include <avr/pgmspace.h>
24+
#else
25+
#include <pgmspace.h>
26+
#endif
2327

2428
static const unsigned char sevensegment [] PROGMEM = {
2529
// first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256)

src/util/font5x7.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
#ifndef FONT5X7_H
2020
#define FONT5X7_H
2121

22-
#include <avr/pgmspace.h>
22+
#ifdef __AVR__
23+
#include <avr/pgmspace.h>
24+
#else
25+
#include <pgmspace.h>
26+
#endif
2327

2428
// Standard ASCII 5x7 font
2529
static const unsigned char font5x7[] PROGMEM = {

src/util/font8x16.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
#ifndef FONT8X16_H
2020
#define FONT8X16_H
2121

22-
#include <avr/pgmspace.h>
22+
#ifdef __AVR__
23+
#include <avr/pgmspace.h>
24+
#else
25+
#include <pgmspace.h>
26+
#endif
2327

2428
static const unsigned char font8x16[] PROGMEM = {
2529
// first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256)

src/util/fontlargenumber.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
#ifndef FONTLARGENUMBER_H
2020
#define FONTLARGENUMBER_H
2121

22-
#include <avr/pgmspace.h>
22+
#ifdef __AVR__
23+
#include <avr/pgmspace.h>
24+
#else
25+
#include <pgmspace.h>
26+
#endif
2327

2428
static const unsigned char fontlargenumber[] PROGMEM = {
2529
// first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256)

0 commit comments

Comments
 (0)