// -------------------------------------------------------------------------------------------------------------------- /// \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 // 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 // -------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------- // 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: LEDMatrix(LEDMatrix_Parameters_t* parameters); void setPixelValue(unsigned int row, unsigned int colum, bool value); private: LEDMatrix_Parameters_t parameters; LEDMatrix_Pixel_t* matrix; uint8_t* tx_matrix; unsigned int numberOfPixels; static TaskHandle_t matrixTaskHandle; static SemaphoreHandle_t taskSemaphore; static void matrixTask(void* parameters); }; /** @} */ #endif /* MAIN_INC_LEDMATRIX_H_ */