-
Notifications
You must be signed in to change notification settings - Fork 0
/
LDM8EDriver.h
54 lines (50 loc) · 1.8 KB
/
LDM8EDriver.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
LDM8EDriver.h
LDM8EDriver - Arduino library for using LDM8E LED display drivers.
Created 2023-06-04 by N.Dornseif
Writen for the LDM8E hardware only.
More info on this library:
https://github.com/ndornseif/LDM8E-Library
More info on the LDM8E hardware:
https://github.com/ndornseif/LDM8E-LEDDisplayController
Published under GPL-3.0 license.
*/
#ifndef LDM8EDriver_h
#define LDM8EDriver_h
#include "Arduino.h"
//Each byte corresponds to a decimal digit that it will display if shifted into the register of a display module.
static constexpr uint8_t LDM8E_DIGIT_BYTES[10] = {0xFC, 0x60, 0xDA, 0xF2, 0x66, 0xB6, 0xBE, 0xE0, 0xFE, 0xF6};
//Represents a string of LDM display modules
class LDM8EDisplay
{
public:
/*
dimmingMode tells the library what dimming mode to use.
0=Chip Enable PWM (LDM2)
1=Split ground PWM (LDM1)
2=Analog dimming (Both)
See GitHub for more info on dimming:
https://github.com/ndornseif/LDM8E-LEDDisplayController
Pin definitions: SerialCLK, RegisterCLK, DataOUT, RegisterCLR, OutputENA, ActyLED, BrightnessControl
*/
LDM8EDisplay(uint8_t dimmingMode, uint8_t numModules, uint8_t pinSCK = 32, uint8_t pinRCK = 33, uint8_t pinSDA = 27, uint8_t pinRCL = 17, uint8_t pinREN = 16, uint8_t pinACT = 2, uint8_t pinBRC = 25);
void begin();
void setDisplay(uint32_t displayData);
void writeDisplay(uint16_t displayNumber, uint32_t orMask);
void setBrightness(uint8_t brightness);
void clearDisplay();
void setActyLED(bool ledState);
private:
void latchData();
void sendByte(uint8_t displayByte);
uint8_t _dimmingMode;
uint8_t _numModules;
uint8_t _pinSCK;
uint8_t _pinRCK;
uint8_t _pinSDA;
uint8_t _pinRCL;
uint8_t _pinREN;
uint8_t _pinACT;
uint8_t _pinBRC;
};
#endif //LDM8EDriver_h