Added the Matrix handling and clock/day wordmaps

Time and day display is functional again
This commit is contained in:
Matthias Mitscherlich
2024-03-21 16:39:20 +01:00
parent ac8505a157
commit 0fcd60ff57
17 changed files with 498 additions and 571 deletions
+108
View File
@@ -0,0 +1,108 @@
// --------------------------------------------------------------------------------------------------------------------
/// \file clock.h
/// \brief File description
// --------------------------------------------------------------------------------------------------------------------
//
// vbchaos software design
//
// --------------------------------------------------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2023 vbchaos
// --------------------------------------------------------------------------------------------------------------------
#ifndef MAIN_APPLICATION_INC_CLOCK_H_
#define MAIN_APPLICATION_INC_CLOCK_H_
/**
* clock implementation
* \defgroup clock
* \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 "time.h"
// --------------------------------------------------------------------------------------------------------------------
// Constant and macro definitions
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Type definitions.
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Function declarations
// --------------------------------------------------------------------------------------------------------------------
class Clock
{
// -----------------------------------------------------------------------------------------------------------------
// Public Section
// -----------------------------------------------------------------------------------------------------------------
public:
typedef enum
{
TEN_BEFORE_HALF,
TWENTY_OVER
}Mode_t;
// Class Constructor
Clock(Mode_t mode);
void generateWordlist(std::list<std::string>* wordlist);
time_t getTime(void);
// -----------------------------------------------------------------------------------------------------------------
// Protected Section
// -----------------------------------------------------------------------------------------------------------------
protected:
// -----------------------------------------------------------------------------------------------------------------
// Private Section
// -----------------------------------------------------------------------------------------------------------------
private:
Mode_t clockmode;
time_t currentTime;
std::string toNumbers[20] {"zero", "one", "two", "three", "four",
"five", "six", "seven", "eight",
"nine", "ten", "eleven", "twelve",
"thirteen", "fourteen", "fifteen",
"sixteen", "seventeen", "eighteen",
"nineteen"};
int calculateHours(struct tm time);
};
/** @} */
#endif /* MAIN_APPLICATION_INC_CLOCK_H_ */
+73
View File
@@ -0,0 +1,73 @@
// --------------------------------------------------------------------------------------------------------------------
/// \file clockwordmap.h
/// \brief File description
// --------------------------------------------------------------------------------------------------------------------
//
// vbchaos software design
//
// --------------------------------------------------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2023 vbchaos
// --------------------------------------------------------------------------------------------------------------------
#ifndef MAIN_INC_CLOCKWORDMAP_H_
#define MAIN_INC_CLOCKWORDMAP_H_
/**
* clockwordmap implementation
* \defgroup clockwordmap
* \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 ClockWordmap: public wordmap
{
public:
ClockWordmap(ledmatrix* matrix);
~ClockWordmap();
protected:
void createList_NL(void);
void createList_EN(void);
};
/** @} */
#endif /* MAIN_INC_CLOCKWORDMAP_H_ */
+86
View File
@@ -0,0 +1,86 @@
// --------------------------------------------------------------------------------------------------------------------
/// \file daywordmap.h
/// \brief File description
// --------------------------------------------------------------------------------------------------------------------
//
// vbchaos software design
//
// --------------------------------------------------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2023 vbchaos
// --------------------------------------------------------------------------------------------------------------------
#ifndef MAIN_APPLICATION_INC_DAYWORDMAP_H_
#define MAIN_APPLICATION_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 Section
// -----------------------------------------------------------------------------------------------------------------
public:
// Class Constructor
DayWordmap(ledmatrix* matrix);
~DayWordmap();
// -----------------------------------------------------------------------------------------------------------------
// Protected Section
// -----------------------------------------------------------------------------------------------------------------
protected:
void createList_NL(void);
void createList_EN(void);
// -----------------------------------------------------------------------------------------------------------------
// Private Section
// -----------------------------------------------------------------------------------------------------------------
private:
};
/** @} */
#endif /* MAIN_APPLICATION_INC_DAYWORDMAP_H_ */
+112
View File
@@ -0,0 +1,112 @@
// --------------------------------------------------------------------------------------------------------------------
/// \file wordmap.h
/// \brief File description
// --------------------------------------------------------------------------------------------------------------------
//
// vbchaos software design
//
// --------------------------------------------------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2023 vbchaos
// --------------------------------------------------------------------------------------------------------------------
#ifndef MAIN_APPLICATION_INC_WORDMAP_H_
#define MAIN_APPLICATION_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
// --------------------------------------------------------------------------------------------------------------------
class wordmap
{
// -----------------------------------------------------------------------------------------------------------------
// Public Section
// -----------------------------------------------------------------------------------------------------------------
public:
// Class Constructor
typedef enum
{
NL = 0,
EN,
NumberOfLanguages
} Language_t;
wordmap(ledmatrix* matrix);
virtual ~wordmap() {}
bool setColour(uint8_t red, uint8_t green, uint8_t blue);
bool setWord(Language_t lang, std::string& identifier, bool value);
// -----------------------------------------------------------------------------------------------------------------
// Protected Section
// -----------------------------------------------------------------------------------------------------------------
protected:
struct word
{
std::string identifier;
std::list<struct ledmatrix::coordinate> pixels;
};
ledmatrix* matrix;
Language_t language;
std::list<struct word> wordlist[NumberOfLanguages];
virtual void createList_NL(void) = 0;
virtual void createList_EN(void) = 0;
uint8_t red;
uint8_t green;
uint8_t blue;
// -----------------------------------------------------------------------------------------------------------------
// Private Section
// -----------------------------------------------------------------------------------------------------------------
private:
};
/** @} */
#endif /* MAIN_APPLICATION_INC_WORDMAP_H_ */