Added the Matrix handling and clock/day wordmaps
Time and day display is functional again
This commit is contained in:
@@ -1,99 +0,0 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
/// \file clock.h
|
||||
/// \brief File description
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// vbchaos software design
|
||||
//
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
/// $Revision: $
|
||||
/// $Author: $
|
||||
/// $Date: $
|
||||
// (c) 2023 vbchaos
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#ifndef MAIN_INC_CLOCK_H_
|
||||
#define MAIN_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
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using namespace std;
|
||||
|
||||
class Clock
|
||||
{
|
||||
public:
|
||||
|
||||
enum mode
|
||||
{
|
||||
TEN_BEFORE_HALF,
|
||||
TWENTY_OVER
|
||||
};
|
||||
|
||||
Clock(Clock::mode mode);
|
||||
|
||||
void generateWordlist(list<string>* wordlist);
|
||||
|
||||
time_t getTime(void);
|
||||
|
||||
private:
|
||||
|
||||
Clock::mode clockmode;
|
||||
time_t currentTime;
|
||||
|
||||
|
||||
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(struct tm time);
|
||||
};
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* MAIN_INC_CLOCK_H_ */
|
||||
@@ -1,72 +0,0 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
/// \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);
|
||||
protected:
|
||||
void createList_NL(void);
|
||||
// void createList_EN(void);
|
||||
};
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* MAIN_INC_CLOCKWORDMAP_H_ */
|
||||
@@ -1,72 +0,0 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
/// \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_ */
|
||||
@@ -1,156 +0,0 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
/// \file ledmatrix.h
|
||||
/// \brief File description
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// vbchaos software design
|
||||
//
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
/// $Revision: $
|
||||
/// $Author: $
|
||||
/// $Date: $
|
||||
// (c) 2023 vbchaos
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#ifndef MAIN_INC_LEDMATRIX_H_
|
||||
#define MAIN_INC_LEDMATRIX_H_
|
||||
|
||||
/**
|
||||
* ledmatrix implementation
|
||||
* \defgroup ledmatrix
|
||||
* \brief {group_description}
|
||||
* \addtogroup {Layer}
|
||||
*
|
||||
* Detailed description
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Include files
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// CompilerIncludes
|
||||
// All include files that are provided by the compiler directly
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
// ProjectIncludes
|
||||
// All include files that are provided by the project
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/semphr.h"
|
||||
|
||||
#include "driver/rmt_tx.h"
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#define LEDMATRIX_RED_INDEX ((uint32_t)1)
|
||||
#define LEDMATRIX_GREEN_INDEX ((uint32_t)0)
|
||||
#define LEDMATRIX_BLUE_INDEX ((uint32_t)2)
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LEDMATRIX_ORIENTATION_ROW_LEFT_RIGHT,
|
||||
LEDMATRIX_ORIENTATION_ROW_RIGHT_LEFT
|
||||
} LEDMatrix_Orientation_Row_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LEDMATRIX_ORIENTATION_COLUM_UP_DOWN,
|
||||
LEDMATRIX_ORIENTATION_COLUM_DOWN_UP
|
||||
} LEDMatrix_Orientation_Colum_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LEDMATRIX_ORIENTATION_ROW,
|
||||
LEDMATRIX_ORIENTATION_COLUM
|
||||
}LEDMatrix_Orientation_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LEDMatrix_Orientation_Row_t rowOrientation;
|
||||
LEDMatrix_Orientation_Colum_t columOrientation;
|
||||
LEDMatrix_Orientation_t matrixOrientation;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
// RMT objects for transmission
|
||||
rmt_channel_handle_t* rmtChannel;
|
||||
rmt_encoder_handle_t* rmtEncoder;
|
||||
rmt_transmit_config_t* rmtConfig;
|
||||
} LEDMatrix_Parameters_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool on;
|
||||
uint8_t red;
|
||||
uint8_t green;
|
||||
uint8_t blue;
|
||||
} LEDMatrix_Pixel_t;
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
class LEDMatrix
|
||||
{
|
||||
public:
|
||||
|
||||
struct coordinate
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
LEDMatrix(LEDMatrix_Parameters_t* parameters);
|
||||
|
||||
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;
|
||||
LEDMatrix_Pixel_t* matrix;
|
||||
uint8_t* tx_matrix;
|
||||
unsigned int numberOfPixels;
|
||||
|
||||
static bool initialized;
|
||||
static TaskHandle_t matrixTaskHandle;
|
||||
static SemaphoreHandle_t taskSemaphore;
|
||||
static void matrixTask(void* parameters);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
inline BaseType_t LEDMatrix::tick(void)
|
||||
{
|
||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
if (LEDMatrix::initialized)
|
||||
{
|
||||
xSemaphoreGiveFromISR(LEDMatrix::taskSemaphore, &xHigherPriorityTaskWoken);
|
||||
}
|
||||
|
||||
return xHigherPriorityTaskWoken;
|
||||
}
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* MAIN_INC_LEDMATRIX_H_ */
|
||||
@@ -1,107 +0,0 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
/// \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 setColour(uint8_t red, uint8_t green, uint8_t blue);
|
||||
bool setWord(Language_t lang, string identifier, bool value);
|
||||
|
||||
protected:
|
||||
|
||||
struct word
|
||||
{
|
||||
string identifier;
|
||||
list<LEDMatrix::coordinate> pixels;
|
||||
// LEDMatrix::coordinate position;
|
||||
// int length;
|
||||
};
|
||||
|
||||
LEDMatrix* matrix;
|
||||
language language;
|
||||
|
||||
list<struct word> wordlist[NumberOfLanguages];
|
||||
|
||||
void createList_NL(void);
|
||||
void createList_EN(void);
|
||||
|
||||
uint8_t red;
|
||||
uint8_t green;
|
||||
uint8_t blue;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* MAIN_INC_WORDMAP_H_ */
|
||||
Reference in New Issue
Block a user