added clock wordmap and made wordmap a baseclass
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
/// \file clockwordmap.cpp
|
||||
/// \brief Description
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// vbchaos software design
|
||||
//
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
/// $Revision: $
|
||||
/// $Author: $
|
||||
/// $Date: $
|
||||
// (c) 2023 vbchaos
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Include files
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#include "clockwordmap.h"
|
||||
|
||||
|
||||
#include "logger.h"
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Type definitions
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// File-scope variables
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Function definitions
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
ClockWordmap::ClockWordmap(LEDMatrix* matrix) : Wordmap(matrix)
|
||||
{
|
||||
createList_NL();
|
||||
createList_EN();
|
||||
}
|
||||
|
||||
void ClockWordmap::createList_NL(void)
|
||||
{
|
||||
// First, clear the list
|
||||
wordlist[NL].clear();
|
||||
|
||||
// Now lets add all relevant words
|
||||
wordlist[NL].push_back((struct word){"it", {{0,0},{1,0},{2,0}}});
|
||||
wordlist[NL].push_back((struct word){"is", {{4,0},{5,0}}});
|
||||
|
||||
wordlist[NL].push_back((struct word){"ind_five", {{7,0},{8,0},{9,0},{10,0}}});
|
||||
wordlist[NL].push_back((struct word){"ind_ten", {{1,1},{2,1},{3,1},{4,1}}});
|
||||
wordlist[NL].push_back((struct word){"ind_quart", {{6,1},{7,1},{8,1},{9,1},{10,1}}});
|
||||
wordlist[NL].push_back((struct word){"ind_twenty", {{0,2},{1,2},{2,2},{3,2},{4,2},{5,2},{6,2}}});
|
||||
|
||||
wordlist[NL].push_back((struct word){"before", {{6,3},{7,3},{8,3},{9,3}}});
|
||||
wordlist[NL].push_back((struct word){"after", {{1,3},{2,3},{3,3},{4,3}}});
|
||||
|
||||
wordlist[NL].push_back((struct word){"almost", {{0,4},{1,4},{2,4},{3,4},{4,4}}});
|
||||
|
||||
wordlist[NL].push_back((struct word){"half", {{7,4},{8,4},{9,4},{10,4}}});
|
||||
|
||||
wordlist[NL].push_back((struct word){"one", {{3,5},{4,5},{5,5}}});
|
||||
wordlist[NL].push_back((struct word){"two", {{1,5},{2,5},{3,5},{4,5}}});
|
||||
wordlist[NL].push_back((struct word){"three", {{6,5},{7,5},{8,5},{9,5}}});
|
||||
wordlist[NL].push_back((struct word){"four", {{7,6},{8,6},{9,6},{10,5}}});
|
||||
wordlist[NL].push_back((struct word){"five", {{0,6},{1,6},{2,6},{3,6}}});
|
||||
wordlist[NL].push_back((struct word){"six", {{4,6},{5,6},{6,6}}});
|
||||
wordlist[NL].push_back((struct word){"seven", {{0,7},{1,7},{2,7},{3,7},{4,7}}});
|
||||
wordlist[NL].push_back((struct word){"eight", {{0,8},{1,8},{2,8},{3,8}}});
|
||||
wordlist[NL].push_back((struct word){"nine", {{6,7},{7,7},{8,7},{9,7},{10,7}}});
|
||||
wordlist[NL].push_back((struct word){"ten", {{4,8},{5,8},{6,8},{7,8}}});
|
||||
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}}});
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +162,6 @@ void LEDMatrix::matrixTask(void* parameters)
|
||||
xSemaphoreTake(ledmatrix->taskSemaphore, portMAX_DELAY);
|
||||
for (int i = 0; i < ledmatrix->numberOfPixels; i++)
|
||||
{
|
||||
|
||||
if (ledmatrix->matrix[i].on)
|
||||
{
|
||||
matrix[i * 3 + LEDMATRIX_RED_INDEX] = ledmatrix->matrix[i].red;
|
||||
|
||||
@@ -52,8 +52,6 @@ Wordmap::Wordmap(LEDMatrix* matrix)
|
||||
{
|
||||
Wordmap::matrix = matrix;
|
||||
Wordmap::language = NL;
|
||||
|
||||
createList_NL();
|
||||
}
|
||||
|
||||
bool Wordmap::setWord(Language_t lang, string identifier, bool value)
|
||||
@@ -89,12 +87,10 @@ bool Wordmap::setWord(Language_t lang, string identifier, bool value)
|
||||
|
||||
if (returnValue)
|
||||
{
|
||||
if (it->length > 0)
|
||||
std::list<LEDMatrix::coordinate>::iterator pixel;
|
||||
for (pixel = it->pixels.begin(); pixel != it->pixels.end(); pixel++)
|
||||
{
|
||||
for (int i = 0; i < it->length; i++)
|
||||
{
|
||||
matrix->setPixelValue(it->position.x + i, it->position.y, value);
|
||||
}
|
||||
matrix->setPixelValue(pixel->x, pixel->y, value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,39 +101,12 @@ void Wordmap::createList_NL(void)
|
||||
{
|
||||
// First, clear the list
|
||||
wordlist[NL].clear();
|
||||
}
|
||||
|
||||
// Now lets add all relevant words
|
||||
wordlist[NL].push_back((struct word){"it", {0,0}, 3});
|
||||
wordlist[NL].push_back((struct word){"is", {4,0}, 2});
|
||||
|
||||
wordlist[NL].push_back((struct word){"ind_five", {7,0}, 4});
|
||||
wordlist[NL].push_back((struct word){"ind_ten", {1,1}, 4});
|
||||
wordlist[NL].push_back((struct word){"ind_quart", {6,1}, 5});
|
||||
wordlist[NL].push_back((struct word){"ind_twenty", {0,2}, 7});
|
||||
|
||||
wordlist[NL].push_back((struct word){"before", {6,3}, 4});
|
||||
wordlist[NL].push_back((struct word){"after", {1,3}, 4});
|
||||
|
||||
wordlist[NL].push_back((struct word){"almost", {1,4}, 5}),
|
||||
|
||||
wordlist[NL].push_back((struct word){"half", {7,4}, 4});
|
||||
|
||||
wordlist[NL].push_back((struct word){"one", {3,5}, 3});
|
||||
wordlist[NL].push_back((struct word){"two", {1,5}, 4});
|
||||
wordlist[NL].push_back((struct word){"three", {6,5}, 4});
|
||||
wordlist[NL].push_back((struct word){"four", {7,6}, 4});
|
||||
wordlist[NL].push_back((struct word){"five", {0,6}, 4});
|
||||
wordlist[NL].push_back((struct word){"six", {4,6}, 3});
|
||||
wordlist[NL].push_back((struct word){"seven", {0,7}, 5});
|
||||
wordlist[NL].push_back((struct word){"eight", {0,8}, 4});
|
||||
wordlist[NL].push_back((struct word){"nine", {6,7}, 5});
|
||||
wordlist[NL].push_back((struct word){"ten", {4,8}, 4});
|
||||
wordlist[NL].push_back((struct word){"eleven", {8,8}, 3});
|
||||
wordlist[NL].push_back((struct word){"twelve", {0,9}, 6});
|
||||
|
||||
wordlist[NL].push_back((struct word){"hours", {7,9}, 3});
|
||||
void Wordmap::createList_EN(void)
|
||||
{
|
||||
// First, clear the list
|
||||
wordlist[EN].clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user