Ble for smart sOlutions

Dependencies:   Adafruit_WS2801

Committer:
kris@kris-X682X
Date:
Thu Jun 20 13:20:24 2019 +0200
Revision:
11:d6ed1437c2ee
Parent:
10:d845189d146e
Refactored

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kris@kris-X682X 10:d845189d146e 1 //
kris@kris-X682X 10:d845189d146e 2 // Created by kris on 13-6-19.
kris@kris-X682X 10:d845189d146e 3 //
kris@kris-X682X 10:d845189d146e 4
kris@kris-X682X 10:d845189d146e 5 #ifndef SSS_BLE_MYSTRIPSINGLETON_H
kris@kris-X682X 10:d845189d146e 6 #define SSS_BLE_MYSTRIPSINGLETON_H
kris@kris-X682X 10:d845189d146e 7
kris@kris-X682X 10:d845189d146e 8 #include "Adafruit_WS2801/Adafruit_WS2801.h"
kris@kris-X682X 10:d845189d146e 9 #define STRIP_LENGTH 36
kris@kris-X682X 10:d845189d146e 10 #define CLOCK_PIN p27
kris@kris-X682X 10:d845189d146e 11 #define DATA_PIN p26
kris@kris-X682X 10:d845189d146e 12
kris@kris-X682X 10:d845189d146e 13 #pragma pack(push,1)
kris@kris-X682X 10:d845189d146e 14 struct interests {
kris@kris-X682X 10:d845189d146e 15 uint32_t magic;
kris@kris-X682X 10:d845189d146e 16 uint32_t interest1;
kris@kris-X682X 10:d845189d146e 17 uint32_t interest2;
kris@kris-X682X 10:d845189d146e 18 uint32_t interest3;
kris@kris-X682X 10:d845189d146e 19 uint32_t interest4;
kris@kris-X682X 10:d845189d146e 20 uint32_t interest5;
kris@kris-X682X 10:d845189d146e 21
kris@kris-X682X 10:d845189d146e 22 };
kris@kris-X682X 10:d845189d146e 23 #pragma pack(pop)s
kris@kris-X682X 10:d845189d146e 24 class MyStripSingleton {
kris@kris-X682X 10:d845189d146e 25 private:
kris@kris-X682X 10:d845189d146e 26 /* Here will be the instance stored. */
kris@kris-X682X 10:d845189d146e 27 static MyStripSingleton* instance;
kris@kris-X682X 10:d845189d146e 28 int crawlingLed;
kris@kris-X682X 10:d845189d146e 29 int crawlingLedOldColor;
kris@kris-X682X 10:d845189d146e 30
kris@kris-X682X 10:d845189d146e 31 /* Private constructor to prevent instancing. */
kris@kris-X682X 10:d845189d146e 32 MyStripSingleton();
kris@kris-X682X 10:d845189d146e 33 public:
kris@kris-X682X 10:d845189d146e 34 interests ints;
kris@kris-X682X 10:d845189d146e 35 /* Static access method. */
kris@kris-X682X 10:d845189d146e 36 static MyStripSingleton* getInstance();
kris@kris-X682X 10:d845189d146e 37 int ambientColor;
kris@kris-X682X 10:d845189d146e 38 Adafruit_WS2801 strip;
kris@kris-X682X 10:d845189d146e 39 uint32_t Color(uint8_t r, uint8_t g, uint8_t b);
kris@kris-X682X 10:d845189d146e 40 uint32_t Wheel(uint8_t WheelPos);
kris@kris-X682X 10:d845189d146e 41 void rainbow(uint8_t waittime);
kris@kris-X682X 10:d845189d146e 42 void rainbowCycle(uint8_t waittime);
kris@kris-X682X 10:d845189d146e 43 void colorWipe(uint8_t waittime, uint32_t c);
kris@kris-X682X 10:d845189d146e 44 void show();
kris@kris-X682X 10:d845189d146e 45 void solidColor(uint32_t c);
kris@kris-X682X 10:d845189d146e 46 void blink(int timeout, uint8_t amount);
kris@kris-X682X 10:d845189d146e 47 void crawlSingleLed(int timeout, uint32_t c);
kris@kris-X682X 10:d845189d146e 48 void resetColor();
kris@kris-X682X 10:d845189d146e 49 void flash(int timeout, uint32_t c);
kris@kris-X682X 10:d845189d146e 50 void connectionFlash();
kris@kris-X682X 10:d845189d146e 51 void crawlNextLed(int timeout, uint32_t c);
kris@kris-X682X 10:d845189d146e 52 void resetCrawl();
kris@kris-X682X 10:d845189d146e 53 };
kris@kris-X682X 10:d845189d146e 54
kris@kris-X682X 10:d845189d146e 55
kris@kris-X682X 10:d845189d146e 56 #endif //SSS_BLE_MYSTRIPSINGLETON_H