Skip to content

Commit ea7e4b4

Browse files
author
Kirk
committed
some platforms (avr) had issues with in method includes that had pgmspace inclued - a c/c++ type issue. Moved the pgmspace includes into a seperate file, which is included in a cpp file. solved problem. Removed incudes in the font decl files
1 parent 96c17bf commit ea7e4b4

File tree

7 files changed

+65
-10
lines changed

7 files changed

+65
-10
lines changed

src/res/_fnt_31x48.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@ August 13, 2015
3131
// ARDUINO_ARCH_MBED (APOLLO3 v2) does not support or require pgmspace.h / PROGMEM
3232
static const uint8_t font31x48_data [] = {
3333
#elif defined(__AVR__) || defined(__arm__) || defined(__ARDUINO_ARC__)
34-
#include <avr/pgmspace.h>
3534
static const uint8_t font31x48_data [] PROGMEM = {
3635
#else
37-
#include <pgmspace.h>
3836
static const uint8_t font31x48_data [] PROGMEM = {
3937
#endif
4038
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF8, 0xF8, 0xF8, 0xF8,

src/res/_fnt_5x7.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ July 27, 2015
3636
// ARDUINO_ARCH_MBED (APOLLO3 v2) does not support or require pgmspace.h / PROGMEM
3737
static const uint8_t font5x7_data[] = {
3838
#elif defined(__AVR__) || defined(__arm__) || defined(__ARDUINO_ARC__)
39-
#include <avr/pgmspace.h>
39+
// #include <avr/pgmspace.h>
4040
static const uint8_t font5x7_data[] PROGMEM = {
4141
#else
42-
#include <pgmspace.h>
42+
// #include <pgmspace.h>
4343
static const uint8_t font5x7_data[] PROGMEM = {
4444
#endif
4545
0x00, 0x00, 0x00, 0x00, 0x00,

src/res/_fnt_7segment.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@ July 27, 2015
3636
// ARDUINO_ARCH_MBED (APOLLO3 v2) does not support or require pgmspace.h / PROGMEM
3737
static const uint8_t segment7_data [] = {
3838
#elif defined(__AVR__) || defined(__arm__) || defined(__ARDUINO_ARC__)
39-
#include <avr/pgmspace.h>
4039
static const uint8_t segment7_data [] PROGMEM = {
4140
#else
42-
#include <pgmspace.h>
4341
static const uint8_t segment7_data [] PROGMEM = {
4442
#endif
4543
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

src/res/_fnt_8x16.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,8 @@ July 27, 2015
3737
// ARDUINO_ARCH_MBED (APOLLO3 v2) does not support or require pgmspace.h / PROGMEM
3838
static const uint8_t font8x16_data[] = {
3939
#elif defined(__AVR__) || defined(__arm__) || defined(__ARDUINO_ARC__)
40-
#include <avr/pgmspace.h>
4140
static const uint8_t font8x16_data[] PROGMEM = {
4241
#else
43-
#include <pgmspace.h>
4442
static const uint8_t font8x16_data[] PROGMEM = {
4543
#endif
4644
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00,

src/res/_fnt_largenum.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@ July 27, 2015
3636
// ARDUINO_ARCH_MBED (APOLLO3 v2) does not support or require pgmspace.h / PROGMEM
3737
static const uint8_t fontlargenum_data[] = {
3838
#elif defined(__AVR__) || defined(__arm__) || defined(__ARDUINO_ARC__)
39-
#include <avr/pgmspace.h>
4039
static const uint8_t fontlargenum_data[] PROGMEM = {
4140
#else
42-
#include <pgmspace.h>
4341
static const uint8_t fontlargenum_data[] PROGMEM = {
4442
#endif
4543
0x00, 0xC0, 0xF8, 0x7C, 0x3E, 0x3E, 0xFC, 0xF8, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xE0,

src/res/qw_pgm_arduino.h

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
2+
// qw_pgm_arduino.h
3+
//
4+
// This is a library written for SparkFun Qwiic OLED boards that use the SSD1306.
5+
//
6+
// SparkFun sells these at its website: www.sparkfun.com
7+
//
8+
// Do you like this library? Help support SparkFun. Buy a board!
9+
//
10+
// Micro OLED https://www.sparkfun.com/products/14532
11+
// Transparent OLED https://www.sparkfun.com/products/15173
12+
// "Narrow" OLED https://www.sparkfun.com/products/17153
13+
//
14+
//
15+
// Written by Kirk Benell @ SparkFun Electronics, March 2022
16+
//
17+
// This library configures and draws graphics to OLED boards that use the
18+
// SSD1306 display hardware. The library only supports I2C.
19+
//
20+
// Repository:
21+
// https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
22+
//
23+
// Documentation:
24+
// https://sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library/
25+
//
26+
//
27+
// SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
28+
//
29+
// SPDX-License-Identifier: MIT
30+
//
31+
// The MIT License (MIT)
32+
//
33+
// Copyright (c) 2022 SparkFun Electronics
34+
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
35+
// associated documentation files (the "Software"), to deal in the Software without restriction,
36+
// including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
37+
// and/or sell copies of the Software, and to permit persons to whom the Software is furnished to
38+
// do so, subject to the following conditions:
39+
// The above copyright notice and this permission notice shall be included in all copies or substantial
40+
// portions of the Software.
41+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
42+
// NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
43+
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
44+
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
45+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
46+
47+
// File to declare pgmspace in a platform abstract (sort of ) way
48+
49+
#pragma once
50+
51+
#if defined(ARDUINO_ARCH_MBED)
52+
53+
#elif defined(__AVR__) || defined(__arm__) || defined(__ARDUINO_ARC__)
54+
#include <avr/pgmspace.h>
55+
#else
56+
#include <pgmspace.h>
57+
#endif
58+

src/res/qwiic_resdef.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@
5252
//
5353
#pragma once
5454

55+
// NOTE: The way I'm including the font/resource defines, some platforms have
56+
// include file issues
57+
58+
#include "qw_pgm_arduino.h"
59+
5560
#include <stdint.h>
5661

5762
////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)