Added wordmap and got the clock running
This commit is contained in:
+14
-28
@@ -34,7 +34,8 @@
|
||||
|
||||
// CompilerIncludes
|
||||
// All include files that are provided by the compiler directly
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
|
||||
// ProjectIncludes
|
||||
@@ -57,45 +58,30 @@
|
||||
// Function declarations
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using namespace std;
|
||||
|
||||
class Clock
|
||||
{
|
||||
public:
|
||||
|
||||
enum FifthsIndication
|
||||
{
|
||||
None_FifthIndication = 0,
|
||||
Five,
|
||||
Ten,
|
||||
Quarter
|
||||
};
|
||||
|
||||
enum BeforeAfterIndication
|
||||
{
|
||||
None_BeforeAfter = 0,
|
||||
Before,
|
||||
After
|
||||
};
|
||||
|
||||
struct TimeStructure
|
||||
{
|
||||
bool prefix;
|
||||
bool almost;
|
||||
FifthsIndication fifths;
|
||||
BeforeAfterIndication beforeAfter;
|
||||
bool half;
|
||||
int hours;
|
||||
bool hourPostfix;
|
||||
};
|
||||
|
||||
Clock();
|
||||
|
||||
TimeStructure updateTime(void);
|
||||
void generateWordlist(list<string>* wordlist);
|
||||
|
||||
time_t getTime(void);
|
||||
|
||||
private:
|
||||
time_t currentTime;
|
||||
|
||||
void toString(TimeStructure* timestructure);
|
||||
string toNumbers[20] {"zero", "one", "two", "three", "four",
|
||||
"five", "six", "seven", "eight",
|
||||
"nine", "ten", "eleven", "twelve",
|
||||
"thirteen", "fourteen", "fifteen",
|
||||
"sixteen", "seventeen", "eighteen",
|
||||
"nineteen"};
|
||||
|
||||
// void toString(TimeStructure* timestructure);
|
||||
int calculateHours(int hour);
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
/// \file wordmap.h
|
||||
/// \brief File description
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// vbchaos software design
|
||||
//
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
/// $Revision: $
|
||||
/// $Author: $
|
||||
/// $Date: $
|
||||
// (c) 2023 vbchaos
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#ifndef MAIN_INC_WORDMAP_H_
|
||||
#define MAIN_INC_WORDMAP_H_
|
||||
|
||||
/**
|
||||
* wordmap implementation
|
||||
* \defgroup wordmap
|
||||
* \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
|
||||
#include "ledmatrix.h"
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using namespace std;
|
||||
|
||||
class Wordmap
|
||||
{
|
||||
public:
|
||||
|
||||
typedef enum language
|
||||
{
|
||||
NL = 0,
|
||||
EN,
|
||||
NumberOfLanguages
|
||||
} Language_t;
|
||||
|
||||
Wordmap(LEDMatrix* matrix);
|
||||
|
||||
bool setWord(Language_t lang, string identifier, bool value);
|
||||
|
||||
private:
|
||||
|
||||
struct word
|
||||
{
|
||||
string identifier;
|
||||
LEDMatrix::coordinate position;
|
||||
int length;
|
||||
};
|
||||
|
||||
LEDMatrix* matrix;
|
||||
language language;
|
||||
|
||||
list<struct word> wordlist[NumberOfLanguages];
|
||||
|
||||
void createList_NL(void);
|
||||
void createList_EN(void);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* MAIN_INC_WORDMAP_H_ */
|
||||
Reference in New Issue
Block a user