Started reorganizing the code. Put everything existing to OLD and began with a new main.cppy

This commit is contained in:
Matthias Mitscherlich
2024-02-29 16:53:16 +01:00
parent 29e2e14850
commit 4b31b6c618
29 changed files with 446 additions and 359 deletions
+168
View File
@@ -0,0 +1,168 @@
// --------------------------------------------------------------------------------------------------------------------
/// \file bme280.h
/// \brief File description
// --------------------------------------------------------------------------------------------------------------------
//
// vbchaos software design
//
// --------------------------------------------------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2023 vbchaos
// --------------------------------------------------------------------------------------------------------------------
#ifndef MAIN_INC_BMP280_H_
#define MAIN_INC_BMP280_H_
/**
* bme280 implementation
* \defgroup bme280
* \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 "i2c.h"
// --------------------------------------------------------------------------------------------------------------------
// Constant and macro definitions
// --------------------------------------------------------------------------------------------------------------------
#define BMP280_DEVICE_ID ((uint8_t)0x58)
#define BMP280_RESET_VALUE ((uint8_t)0xB6)
// --------------------------------------------------------------------------------------------------------------------
// Type definitions.
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Function declarations
// --------------------------------------------------------------------------------------------------------------------
class BMP280
{
public:
BMP280(I2C* bus, uint8_t slaveAddress);
typedef enum
{
STANDBY = 0,
FORCED = 1,
NORMAL = 3
} BMP280_Mode_t;
typedef enum
{
SKIPPED = 0,
X1 = 1,
X2 = 2,
X4 = 3,
X8 = 4,
X16 = 5
} BMP280_Oversampling_t;
void resetSensor(void);
bool initialize(void);
bool setSensorMode(BMP280_Mode_t mode);
bool setSensorTemperatureOversampling(BMP280_Oversampling_t oversampling);
int getTemperature(void);
private:
struct CompensationParameters
{
// Temperature compensation parameters
uint16_t dig_T1;
int16_t dig_T2;
int16_t dig_T3;
// Pressure compensation parameters
uint16_t dig_P1;
int16_t dig_P2;
int16_t dig_P3;
int16_t dig_P4;
int16_t dig_P5;
int16_t dig_P6;
int16_t dig_P7;
int16_t dig_P8;
int16_t dig_P9;
} compensationParameters;
struct memorymap
{
struct
{
uint8_t msb;
uint8_t lsb;
uint8_t xlsb;
} temperature_raw;
struct
{
uint8_t msb;
uint8_t lsb;
uint8_t xlsb;
} pressure_raw;
struct
{
uint8_t t_sb: 3;
uint8_t filter: 3;
uint8_t unused: 1;
uint8_t spi3w_en: 1;
} config;
struct
{
uint8_t mode : 2;
uint8_t oversampling_pressure : 3;
uint8_t oversampling_temp : 3;
} ctrl_meas;
uint8_t status;
uint8_t reset;
uint8_t id;
} memorymap;
int t_fine;
int temperature;
I2C* bus;
uint8_t slaveAddress;
BMP280_Mode_t mode;
void resetDriver(void);
// Communication with Device
void resetDevice(void);
void getDeviceID(void);
void setSensorControlMeasurement(void);
void setSensorConfiguration(void);
void getCompensationValues(void);
void compensateTemperature(void);
void getPreasureValues(void);
void getTemperatureValues(void);
};
/** @} */
#endif /* MAIN_INC_BMP280_H_ */
+99
View File
@@ -0,0 +1,99 @@
// --------------------------------------------------------------------------------------------------------------------
/// \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_ */
+72
View File
@@ -0,0 +1,72 @@
// --------------------------------------------------------------------------------------------------------------------
/// \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_ */
+72
View File
@@ -0,0 +1,72 @@
// --------------------------------------------------------------------------------------------------------------------
/// \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_ */
+83
View File
@@ -0,0 +1,83 @@
// --------------------------------------------------------------------------------------------------------------------
/// \file gpio.h
/// \brief File description
// --------------------------------------------------------------------------------------------------------------------
//
// vbchaos software design
//
// --------------------------------------------------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2023 vbchaos
// --------------------------------------------------------------------------------------------------------------------
#ifndef MAIN_INC_GPIO_H_
#define MAIN_INC_GPIO_H_
// --------------------------------------------------------------------------------------------------------------------
// Include files
// --------------------------------------------------------------------------------------------------------------------
// CompilerIncludes
// All include files that are provided by the compiler directly
// ProjectIncludes
// All include files that are provided by the project
// --------------------------------------------------------------------------------------------------------------------
// Constant and macro definitions
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Type definitions.
// --------------------------------------------------------------------------------------------------------------------
typedef enum
{
GPIO_DIRECTION_INPUT = 0,
GPIO_DIRECTION_OUTPUT = 1
} GPIO_Direction_t;
typedef enum
{
GPIO_VALUE_LOW = 0,
GPIO_VALUE_HIGH = 1
} GPIO_Value_t;
// --------------------------------------------------------------------------------------------------------------------
// Function declarations
// --------------------------------------------------------------------------------------------------------------------
class GPIO
{
public:
GPIO(int number, GPIO_Direction_t direction);
bool SetOutput(GPIO_Value_t value);
GPIO_Value_t GetInput(void);
private:
int number;
GPIO_Direction_t direction;
GPIO_Value_t value = GPIO_VALUE_LOW;
};
/** @} */
#endif /* MAIN_INC_GPIO_H_ */
+86
View File
@@ -0,0 +1,86 @@
// --------------------------------------------------------------------------------------------------------------------
/// \file i2c.h
/// \brief File description
// --------------------------------------------------------------------------------------------------------------------
//
// vbchaos software design
//
// --------------------------------------------------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2023 vbchaos
// --------------------------------------------------------------------------------------------------------------------
#ifndef MAIN_INC_I2C_H_
#define MAIN_INC_I2C_H_
/**
* i2c implementation
* \defgroup i2c
* \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
// --------------------------------------------------------------------------------------------------------------------
// Constant and macro definitions
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Type definitions.
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Function declarations
// --------------------------------------------------------------------------------------------------------------------
class I2C
{
public:
I2C(unsigned int SCL, unsigned int SDA);
bool write_register(uint8_t slaveAddress, uint8_t registerAddress, uint8_t* const data, uint8_t length);
bool read_register(uint8_t slaveAddress, uint8_t registerAddress, uint8_t* data, uint8_t length);
private:
static unsigned int number;
unsigned int thisNumber;
unsigned int SCL;
unsigned int SDA;
unsigned int frequency;
unsigned int timeout_ms;
void write(uint8_t slaveAddress, uint8_t registerAddress, uint8_t* const data, uint8_t length);
void read(uint8_t slaveAddress, uint8_t registerAddress, uint8_t* data, uint8_t length);
};
/** @} */
#endif /* MAIN_INC_I2C_H_ */
+36
View File
@@ -0,0 +1,36 @@
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdint.h>
#include "driver/rmt_encoder.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Type of led strip encoder configuration
*/
typedef struct {
uint32_t resolution; /*!< Encoder resolution, in Hz */
} led_strip_encoder_config_t;
/**
* @brief Create RMT encoder for encoding LED strip pixels into RMT symbols
*
* @param[in] config Encoder configuration
* @param[out] ret_encoder Returned encoder handle
* @return
* - ESP_ERR_INVALID_ARG for any invalid arguments
* - ESP_ERR_NO_MEM out of memory when creating led strip encoder
* - ESP_OK if creating encoder successfully
*/
esp_err_t rmt_new_led_strip_encoder(const led_strip_encoder_config_t *config, rmt_encoder_handle_t *ret_encoder);
#ifdef __cplusplus
}
#endif
+156
View File
@@ -0,0 +1,156 @@
// --------------------------------------------------------------------------------------------------------------------
/// \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_ */
+196
View File
@@ -0,0 +1,196 @@
// --------------------------------------------------------------------------------------------------------------------
/// \file logger.h
/// \brief File description
// --------------------------------------------------------------------------------------------------------------------
//
// vbchaos software design
//
// --------------------------------------------------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2023 vbchaos
// --------------------------------------------------------------------------------------------------------------------
#ifndef MAIN_INC_LOGGER_H_
#define MAIN_INC_LOGGER_H_
/**
* Logger implementation
* \defgroup Logger
* \brief Implementation of a non-blocking logger for debug purpose
* \ingroup Platform
*
* A non-blocking logger that implements its own task with very low (unimportant)
* priority
* @{
*/
// --------------------------------------------------------------------------------------------------------------------
// Include files
// --------------------------------------------------------------------------------------------------------------------
// CompilerIncludes
// All include files that are provided by the compiler directly
#include <stdbool.h>
#include <stdint.h>
// ProjectIncludes
// All include files that are provided by the project
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/queue.h"
#include "freertos/semphr.h"
#include "driver/uart_select.h"
// --------------------------------------------------------------------------------------------------------------------
// Constant and macro definitions
// --------------------------------------------------------------------------------------------------------------------
/**
* Logs an error
* \memberof Logger
*/
#define LOGGER_ERROR(...) \
Logger::Logger_log(__FILE__, __func__, __LINE__, LOGTYPE_ERROR, ##__VA_ARGS__)
/**
* Logs a success
* \memberof Logger
*/
#define LOGGER_SUCCESS(...) \
Logger::Logger_log(__FILE__, __func__, __LINE__, LOGTYPE_SUCCESS, ##__VA_ARGS__)
/**
* Logs an error
* \memberof Logger
*/
#define LOGGER_WARNING(...) \
Logger::Logger_log(__FILE__, __func__, __LINE__, LOGTYPE_WARNING, ##__VA_ARGS__)
/**
* Logs an error
* \memberof Logger
*/
#define LOGGER_INFO(...) \
Logger::Logger_log(__FILE__, __func__, __LINE__, LOGTYPE_INFO, ##__VA_ARGS__)
/**
* Logs an error
* \memberof Logger
*/
#define LOGGER_DEBUG(...) \
Logger::Logger_log(__FILE__, __func__, __LINE__, LOGTYPE_DEBUG, ##__VA_ARGS__)
/**
* Logs an error
* \memberof Logger
*/
#define LOGGER_PRINT(...) \
Logger::Logger_log("", "", 0, LOGTYPE_PRINT, ##__VA_ARGS__)
/**
* Logs an error
* \memberof Logger
*/
#define LOGGER_ERROR_ISR(...) \
Logger::Logger_logISR(__FILE__, __func__, __LINE__, LOGTYPE_ERROR, ##__VA_ARGS__)
/**
* Logs a success
* \memberof Logger
*/
#define LOGGER_SUCCESS_ISR(...) \
Logger::Logger_logISR(__FILE__, __func__, __LINE__, LOGTYPE_ERROR, ##__VA_ARGS__)
/**
* Logs an error
* \memberof Logger
*/
#define LOGGER_WARNING_ISR(...) \
Logger::Logger_logISR(__FILE__, __func__, __LINE__, LOGTYPE_WARNING, ##__VA_ARGS__)
/**
* Logs an error
* \memberof Logger
*/
#define LOGGER_INFO_ISR(...) \
Logger::Logger_logISR(__FILE__, __func__, __LINE__, LOGTYPE_INFO, ##__VA_ARGS__)
/**
* Logs an error
* \memberof Logger
*/
#define LOGGER_DEBUG_ISR(a, ...) \
Logger::Logger_logISR(a, __FILE__, __func__, __LINE__, LOGTYPE_DEBUG, ##__VA_ARGS__)
/**
* Logs an error
* \memberof Logger
*/
#define LOGGER_PRINT_ISR(a, ...) \
Logger::Logger_logISR(a, "", "", 0, LOGTYPE_PRINT, ##__VA_ARGS__)
// --------------------------------------------------------------------------------------------------------------------
// Type definitions.
// --------------------------------------------------------------------------------------------------------------------
typedef enum
{
LOGTYPE_PRINT, /**< Raw print */
LOGTYPE_DEBUG, /**< Debug information only; will not be stored on SD-card */
LOGTYPE_INFO, /**< Informational messages of important events */
LOGTYPE_WARNING, /**< Recoverable fault */
LOGTYPE_SUCCESS, /**< A specific success message */
LOGTYPE_ERROR /**< Unrecoverable fault */
} LogType;
struct LogQueueItem
{
char fileName[32];
char functionName[32];
char context[128];
int lineNumber;
LogType logType;
};
// --------------------------------------------------------------------------------------------------------------------
// Function declarations
// --------------------------------------------------------------------------------------------------------------------
class Logger
{
public:
static uart_port_t uartPort;
static int queuesize;
static QueueHandle_t logQueue;
Logger(int queuesize, uart_port_t uartPort);
static void Logger_log(const char* fileName, const char* functionName, int lineNumber, LogType logType, const char* format, ...);
static void Logger_logISR(struct Logger* self, const char* fileName, const char* functionName, int lineNumber, LogType logType, const char* context);
private:
static TaskHandle_t logTaskHandle;
static void loggerTask(void* parameters);
static void composeLogQueueItem(struct LogQueueItem* logQueueItem, const char* fileName, const char* functionName,
int lineNumber, LogType logType, const char* context);
};
/** @} */
#endif /* MAIN_INC_LOGGER_H_ */
+80
View File
@@ -0,0 +1,80 @@
// --------------------------------------------------------------------------------------------------------------------
/// \file temperature.h
/// \brief File description
// --------------------------------------------------------------------------------------------------------------------
//
// vbchaos software design
//
// --------------------------------------------------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2023 vbchaos
// --------------------------------------------------------------------------------------------------------------------
#ifndef MAIN_INC_TEMPERATURE_H_
#define MAIN_INC_TEMPERATURE_H_
/**
* temperature implementation
* \defgroup temperature
* \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
// --------------------------------------------------------------------------------------------------------------------
// Constant and macro definitions
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Type definitions.
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Function declarations
// --------------------------------------------------------------------------------------------------------------------
using namespace std;
class Temperature
{
public:
Temperature(void);
void generateWordlist(int temperature, list<string>* wordlist);
void calculateRGB(int temperature, uint8_t* red, uint8_t* green, uint8_t* blue);
private:
int minTemperature;
int maxTemperature;
};
/** @} */
#endif /* MAIN_INC_TEMPERATURE_H_ */
+73
View File
@@ -0,0 +1,73 @@
// --------------------------------------------------------------------------------------------------------------------
/// \file TemperatureWordmap.h
/// \brief File description
// --------------------------------------------------------------------------------------------------------------------
//
// vbchaos software design
//
// --------------------------------------------------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2023 vbchaos
// --------------------------------------------------------------------------------------------------------------------
#ifndef MAIN_INC_TEMPERATUREWORDMAP_H_
#define MAIN_INC_TEMPERATUREWORDMAP_H_
/**
* TemperatureWordmap implementation
* \defgroup TemperatureWordmap
* \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 TemperatureWordmap: public Wordmap
{
public:
TemperatureWordmap(LEDMatrix* matrix);
protected:
void createList_NL(void);
// void createList_EN(void);
};
/** @} */
#endif /* MAIN_INC_TEMPERATUREWORDMAP_H_ */
+86
View File
@@ -0,0 +1,86 @@
// --------------------------------------------------------------------------------------------------------------------
/// \file wifi.h
/// \brief File description
// --------------------------------------------------------------------------------------------------------------------
//
// vbchaos software design
//
// --------------------------------------------------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2023 vbchaos
// --------------------------------------------------------------------------------------------------------------------
#ifndef MAIN_INC_WIFI_H_
#define MAIN_INC_WIFI_H_
/**
* wifi implementation
* \defgroup wifi
* \brief {group_description}
* \addtogroup {Layer}
*
* Detailed description
* @{
*/
// --------------------------------------------------------------------------------------------------------------------
// Include files
// --------------------------------------------------------------------------------------------------------------------
// CompilerIncludes
// All include files that are provided by the compiler directly
#include "esp_system.h"
#include "esp_event.h"
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
// ProjectIncludes
// All include files that are provided by the project
// --------------------------------------------------------------------------------------------------------------------
// Constant and macro definitions
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Type definitions.
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Function declarations
// --------------------------------------------------------------------------------------------------------------------
class Wifi
{
public:
Wifi(void);
void start_client(void);
private:
static EventGroupHandle_t s_wifi_event_group;
static int s_retry_num;
static const char *TAG;
static void event_handler(void* arg, esp_event_base_t event_base, int32_t event_id, void* event_data);
};
/** @} */
#endif /* MAIN_INC_WIFI_H_ */
+107
View File
@@ -0,0 +1,107 @@
// --------------------------------------------------------------------------------------------------------------------
/// \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_ */