From 87bc3d6d8e79f0059cace315b642b189d504796b Mon Sep 17 00:00:00 2001 From: Michel Date: Fri, 3 Nov 2023 18:47:32 +0100 Subject: [PATCH] Rebuild for use as library with PlatformIO --- .gitignore | 2 ++ Charliplexing.cpp | 2 +- .../{LoLShield_Breathe.pde => LoLShield_Breathe.ino} | 1 + ...LShield_CharliHeart.pde => LoLShield_CharliHeart.ino} | 1 + examples/Animations/LoLShield_Demo/LoLShield_Demo.ino | 9 ++++++++- .../LoLShield_DoubleHelix/LoLShield_DoubleHelix.ino | 1 + .../{LoLShield_Life.pde => LoLShield_Life.ino} | 4 ++++ .../Animations/LoLShield_Plasma/LoLShield_Plasma.ino | 1 + .../{LoLShield_Invader.pde => LoLShield_Invader.ino} | 0 .../{LoLShield_Pong.pde => LoLShield_Pong.ino} | 5 ++++- .../{LoLShield_Tetris.pde => LoLShield_Tetris.ino} | 6 +++++- examples/LoLShield_BasicTest/LoLShield_BasicTest.ino | 4 +++- .../{LoLShield_FadeTest.pde => LoLShield_FadeTest.ino} | 1 + .../{LoLShield_FontTest.pde => LoLShield_FontTest.ino} | 0 extras/base12clock/{base12clock.pde => base12clock.ino} | 2 +- .../lolcomm-control/{control.c => control.c.sample} | 0 extras/lolcomm/{lolcomm.pde => lolcomm.ino} | 0 extras/lolcomm/{lolcommands.pde => lolcommands.ino} | 0 18 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 .gitignore rename examples/Animations/LoLShield_Breathe/{LoLShield_Breathe.pde => LoLShield_Breathe.ino} (98%) rename examples/Animations/LoLShield_CharliHeart/{LoLShield_CharliHeart.pde => LoLShield_CharliHeart.ino} (98%) rename examples/Animations/LoLShield_Life/{LoLShield_Life.pde => LoLShield_Life.ino} (97%) rename examples/Games/LoLShield_Invader/{LoLShield_Invader.pde => LoLShield_Invader.ino} (100%) rename examples/Games/LoLShield_Pong/{LoLShield_Pong.pde => LoLShield_Pong.ino} (98%) rename examples/Games/LoLShield_Tetris/{LoLShield_Tetris.pde => LoLShield_Tetris.ino} (99%) rename examples/LoLShield_FadeTest/{LoLShield_FadeTest.pde => LoLShield_FadeTest.ino} (98%) rename extras/LoLShield_FontTest/{LoLShield_FontTest.pde => LoLShield_FontTest.ino} (100%) rename extras/base12clock/{base12clock.pde => base12clock.ino} (99%) rename extras/lolcomm/lolcomm-control/{control.c => control.c.sample} (100%) rename extras/lolcomm/{lolcomm.pde => lolcomm.ino} (100%) rename extras/lolcomm/{lolcommands.pde => lolcommands.ino} (100%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa85607 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.vscode/arduino.json +.vscode/c_cpp_properties.json diff --git a/Charliplexing.cpp b/Charliplexing.cpp index 4d1717a..a9b2c66 100644 --- a/Charliplexing.cpp +++ b/Charliplexing.cpp @@ -462,7 +462,7 @@ void LedSign::SetBrightness(uint8_t brightness) }; #elif SHADES == 8 const int counts[SHADES] = { - 0.0f, + C(0.0f), C(0.030117819624378613658712f), C(0.104876339357015456218728f), C(0.217591430058779512857041f), diff --git a/examples/Animations/LoLShield_Breathe/LoLShield_Breathe.pde b/examples/Animations/LoLShield_Breathe/LoLShield_Breathe.ino similarity index 98% rename from examples/Animations/LoLShield_Breathe/LoLShield_Breathe.pde rename to examples/Animations/LoLShield_Breathe/LoLShield_Breathe.ino index e09a8ba..e900ee0 100644 --- a/examples/Animations/LoLShield_Breathe/LoLShield_Breathe.pde +++ b/examples/Animations/LoLShield_Breathe/LoLShield_Breathe.ino @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "Charliplexing.h" const unsigned int inhale_time_ms = 500; diff --git a/examples/Animations/LoLShield_CharliHeart/LoLShield_CharliHeart.pde b/examples/Animations/LoLShield_CharliHeart/LoLShield_CharliHeart.ino similarity index 98% rename from examples/Animations/LoLShield_CharliHeart/LoLShield_CharliHeart.pde rename to examples/Animations/LoLShield_CharliHeart/LoLShield_CharliHeart.ino index 5286d0a..f76becd 100644 --- a/examples/Animations/LoLShield_CharliHeart/LoLShield_CharliHeart.pde +++ b/examples/Animations/LoLShield_CharliHeart/LoLShield_CharliHeart.ino @@ -7,6 +7,7 @@ 30/Dez/09 - V0.0 wrote the first version at 26C3/Berlin */ +#include #include "Charliplexing.h" struct point { diff --git a/examples/Animations/LoLShield_Demo/LoLShield_Demo.ino b/examples/Animations/LoLShield_Demo/LoLShield_Demo.ino index 71e9af7..b5a89f2 100644 --- a/examples/Animations/LoLShield_Demo/LoLShield_Demo.ino +++ b/examples/Animations/LoLShield_Demo/LoLShield_Demo.ino @@ -1,6 +1,6 @@ #include "Charliplexing.h" #include "Myfont.h" -#include "Arduino.h" +#include #include int toggleState; @@ -19,6 +19,13 @@ byte world[SIZEX][SIZEY][2]; //Creates a double buffer world long density = 50; //Sets density % during seeding int geck = 0; //Counter for re-seeding +void upToggleState(); +void plasma(); +void life(); +void DNA(); +int neighbours(int x, int y); +void seedWorld(); + void setup(){ toggleState = EEPROM.read(EEPROMaddress); upToggleState(); diff --git a/examples/Animations/LoLShield_DoubleHelix/LoLShield_DoubleHelix.ino b/examples/Animations/LoLShield_DoubleHelix/LoLShield_DoubleHelix.ino index bb120cd..68c28df 100644 --- a/examples/Animations/LoLShield_DoubleHelix/LoLShield_DoubleHelix.ino +++ b/examples/Animations/LoLShield_DoubleHelix/LoLShield_DoubleHelix.ino @@ -11,6 +11,7 @@ On every other column, LEDs between the sines will be subtly lit (hopefully resembling DNA nucleobases). */ +#include #include "Charliplexing.h" //initializes the LoL Sheild library diff --git a/examples/Animations/LoLShield_Life/LoLShield_Life.pde b/examples/Animations/LoLShield_Life/LoLShield_Life.ino similarity index 97% rename from examples/Animations/LoLShield_Life/LoLShield_Life.pde rename to examples/Animations/LoLShield_Life/LoLShield_Life.ino index 1a69bd2..1834ea7 100644 --- a/examples/Animations/LoLShield_Life/LoLShield_Life.pde +++ b/examples/Animations/LoLShield_Life/LoLShield_Life.ino @@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include //Imports the library, which needs to be //Initialized in setup. @@ -39,6 +40,9 @@ byte world[2][SIZEX][SIZEY]; //Creates a double buffer world const int density = 50; //Sets density % during seeding int geck = 0; //Counter for re-seeding +void seedWorld(); +byte neighbours(byte x, byte y); + void setup() { LedSign::Init(); //Initilizes the LoL Shield randomSeed(analogRead(5)); diff --git a/examples/Animations/LoLShield_Plasma/LoLShield_Plasma.ino b/examples/Animations/LoLShield_Plasma/LoLShield_Plasma.ino index 12ef984..1f153fc 100644 --- a/examples/Animations/LoLShield_Plasma/LoLShield_Plasma.ino +++ b/examples/Animations/LoLShield_Plasma/LoLShield_Plasma.ino @@ -11,6 +11,7 @@ then this value is shaped using a sine function, and this sets the brightness of each LED. */ +#include #include "Charliplexing.h" //initializes the LoL Sheild library // Convenient 2D point structure diff --git a/examples/Games/LoLShield_Invader/LoLShield_Invader.pde b/examples/Games/LoLShield_Invader/LoLShield_Invader.ino similarity index 100% rename from examples/Games/LoLShield_Invader/LoLShield_Invader.pde rename to examples/Games/LoLShield_Invader/LoLShield_Invader.ino diff --git a/examples/Games/LoLShield_Pong/LoLShield_Pong.pde b/examples/Games/LoLShield_Pong/LoLShield_Pong.ino similarity index 98% rename from examples/Games/LoLShield_Pong/LoLShield_Pong.pde rename to examples/Games/LoLShield_Pong/LoLShield_Pong.ino index 4f00140..3eeea3c 100644 --- a/examples/Games/LoLShield_Pong/LoLShield_Pong.pde +++ b/examples/Games/LoLShield_Pong/LoLShield_Pong.ino @@ -1,5 +1,5 @@ +#include #include -#include //**************************************************************// // Name : Pong for Arduino / Charlieplexing // @@ -34,6 +34,9 @@ int8_t x,y,dx,dy; int8_t sh1y,sh2y,s1,s2; +void drawscores(); +void checkscores(); + /* ---------------------------------------------------------------------------*/ /* Arduino setup func */ diff --git a/examples/Games/LoLShield_Tetris/LoLShield_Tetris.pde b/examples/Games/LoLShield_Tetris/LoLShield_Tetris.ino similarity index 99% rename from examples/Games/LoLShield_Tetris/LoLShield_Tetris.pde rename to examples/Games/LoLShield_Tetris/LoLShield_Tetris.ino index cfd3a41..2811271 100644 --- a/examples/Games/LoLShield_Tetris/LoLShield_Tetris.pde +++ b/examples/Games/LoLShield_Tetris/LoLShield_Tetris.ino @@ -22,10 +22,14 @@ Boston, MA 02111-1307, USA. */ +#include #include "Charliplexing.h" #include "Figure.h" #include "LoLShield_Tetris.h" +void processEndPiece(); +void nextPiece(); + /** The current level. */ int level; @@ -329,7 +333,7 @@ void processEndPiece() { memset(playGrid, '\0', GRID_WIDTH*sizeof(boolean)); // Update the indexes of the other lines to remove. - for (uint8_t k=i; k //AVR library for writing to ROM +#include #include //Imports the library, which needs to be //Initialized in setup. @@ -129,6 +129,8 @@ PROGMEM const uint16_t BitMap[][9] = { {18000} }; +void DisplayBitMap(uint8_t grayscale); + void setup() { LedSign::Init(GRAYSCALE); //Initializes the screen } diff --git a/examples/LoLShield_FadeTest/LoLShield_FadeTest.pde b/examples/LoLShield_FadeTest/LoLShield_FadeTest.ino similarity index 98% rename from examples/LoLShield_FadeTest/LoLShield_FadeTest.pde rename to examples/LoLShield_FadeTest/LoLShield_FadeTest.ino index ed9db6b..124f278 100644 --- a/examples/LoLShield_FadeTest/LoLShield_FadeTest.pde +++ b/examples/LoLShield_FadeTest/LoLShield_FadeTest.ino @@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "Charliplexing.h" // Screen "refresh" diff --git a/extras/LoLShield_FontTest/LoLShield_FontTest.pde b/extras/LoLShield_FontTest/LoLShield_FontTest.ino similarity index 100% rename from extras/LoLShield_FontTest/LoLShield_FontTest.pde rename to extras/LoLShield_FontTest/LoLShield_FontTest.ino diff --git a/extras/base12clock/base12clock.pde b/extras/base12clock/base12clock.ino similarity index 99% rename from extras/base12clock/base12clock.pde rename to extras/base12clock/base12clock.ino index a534ab2..147547f 100644 --- a/extras/base12clock/base12clock.pde +++ b/extras/base12clock/base12clock.ino @@ -31,7 +31,7 @@ //These libraries need to be included for both the LoL Shield //and DS1307 breakout. #include "Charliplexing.h" -#include "WProgram.h" +#include #include #include "RTClib.h" RTC_DS1307 RTC; diff --git a/extras/lolcomm/lolcomm-control/control.c b/extras/lolcomm/lolcomm-control/control.c.sample similarity index 100% rename from extras/lolcomm/lolcomm-control/control.c rename to extras/lolcomm/lolcomm-control/control.c.sample diff --git a/extras/lolcomm/lolcomm.pde b/extras/lolcomm/lolcomm.ino similarity index 100% rename from extras/lolcomm/lolcomm.pde rename to extras/lolcomm/lolcomm.ino diff --git a/extras/lolcomm/lolcommands.pde b/extras/lolcomm/lolcommands.ino similarity index 100% rename from extras/lolcomm/lolcommands.pde rename to extras/lolcomm/lolcommands.ino