Move the static globals into the Heatmap object

Fixes #3.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/389/head
Gergely Nagy 8 years ago
parent bf4fc0de5b
commit e7e4ba0690

@ -19,16 +19,16 @@
#include <Akela-Heatmap.h> #include <Akela-Heatmap.h>
namespace Akela { namespace Akela {
static uint8_t heatmap[ROWS][COLS]; uint8_t Heatmap::heatmap[ROWS][COLS];
static uint16_t totalKeys; uint16_t Heatmap::totalKeys;
static uint8_t highestCount; uint8_t Heatmap::highestCount;
static uint16_t updateFrequency = 50; uint16_t Heatmap::updateFrequency = 50;
static uint16_t loopCount; uint16_t Heatmap::loopCount;
static const float heatColors[][3] = {{0.0, 0.0, 0.0}, {0.1, 1, 0.1}, {1, 1, 0.1}, {1, 0.1, 0.1}}; const float Heatmap::heatColors[][3] = {{0.0, 0.0, 0.0}, {0.1, 1, 0.1}, {1, 1, 0.1}, {1, 0.1, 0.1}};
static void void
shiftStats (void) { Heatmap::shiftStats (void) {
highestCount = totalKeys = 0; highestCount = totalKeys = 0;
for (uint8_t r = 0; r < ROWS; r++) { for (uint8_t r = 0; r < ROWS; r++) {
for (uint8_t c = 0; c < COLS; c++) { for (uint8_t c = 0; c < COLS; c++) {
@ -40,8 +40,8 @@ namespace Akela {
} }
} }
static cRGB cRGB
computeColor (float v) { Heatmap::computeColor (float v) {
float fb = 0; float fb = 0;
uint8_t idx1, idx2; uint8_t idx1, idx2;

@ -32,6 +32,17 @@ namespace Akela {
virtual void update (void) final; virtual void update (void) final;
private: private:
static uint8_t heatmap[ROWS][COLS];
static uint16_t totalKeys;
static uint8_t highestCount;
static uint16_t updateFrequency;
static uint16_t loopCount;
static const float heatColors[][3];
static void shiftStats (void);
static cRGB computeColor (float v);
static Key eventHook (Key mappedKey, byte row, byte col, uint8_t keyState); static Key eventHook (Key mappedKey, byte row, byte col, uint8_t keyState);
static void loopHook (bool postClear); static void loopHook (bool postClear);
}; };

Loading…
Cancel
Save