38 lines
778 B
C++
38 lines
778 B
C++
#ifndef LEDMATRIX
|
|
#define LEDMATRIX
|
|
|
|
using namespace std;
|
|
|
|
#include <Arduino.h>
|
|
#include <FastLED.h>
|
|
#include <vector>
|
|
|
|
#include <font_5x7.h>
|
|
// #include <font_8x8.h>
|
|
// #include <font_16x16.h>
|
|
|
|
class LedMatrix : public CFastLED
|
|
{
|
|
private:
|
|
uint8_t height;
|
|
uint8_t width;
|
|
|
|
static const uint8_t MATRIX_PIN = 28;
|
|
uint16_t num_leds; // default 64x64 = 4096 LEDs
|
|
vector<CRGB> leds; // Automatic memory management
|
|
|
|
template <size_t N>
|
|
uint8_t charWidth(const uint8_t *charMatrix);
|
|
|
|
public:
|
|
LedMatrix(uint8_t h = 64, uint8_t w = 64);
|
|
|
|
~LedMatrix();
|
|
|
|
void drawPixel(int x, int y, CRGB color);
|
|
uint8_t drawChar(int x, int y, char c, CRGB color);
|
|
// Draw text string
|
|
void drawText(int x, int y, const char *text, CRGB color);
|
|
};
|
|
|
|
#endif |