Updated the matrix to the real size

Fixed orientation missings
added the temperature wordmap
This commit is contained in:
Matthias Mitscherlich
2023-11-25 15:24:51 +01:00
parent edeaedeb07
commit 7c2b0d8d24
17 changed files with 723 additions and 48 deletions
+3
View File
@@ -14,6 +14,9 @@ idf_component_register(
"src/clock.cpp"
"src/wordmap.cpp"
"src/clockwordmap.cpp"
"src/daywordmap.cpp"
"src/temperaturewordmap.cpp"
"src/temperature.cpp"
INCLUDE_DIRS # optional, add here public include directories
"inc"
PRIV_INCLUDE_DIRS # optional, add here private include directories
+5
View File
@@ -84,6 +84,8 @@ class BMP280
bool setSensorMode(BMP280_Mode_t mode);
bool setSensorTemperatureOversampling(BMP280_Oversampling_t oversampling);
int getTemperature(void);
private:
struct CompensationParameters
@@ -148,6 +150,9 @@ class BMP280
void compensateTemperature(void);
void getPreasureValues(void);
void getTemperatureValues(void);
};
+72
View File
@@ -0,0 +1,72 @@
// --------------------------------------------------------------------------------------------------------------------
/// \file daywordmap.h
/// \brief File description
// --------------------------------------------------------------------------------------------------------------------
//
// vbchaos software design
//
// --------------------------------------------------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2023 vbchaos
// --------------------------------------------------------------------------------------------------------------------
#ifndef MAIN_INC_DAYWORDMAP_H_
#define MAIN_INC_DAYWORDMAP_H_
/**
* daywordmap implementation
* \defgroup daywordmap
* \brief {group_description}
* \addtogroup {Layer}
*
* Detailed description
* @{
*/
// --------------------------------------------------------------------------------------------------------------------
// Include files
// --------------------------------------------------------------------------------------------------------------------
// CompilerIncludes
// All include files that are provided by the compiler directly
// ProjectIncludes
// All include files that are provided by the project
#include "wordmap.h"
// --------------------------------------------------------------------------------------------------------------------
// Constant and macro definitions
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Type definitions.
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Function declarations
// --------------------------------------------------------------------------------------------------------------------
class DayWordmap: public Wordmap
{
public:
DayWordmap(LEDMatrix* matrix);
protected:
void createList_NL(void);
// void createList_EN(void);
};
/** @} */
#endif /* MAIN_INC_DAYWORDMAP_H_ */
+6
View File
@@ -114,11 +114,15 @@ class LEDMatrix
bool setPixelValue(unsigned int colum, unsigned int row, bool value);
void setGlobalColour(uint8_t red, uint8_t green, uint8_t blue);
void setPixelColour(unsigned int colum, unsigned int row, uint8_t red, uint8_t green, uint8_t blue);
void clear(void);
BaseType_t tick(void);
protected:
unsigned int findPixelIndexFromCoordinates(unsigned int colum, unsigned int row);
private:
LEDMatrix_Parameters_t parameters;
@@ -130,6 +134,8 @@ class LEDMatrix
static TaskHandle_t matrixTaskHandle;
static SemaphoreHandle_t taskSemaphore;
static void matrixTask(void* parameters);
};
+76
View File
@@ -0,0 +1,76 @@
// --------------------------------------------------------------------------------------------------------------------
/// \file temperature.h
/// \brief File description
// --------------------------------------------------------------------------------------------------------------------
//
// vbchaos software design
//
// --------------------------------------------------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2023 vbchaos
// --------------------------------------------------------------------------------------------------------------------
#ifndef MAIN_INC_TEMPERATURE_H_
#define MAIN_INC_TEMPERATURE_H_
/**
* temperature implementation
* \defgroup temperature
* \brief {group_description}
* \addtogroup {Layer}
*
* Detailed description
* @{
*/
// --------------------------------------------------------------------------------------------------------------------
// Include files
// --------------------------------------------------------------------------------------------------------------------
// CompilerIncludes
// All include files that are provided by the compiler directly
#include <string>
#include <list>
// ProjectIncludes
// All include files that are provided by the project
// --------------------------------------------------------------------------------------------------------------------
// Constant and macro definitions
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Type definitions.
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Function declarations
// --------------------------------------------------------------------------------------------------------------------
using namespace std;
class Temperature
{
public:
Temperature(void);
void generateWordlist(int temperature, list<string>* wordlist);
private:
};
/** @} */
#endif /* MAIN_INC_TEMPERATURE_H_ */
+72
View File
@@ -0,0 +1,72 @@
// --------------------------------------------------------------------------------------------------------------------
/// \file TemperatureWordmap.h
/// \brief File description
// --------------------------------------------------------------------------------------------------------------------
//
// vbchaos software design
//
// --------------------------------------------------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2023 vbchaos
// --------------------------------------------------------------------------------------------------------------------
#ifndef MAIN_INC_TEMPERATUREWORDMAP_H_
#define MAIN_INC_TEMPERATUREWORDMAP_H_
/**
* TemperatureWordmap implementation
* \defgroup TemperatureWordmap
* \brief {group_description}
* \addtogroup {Layer}
*
* Detailed description
* @{
*/
// --------------------------------------------------------------------------------------------------------------------
// Include files
// --------------------------------------------------------------------------------------------------------------------
// CompilerIncludes
// All include files that are provided by the compiler directly
// ProjectIncludes
// All include files that are provided by the project
#include "wordmap.h"
// --------------------------------------------------------------------------------------------------------------------
// Constant and macro definitions
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Type definitions.
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Function declarations
// --------------------------------------------------------------------------------------------------------------------
class TemperatureWordmap: public Wordmap
{
public:
TemperatureWordmap(LEDMatrix* matrix);
protected:
void createList_NL(void);
// void createList_EN(void);
};
/** @} */
#endif /* MAIN_INC_TEMPERATUREWORDMAP_H_ */
+5
View File
@@ -73,6 +73,7 @@ class Wordmap
Wordmap(LEDMatrix* matrix);
bool setColour(uint8_t red, uint8_t green, uint8_t blue);
bool setWord(Language_t lang, string identifier, bool value);
protected:
@@ -93,6 +94,10 @@ class Wordmap
void createList_NL(void);
void createList_EN(void);
uint8_t red;
uint8_t green;
uint8_t blue;
};
+65 -16
View File
@@ -43,6 +43,9 @@
#include "clock.h"
#include "clockwordmap.h"
#include "daywordmap.h"
#include "temperaturewordmap.h"
#include "temperature.h"
// --------------------------------------------------------------------------------------------------------------------
@@ -80,11 +83,11 @@ static rmt_encoder_handle_t led_encoder = NULL;
static LEDMatrix_Parameters_t ledmatrix_parameters =
{
LEDMATRIX_ORIENTATION_ROW_RIGHT_LEFT,
LEDMATRIX_ORIENTATION_ROW_LEFT_RIGHT,
LEDMATRIX_ORIENTATION_COLUM_UP_DOWN,
LEDMATRIX_ORIENTATION_COLUM,
11,
10,
LEDMATRIX_ORIENTATION_ROW,
20,
13,
&led_chan,
&led_encoder,
&tx_config
@@ -93,6 +96,8 @@ static LEDMatrix_Parameters_t ledmatrix_parameters =
static LEDMatrix matrix(&ledmatrix_parameters);
static ClockWordmap clockWordmap(&matrix);
static DayWordmap dayWordmap(&matrix);
static TemperatureWordmap tempWordmap(&matrix);
static gptimer_handle_t matrixRefreshTimer = NULL;
@@ -209,6 +214,8 @@ extern "C" void app_main(void)
// Set the sensor to NORMAL mode
bmp280.setSensorMode(BMP280::BMP280_Mode_t::NORMAL);
Temperature temperature;
//--------------------------------------------
// LED Matrix
//
@@ -255,28 +262,49 @@ extern "C" void app_main(void)
Clock clock(Clock::mode::TEN_BEFORE_HALF);
countdown(200);
clockWordmap.setColour(0xFF, 0x00, 0xFF);
dayWordmap.setColour(0x20, 0xFF, 0x80);
tempWordmap.setColour(0x40, 0x40, 0xFF);
list<string> wordlist;
countdown(1000);
list<string> clockWordlist;
list<string> tempWordList;
while (true)
{
clock.generateWordlist(&wordlist);
clock.generateWordlist(&clockWordlist);
matrix.clear();
std::list<string>::iterator it;
for(it = wordlist.begin(); it != wordlist.end(); it++)
for(it = clockWordlist.begin(); it != clockWordlist.end(); it++)
{
clockWordmap.setWord(Wordmap::Language_t::NL, *it, true);
dayWordmap.setWord(Wordmap::Language_t::NL, *it, true);
}
// Get the temperature from sensor
int currentTemperature = bmp280.getTemperature();
currentTemperature = 19;
// LOGGER_INFO("The current temperature is: %i", temperature);
// Generate temperature wordlist
temperature.generateWordlist(currentTemperature, &tempWordList);
for(it = tempWordList.begin(); it != tempWordList.end(); it++)
{
tempWordmap.setWord(Wordmap::Language_t::NL, *it, true);
}
// Add a seconds indicator
matrix.setPixelValue(10, 9, clock.getTime() % 2);
matrix.setPixelValue(11, 11, clock.getTime() % 2);
// Update the matrix
matrix.tick();
// Update the clock every second (1000 ms)
vTaskDelay(1000);
}
}
@@ -296,22 +324,43 @@ static void devTask(void* parameters)
static void colourMapTask(void* parameters)
{
uint8_t red = 0x10;
uint8_t green = 0;
uint8_t blue = 0x04;
uint8_t red = 0xF0;
uint8_t green = 0x20;
uint8_t blue = 0xF0;
// uint8_t red = 0x00;
// uint8_t green = 0x00;
// uint8_t blue = 0x00;
uint32_t counter = 0;
while (true)
{
matrix.setGlobalColour(red, green, blue);
// red = 0;
// green = 0;
// blue = 0;
// if ((counter % 2) == 0)
// {
// red = 0xFF;
// }
// if ((counter % 5) == 0)
// {
// green = 0xFF;
// }
// if ((counter % 9) == 0)
// {
// blue = 0xFF;
// }
// matrix.setGlobalColour(red, green, blue);
// red = counter & 0xFF;
// green = (counter >> 8) & 0xFF;
// blue = (counter >> 16) & 0xFF;
// counter++;
vTaskDelay(30);
counter++;
vTaskDelay(200);
}
}
@@ -354,7 +403,7 @@ static bool IRAM_ATTR timerCallback(gptimer_handle_t timer, const gptimer_alarm_
{
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
xHigherPriorityTaskWoken = matrix.tick();
// xHigherPriorityTaskWoken = matrix.tick();
return xHigherPriorityTaskWoken == pdTRUE;
}
+20
View File
@@ -114,6 +114,16 @@ bool BMP280::setSensorTemperatureOversampling(BMP280_Oversampling_t oversampling
return returnValue;
}
int BMP280::getTemperature(void)
{
// Get latest raw values from device
BMP280::getTemperatureValues();
// Calculate temperature
BMP280::compensateTemperature();
// return the value
return temperature;
}
void BMP280::resetDriver(void)
{
@@ -150,6 +160,16 @@ void BMP280::getCompensationValues(void)
LOGGER_DEBUG("Got compensation values: %04X %04X %04X", compensationParameters.dig_T1, compensationParameters.dig_T2, compensationParameters.dig_T3);
}
void BMP280::getPreasureValues(void)
{
bus->read_register(slaveAddress, ADDRESS_REG_PRESSURE_LSB, (uint8_t*)&memorymap.pressure_raw, sizeof(memorymap.pressure_raw));
}
void BMP280::getTemperatureValues(void)
{
bus->read_register(slaveAddress, ADDRESS_REG_TEMPERATURE_MSB, (uint8_t*)&memorymap.temperature_raw, sizeof(memorymap.temperature_raw));
}
void BMP280::compensateTemperature(void)
{
int adc_T = 0;
+30 -2
View File
@@ -74,8 +74,8 @@ void Clock::generateWordlist(list<string>* wordlist)
// currentTime += 100;
localtime_r(&currentTime, &tm);
LOGGER_INFO("%lld\n\r", currentTime);
LOGGER_INFO("%02i:%02i:%02i\n\r", tm.tm_hour, tm.tm_min, tm.tm_sec);
// LOGGER_INFO("%lld\n\r", currentTime);
// LOGGER_INFO("%02i:%02i:%02i\n\r", tm.tm_hour, tm.tm_min, tm.tm_sec);
wordlist->clear();
wordlist->push_back("it");
@@ -154,6 +154,34 @@ void Clock::generateWordlist(list<string>* wordlist)
wordlist->push_back("almost");
wordlist->push_back("hours");
}
// Attach the day as a word, too
switch (tm.tm_wday)
{
case 0:
wordlist->push_back("sunday");
break;
case 1:
wordlist->push_back("monday");
break;
case 2:
wordlist->push_back("tuesday");
break;
case 3:
wordlist->push_back("wednesday");
break;
case 4:
wordlist->push_back("thursday");
break;
case 5:
wordlist->push_back("friday");
break;
case 6:
wordlist->push_back("saturday");
break;
default:
wordlist->push_back("sunday");
}
}
+1 -1
View File
@@ -89,7 +89,7 @@ void ClockWordmap::createList_NL(void)
wordlist[NL].push_back((struct word){"eleven", {{8,8},{9,8},{10,8}}});
wordlist[NL].push_back((struct word){"twelve", {{0,9},{1,9},{2,9},{3,9},{4,9},{5,9}}});
wordlist[NL].push_back((struct word){"hours", {{7,9},{8,9},{9,9}}});
wordlist[NL].push_back((struct word){"hours", {{8,9},{9,9},{10,9}}});
}
+76
View File
@@ -0,0 +1,76 @@
// --------------------------------------------------------------------------------------------------------------------
/// \file daywordmap.cpp
/// \brief Description
// --------------------------------------------------------------------------------------------------------------------
//
// vbchaos software design
//
// --------------------------------------------------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2023 vbchaos
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Include files
// --------------------------------------------------------------------------------------------------------------------
#include "daywordmap.h"
#include "logger.h"
// --------------------------------------------------------------------------------------------------------------------
// Constant and macro definitions
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Type definitions
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// File-scope variables
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Function declarations
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Function definitions
// --------------------------------------------------------------------------------------------------------------------
DayWordmap::DayWordmap(LEDMatrix* matrix) : Wordmap(matrix)
{
createList_NL();
createList_EN();
}
void DayWordmap::createList_NL(void)
{
// First, clear the list
wordlist[NL].clear();
// Now lets add all relevant words
wordlist[NL].push_back((struct word){"monday", {{0,12},{1,12},{2,12},{3,12},{4,12},{5,12},{6,12}}});
wordlist[NL].push_back((struct word){"tuesday", {{13,12},{14,12},{15,12},{16,12},{17,12},{18,12},{19,12}}});
wordlist[NL].push_back((struct word){"wednesday", {{11,10},{12,10},{13,10},{14,10},{15,10},{16,10},{17,10},{18,10}}});
wordlist[NL].push_back((struct word){"thursday", {{2,11},{3,11},{4,11},{5,11},{6,11},{7,11},{8,11},{9,11},{10,11}}});
wordlist[NL].push_back((struct word){"friday", {{12,11},{13,11},{14,11},{15,11},{16,11},{17,11},{18,11}}});
wordlist[NL].push_back((struct word){"saturday", {{0,10},{1,10},{2,10},{3,10},{4,10},{5,10},{6,10},{7,10}}});
wordlist[NL].push_back((struct word){"sunday", {{7,12},{8,12},{9,12},{10,12},{11,12},{12,12}}});
}
+102 -27
View File
@@ -79,8 +79,8 @@ bool LEDMatrix::setPixelValue(unsigned int colum, unsigned int row, bool value)
{
bool returnValue = true;
unsigned int rowC = 0;
unsigned int colC = 0;
// unsigned int rowC = 0;
// unsigned int colC = 0;
unsigned int pixelAddress = 0;
if ((row < parameters.height) && (colum < parameters.width))
@@ -95,6 +95,101 @@ bool LEDMatrix::setPixelValue(unsigned int colum, unsigned int row, bool value)
if (returnValue)
{
// // Determine the actual row coordinate based on the matrix orientation
// if (parameters.columOrientation == LEDMATRIX_ORIENTATION_COLUM_UP_DOWN)
// {
// rowC = row;
// }
// else if (parameters.columOrientation == LEDMATRIX_ORIENTATION_COLUM_DOWN_UP)
// {
// rowC = (parameters.height - 1) - row;
// }
//
// // Determine the actual row coordinate based on the matrix orientation
// if (parameters.rowOrientation == LEDMATRIX_ORIENTATION_ROW_LEFT_RIGHT)
// {
// colC = colum;
// }
// else if (parameters.rowOrientation == LEDMATRIX_ORIENTATION_ROW_RIGHT_LEFT)
// {
// colC = (parameters.width - 1) - colum;
// }
//
// // Calculate the pixel address in the pixel array based on the previous information
// if (parameters.matrixOrientation == LEDMATRIX_ORIENTATION_COLUM)
// {
// pixelAddress = rowC + (colC * parameters.height);
// }
// else if (parameters.matrixOrientation == LEDMATRIX_ORIENTATION_ROW)
// {
// pixelAddress = (rowC * parameters.width) + colC;
// }
pixelAddress = LEDMatrix::findPixelIndexFromCoordinates(colum, row);
// Update the pixel value
matrix[pixelAddress].on = value;
}
return returnValue;
}
void LEDMatrix::setGlobalColour(uint8_t red, uint8_t green, uint8_t blue)
{
for (int i = 0; i < numberOfPixels; i++)
{
matrix[i].red = red;
matrix[i].green = green;
matrix[i].blue = blue;
}
}
void LEDMatrix::setPixelColour(unsigned int colum, unsigned int row, uint8_t red, uint8_t green, uint8_t blue)
{
unsigned int index;
index = LEDMatrix::findPixelIndexFromCoordinates(colum, row);
matrix[index].red = red;
matrix[index].green = green;
matrix[index].blue = blue;
}
void LEDMatrix::clear(void)
{
for (int i = 0; i < numberOfPixels; i++)
{
matrix[i].on = false;
}
}
unsigned int LEDMatrix::findPixelIndexFromCoordinates(unsigned int colum, unsigned int row)
{
bool returnValue = true;
unsigned int index = 0;
unsigned int rowC = 0;
unsigned int colC = 0;
if ((row < parameters.height) && (colum < parameters.width))
{
returnValue = true;
}
else
{
returnValue = false;
}
if (returnValue)
{
// Determine the actual row coordinate based on the matrix orientation
if (parameters.columOrientation == LEDMATRIX_ORIENTATION_COLUM_UP_DOWN)
{
@@ -118,35 +213,14 @@ bool LEDMatrix::setPixelValue(unsigned int colum, unsigned int row, bool value)
// Calculate the pixel address in the pixel array based on the previous information
if (parameters.matrixOrientation == LEDMATRIX_ORIENTATION_COLUM)
{
pixelAddress = rowC + (colC * parameters.height);
index = rowC + (colC * parameters.height);
}
// Update the pixel value
matrix[pixelAddress].on = value;
}
return returnValue;
}
void LEDMatrix::setGlobalColour(uint8_t red, uint8_t green, uint8_t blue)
{
for (int i = 0; i < numberOfPixels; i++)
else if (parameters.matrixOrientation == LEDMATRIX_ORIENTATION_ROW)
{
matrix[i].red = red;
matrix[i].green = green;
matrix[i].blue = blue;
index = (rowC * parameters.width) + colC;
}
}
void LEDMatrix::clear(void)
{
for (int i = 0; i < numberOfPixels; i++)
{
matrix[i].on = false;
}
return index;
}
@@ -178,6 +252,7 @@ void LEDMatrix::matrixTask(void* parameters)
}
rmt_transmit(*ledmatrix->parameters.rmtChannel, *ledmatrix->parameters.rmtEncoder, matrix, sizeof(matrix), ledmatrix->parameters.rmtConfig);
}
}
+76
View File
@@ -0,0 +1,76 @@
// --------------------------------------------------------------------------------------------------------------------
/// \file temperature.cpp
/// \brief Description
// --------------------------------------------------------------------------------------------------------------------
//
// vbchaos software design
//
// --------------------------------------------------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2023 vbchaos
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Include files
// --------------------------------------------------------------------------------------------------------------------
#include "temperature.h"
// --------------------------------------------------------------------------------------------------------------------
// Constant and macro definitions
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Type definitions
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// File-scope variables
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Function declarations
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Function definitions
// --------------------------------------------------------------------------------------------------------------------
Temperature::Temperature()
{
};
void Temperature::generateWordlist(int temperature, list<string>* wordlist)
{
// Clear the list
wordlist->clear();
// Add fixed preamble
wordlist->push_back("it");
wordlist->push_back("is");
// Temperature value to string
wordlist->push_back(to_string(temperature));
// Add fixed postamble
wordlist->push_back("degrees");
}
+95
View File
@@ -0,0 +1,95 @@
// --------------------------------------------------------------------------------------------------------------------
/// \file temperaturewordmap.cpp
/// \brief Description
// --------------------------------------------------------------------------------------------------------------------
//
// vbchaos software design
//
// --------------------------------------------------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2023 vbchaos
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Include files
// --------------------------------------------------------------------------------------------------------------------
#include "temperaturewordmap.h"
#include "logger.h"
// --------------------------------------------------------------------------------------------------------------------
// Constant and macro definitions
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Type definitions
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// File-scope variables
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Function declarations
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Function definitions
// --------------------------------------------------------------------------------------------------------------------
TemperatureWordmap::TemperatureWordmap(LEDMatrix* matrix) : Wordmap(matrix)
{
createList_NL();
createList_EN();
}
void TemperatureWordmap::createList_NL(void)
{
// First, clear the list
wordlist[NL].clear();
// Now lets add all relevant words
wordlist[NL].push_back((struct word){"it", {{14,0},{15,0},{16,0}}});
wordlist[NL].push_back((struct word){"is", {{18,0},{19,0}}});
wordlist[NL].push_back((struct word){"above", {{11,1},{12,1},{13,1},{14,1},{15,1},{18,2},{19,2}}});
wordlist[NL].push_back((struct word){"below", {{12,2},{13,2},{14,2},{15,2},{16,2},{18,2},{19,2}}});
// Tenth
wordlist[NL].push_back((struct word){"14", {{11,4},{12,4},{13,4},{14,4},{16,7},{17,7},{18,7},{19,7}}});
wordlist[NL].push_back((struct word){"15", {{15,4},{16,4},{17,4},{18,4},{16,7},{17,7},{18,7},{19,7}}});
wordlist[NL].push_back((struct word){"16", {{11,5},{12,5},{13,5},{16,7},{17,7},{18,7},{19,7}}});
wordlist[NL].push_back((struct word){"17", {{14,4},{15,4},{16,4},{17,4},{18,4},{16,7},{17,7},{18,7},{19,7}}});
wordlist[NL].push_back((struct word){"18", {{11,6},{12,6},{13,6},{14,6},{16,7},{17,7},{18,7},{19,7}}});
wordlist[NL].push_back((struct word){"19", {{15,6},{16,6},{17,6},{18,6},{19,6},{16,7},{17,7},{18,7},{19,7}}});
// Twentieth
wordlist[NL].push_back((struct word){"20", {{11,8},{12,8},{13,8},{14,8},{15,8},{16,8},{17,8}}});
wordlist[NL].push_back((struct word){"21", {{13,3},{14,3},{15,3},{12,7},{13,7},{11,8},{12,8},{13,8},{14,8},{15,8},{16,8},{17,8}}});
wordlist[NL].push_back((struct word){"22", {{11,3},{12,3},{13,3},{14,3},{12,7},{13,7},{11,8},{12,8},{13,8},{14,8},{15,8},{16,8},{17,8}}});
wordlist[NL].push_back((struct word){"23", {{16,3},{17,3},{18,3},{19,7},{13,7},{11,8},{12,8},{13,8},{14,8},{15,8},{16,8},{17,8}}});
wordlist[NL].push_back((struct word){"24", {{11,4},{12,4},{13,4},{14,4},{12,7},{13,7},{11,8},{12,8},{13,8},{14,8},{15,8},{16,8},{17,8}}});
wordlist[NL].push_back((struct word){"25", {{15,4},{16,4},{17,4},{18,4},{12,7},{13,7},{11,8},{12,8},{13,8},{14,8},{15,8},{16,8},{17,8}}});
wordlist[NL].push_back((struct word){"26", {{11,5},{12,5},{13,5},{12,7},{13,7},{11,8},{12,8},{13,8},{14,8},{15,8},{16,8},{17,8}}});
wordlist[NL].push_back((struct word){"27", {{14,4},{15,4},{16,4},{17,4},{18,4},{12,7},{13,7},{11,8},{12,8},{13,8},{14,8},{15,8},{16,8},{17,8}}});
wordlist[NL].push_back((struct word){"28", {{11,6},{12,6},{13,6},{14,6},{12,7},{13,7},{11,8},{12,8},{13,8},{14,8},{15,8},{16,8},{17,8}}});
wordlist[NL].push_back((struct word){"29", {{15,6},{16,6},{17,6},{18,6},{19,6},{12,7},{13,7},{11,8},{12,8},{13,8},{14,8},{15,8},{16,8},{17,8}}});
wordlist[NL].push_back((struct word){"degrees", {{14,9},{15,9},{16,9},{17,9},{18,9},{19,9}}});
}
+17
View File
@@ -52,6 +52,9 @@ Wordmap::Wordmap(LEDMatrix* matrix)
{
Wordmap::matrix = matrix;
Wordmap::language = NL;
Wordmap::red = 0xFF;
Wordmap::green = 0xFF;
Wordmap::blue = 0xFF;
}
bool Wordmap::setWord(Language_t lang, string identifier, bool value)
@@ -91,12 +94,26 @@ bool Wordmap::setWord(Language_t lang, string identifier, bool value)
for (pixel = it->pixels.begin(); pixel != it->pixels.end(); pixel++)
{
matrix->setPixelValue(pixel->x, pixel->y, value);
matrix->setPixelColour(pixel->x, pixel->y, Wordmap::red, Wordmap::green, Wordmap::blue);
}
}
return returnValue;
}
bool Wordmap::setColour(uint8_t red, uint8_t green, uint8_t blue)
{
bool returnValue = true;
Wordmap::red = red;
Wordmap::green = green;
Wordmap::blue = blue;
return returnValue;
}
void Wordmap::createList_NL(void)
{
// First, clear the list
BIN
View File
Binary file not shown.