From 30fb448db5560c2364b1830b10b7fe50dc638d18 Mon Sep 17 00:00:00 2001 From: Scott Allen Date: Thu, 9 Jul 2020 20:45:13 -0400 Subject: [PATCH] Make lcdBootProgram[] a member of Arduboy2Core The lcdBootProgram[] array, containing the commands to initialize the OLED display, isn't considered to be part of the API. To enforce this, and to avoid the possibility of conflicts from other code using the same name, it has been changed from being a global variable to a protected member of the Arduboy2Core class. --- src/Arduboy2Core.cpp | 17 +++++++++-------- src/Arduboy2Core.h | 2 ++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Arduboy2Core.cpp b/src/Arduboy2Core.cpp index cef7f21..d475d26 100644 --- a/src/Arduboy2Core.cpp +++ b/src/Arduboy2Core.cpp @@ -8,7 +8,15 @@ #include -const PROGMEM uint8_t lcdBootProgram[] = { + +//======================================== +//========== class Arduboy2Core ========== +//======================================== + +Arduboy2Core::Arduboy2Core() { } + +// Commands sent to the OLED display to initialize it +const PROGMEM uint8_t Arduboy2Core::lcdBootProgram[] = { // boot defaults are commented out but left here in case they // might prove useful for reference // @@ -72,13 +80,6 @@ const PROGMEM uint8_t lcdBootProgram[] = { // 0x22, 0x00, PAGE_ADDRESS_END }; - -//======================================== -//========== class Arduboy2Core ========== -//======================================== - -Arduboy2Core::Arduboy2Core() { } - void Arduboy2Core::boot() { #ifdef ARDUBOY_SET_CPU_8MHZ diff --git a/src/Arduboy2Core.h b/src/Arduboy2Core.h index d1d4763..0f595f3 100644 --- a/src/Arduboy2Core.h +++ b/src/Arduboy2Core.h @@ -845,6 +845,8 @@ class Arduboy2Core : public Arduboy2NoUSB static void bootOLED(); static void bootPins(); static void bootPowerSaving(); + + static const PROGMEM uint8_t lcdBootProgram[]; }; #endif