Files
wordclock/code/main/inc/wordclock.h
T
Matthias Mitscherlich 7cb84d1660 Added clock and wordclock - functional
the matrix needs an update, though. Not all words are well put
2023-01-18 14:54:23 +01:00

131 lines
3.4 KiB
C++

// --------------------------------------------------------------------------------------------------------------------
/// \file wordclock.h
/// \brief File description
// --------------------------------------------------------------------------------------------------------------------
//
// vbchaos software design
//
// --------------------------------------------------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2023 vbchaos
// --------------------------------------------------------------------------------------------------------------------
#ifndef MAIN_INC_WORDCLOCK_H_
#define MAIN_INC_WORDCLOCK_H_
/**
* wordclock implementation
* \defgroup wordclock
* \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 "ledmatrix.h"
#include "clock.h"
// --------------------------------------------------------------------------------------------------------------------
// Constant and macro definitions
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Type definitions.
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Function declarations
// --------------------------------------------------------------------------------------------------------------------
class Wordclock
{
public:
enum language
{
NL = 0,
EN,
NumberOfLanguages
};
Wordclock(LEDMatrix* matrix);
void update(Clock::TimeStructure* timestructure);
private:
LEDMatrix* matrix;
language language;
struct word
{
LEDMatrix::coordinate position;
int length;
};
struct wordmap
{
struct word prefix;
struct word prefix_additional;
struct word almost;
struct word five;
struct word ten;
struct word quarter;
struct word before;
struct word after;
struct word half;
struct word hour[12];
struct word hourPostfix;
};
struct wordmap languagemaps[NumberOfLanguages]
{
{
// prefix
{0,0,3}, {4,0,2},
// almost
{0,0,0},
// five/ten/quarter
{7,0,4}, {0,1,4}, {6,2,5},
// before/after
{7,1,4}, {0,2,4},
// {0,4,4}, {7,3,4},
// half
{0,3,4},
// hours
{{7,4,3},{0,5,4},{7,5,4},{0,6,4},{4,6,4},{6,8,3},{0,7,5},{0,8,4},{6,7,5},{4,8,4},{8,8,3},{0,9,6}},
// hour postfix
{8,9,3}
}
};
};
/** @} */
#endif /* MAIN_INC_WORDCLOCK_H_ */