22cdad69fc
LED matrix got row and column write actions
117 lines
4.0 KiB
C++
117 lines
4.0 KiB
C++
// --------------------------------------------------------------------------------------------------------------------
|
|
/// \file ledmatrix.h
|
|
/// \brief File description
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
//
|
|
// vbchaos software design
|
|
//
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
/// $Revision: $
|
|
/// $Author: $
|
|
/// $Date: $
|
|
// (c) 2023 vbchaos
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
#ifndef MAIN_PLATFORM_INC_LEDMATRIX_H_
|
|
#define MAIN_PLATFORM_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
|
|
|
|
|
|
|
|
// ProjectIncludes
|
|
// All include files that are provided by the project
|
|
#include "prgm_ledstrip.h"
|
|
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
// Constant and macro definitions
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
// Type definitions.
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
// Function declarations
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
|
|
class ledmatrix : public prgm_ledstrip
|
|
{
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
// Public Section
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
public:
|
|
typedef enum
|
|
{
|
|
ORIENTATION_ROW_LEFT_UP = 0,
|
|
ORIENTATION_ROW_LEFT_DOWN = 1,
|
|
ORIENTATION_ROW_RIGHT_UP = 2,
|
|
ORIENTATION_ROW_RIGHT_DOWN = 3,
|
|
ORIENTATION_COL_LEFT_UP = 4,
|
|
ORIENTATION_COL_LEFT_DOWN = 5,
|
|
ORIENTATION_COL_RIGHT_UP = 6,
|
|
ORIENTATION_COL_RIGHT_DOWN = 7,
|
|
ORIENTATION_END = 8
|
|
} Orientation_t;
|
|
|
|
struct coordinate
|
|
{
|
|
uint32_t x;
|
|
uint32_t y;
|
|
};
|
|
|
|
// Class Constructor
|
|
ledmatrix(uint32_t rows, uint32_t columns, uint32_t gpio);
|
|
|
|
FunctionStatus setOrientation(Orientation_t orientation);
|
|
|
|
FunctionStatus setPixel(uint32_t row, uint32_t column, uint8_t red, uint8_t green, uint8_t blue);
|
|
|
|
FunctionStatus setRow(uint32_t row, uint8_t red, uint8_t green, uint8_t blue);
|
|
FunctionStatus setColumn(uint32_t row, uint8_t red, uint8_t green, uint8_t blue);
|
|
|
|
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
// Protected Section
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
protected:
|
|
|
|
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
// Private Section
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
private:
|
|
uint32_t width;
|
|
uint32_t highth;
|
|
Orientation_t orientation;
|
|
|
|
FunctionStatus calculateIndexFromCoordinates(uint32_t row, uint32_t column, uint32_t* index);
|
|
|
|
};
|
|
|
|
/** @} */
|
|
|
|
|
|
#endif /* MAIN_PLATFORM_INC_LEDMATRIX_H_ */
|