![]() |
Erriez JY-LKM1638 board library for Arduino
1.1.0
This is an optimized JY-MCU JY-LKM1638 library for Arduino. It supports 8x 7-segment display, 8 dual color LEDs and 8 buttons with a simple API.
|
LKM1638Board class, derived from TM1638 library. More...
#include <ErriezLKM1638Board.h>
Public Member Functions | |
LKM1638Board (uint8_t clkPin, uint8_t dioPin, uint8_t stbPin) | |
LKM1638 constructor. More... | |
uint8_t | getButtons () |
Read buttons. More... | |
void | clear () |
Turn all LED's off. | |
void | setColorLED (uint8_t led, LedColor color) |
Set dual color LED. More... | |
void | colorLEDsOn (uint8_t leds, LedColor color) |
Turn multiple color LED's on. More... | |
void | colorLEDsOff (uint8_t leds) |
Turn multiple color LED's off. More... | |
void | refresh () |
Refresh display. | |
void | dotOn (uint8_t pos) |
Turn dot LED on. More... | |
void | dotOff (uint8_t pos) |
Turn dot LED off. More... | |
void | setDots (uint8_t dots) |
Turn multiple dots on or off. More... | |
void | setPrintPos (uint8_t pos) |
Set print position. More... | |
uint8_t | getPrintPos () |
Get print position. More... | |
void | setSegmentsDigit (uint8_t pos, uint8_t leds) |
Write LED segments of a digit. More... | |
void | setDigit (uint8_t pos, uint8_t digit) |
Write digit. More... | |
void | print (uint8_t value) |
Print uint8_t value. More... | |
void | print (uint8_t value, uint8_t radius) |
Print uint8_t with radius. More... | |
void | print (uint8_t value, uint8_t radius, uint8_t maxDigits) |
Print uint8_t with radius and maximum number of digits. More... | |
void | print (uint8_t value, uint8_t radius, uint8_t maxDigits, uint8_t pad) |
Print uint8_t with radius, maximum number of digits and padding digits. More... | |
void | print (uint16_t value) |
void | print (uint16_t value, uint8_t radius) |
void | print (uint16_t value, uint8_t radius, uint8_t maxDigits) |
void | print (uint16_t value, uint8_t radius, uint8_t maxDigits, uint8_t pad) |
void | print (unsigned long value) |
void | print (unsigned long value, uint8_t radius) |
void | print (unsigned long value, uint8_t radius, uint8_t maxDigits) |
void | print (unsigned long value, uint8_t radius, uint8_t maxDigits, uint8_t pad) |
void | print (int8_t value) |
void | print (int8_t value, uint8_t radius) |
void | print (int8_t value, uint8_t radius, uint8_t maxDigits) |
void | print (int16_t value) |
void | print (int16_t value, uint8_t radius) |
void | print (int16_t value, uint8_t radius, uint8_t maxDigits) |
void | print (long value) |
void | print (long value, uint8_t radius) |
void | print (long value, uint8_t radius, uint8_t maxDigits) |
Protected Member Functions | |
void | writeDigit (uint8_t pos) |
Write digit position. More... | |
void | writeUnsignedValue (uint32_t value, uint8_t radius, uint8_t maxDigits, uint8_t pad) |
Write unsigned value to display. More... | |
void | writeSignedValue (int32_t value, uint8_t radius, uint8_t maxDigits) |
Write signed value to display. More... | |
uint8_t | getNumDigits (uint32_t value, uint8_t radius) |
Get number of digits of a signed 32-bit value. More... | |
void | displayOverflow (uint8_t numDigits) |
Display overflow with - characters. More... | |
uint8_t | swapBits (uint8_t data) |
Swap bits. More... | |
uint8_t | swapPos (uint8_t pos) |
Swap digit position. More... | |
uint8_t | swapLeds (uint8_t led) |
Swap dual color LED's. More... | |
Protected Attributes | |
uint8_t | _leds [NUM_DIGITS] |
LED digits. | |
uint8_t | _pos |
Print position. | |
uint8_t | _dots |
Dot LED's. | |
LKM1638Board class, derived from TM1638 library.
Definition at line 66 of file ErriezLKM1638Board.h.
LKM1638Board::LKM1638Board | ( | uint8_t | clkPin, |
uint8_t | dioPin, | ||
uint8_t | stbPin | ||
) |
LKM1638 constructor.
clkPin | Clock pin |
dioPin | Data pin (bi-directional) |
stbPin | Strobe pin (low is enable) |
Definition at line 80 of file ErriezLKM1638Board.cpp.
void LKM1638Board::colorLEDsOff | ( | uint8_t | leds | ) |
Turn multiple color LED's off.
leds | Byte with 8 LED's |
Definition at line 190 of file ErriezLKM1638Board.cpp.
void LKM1638Board::colorLEDsOn | ( | uint8_t | leds, |
LedColor | color | ||
) |
Turn multiple color LED's on.
leds | Byte with 8 LED's |
color | 0: Off 1: Green 2: Red |
Definition at line 177 of file ErriezLKM1638Board.cpp.
|
protected |
Display overflow with - characters.
numDigits | Number of digits to display |
Definition at line 575 of file ErriezLKM1638Board.cpp.
void LKM1638Board::dotOff | ( | uint8_t | pos | ) |
Turn dot LED off.
pos | Position 0..7 |
Definition at line 275 of file ErriezLKM1638Board.cpp.
void LKM1638Board::dotOn | ( | uint8_t | pos | ) |
uint8_t LKM1638Board::getButtons | ( | ) |
|
protected |
Get number of digits of a signed 32-bit value.
value | 32-bit signed value |
radius | Radius |
Definition at line 554 of file ErriezLKM1638Board.cpp.
uint8_t LKM1638Board::getPrintPos | ( | ) |
void LKM1638Board::print | ( | uint8_t | value | ) |
Print uint8_t value.
value | Display value 0..255 |
Definition at line 323 of file ErriezLKM1638Board.cpp.
void LKM1638Board::print | ( | uint8_t | value, |
uint8_t | radius | ||
) |
Print uint8_t with radius.
value | Display value 0..255 |
radius | Radius 2 for binary, 10 for decimal, 16 for HEX |
Definition at line 333 of file ErriezLKM1638Board.cpp.
void LKM1638Board::print | ( | uint8_t | value, |
uint8_t | radius, | ||
uint8_t | maxDigits | ||
) |
Print uint8_t with radius and maximum number of digits.
value | Display value 0..255 |
radius | Radius 2 for binary, 10 for decimal, 16 for HEX |
maxDigits | Maximum number of digits |
Definition at line 344 of file ErriezLKM1638Board.cpp.
void LKM1638Board::print | ( | uint8_t | value, |
uint8_t | radius, | ||
uint8_t | maxDigits, | ||
uint8_t | pad | ||
) |
Print uint8_t with radius, maximum number of digits and padding digits.
value | Display value 0..255 |
radius | Radius 2 for binary, 10 for decimal, 16 for HEX |
maxDigits | Maximum number of digits |
pad | Number of digits starting with a 0 |
Definition at line 356 of file ErriezLKM1638Board.cpp.
void LKM1638Board::setColorLED | ( | uint8_t | led, |
LedColor | color | ||
) |
Set dual color LED.
led | LED number (0 = most right, 7 = most left) |
color | 0: Off 1: Green 2: Red |
Definition at line 144 of file ErriezLKM1638Board.cpp.
void LKM1638Board::setDigit | ( | uint8_t | pos, |
uint8_t | digit | ||
) |
Write digit.
pos | Position 0..7 |
digit | Value 0..9, A..F |
Definition at line 235 of file ErriezLKM1638Board.cpp.
void LKM1638Board::setDots | ( | uint8_t | dots | ) |
Turn multiple dots on or off.
dots | Byte with dots |
Definition at line 287 of file ErriezLKM1638Board.cpp.
void LKM1638Board::setPrintPos | ( | uint8_t | pos | ) |
Set print position.
pos | Position 0..7 |
Definition at line 300 of file ErriezLKM1638Board.cpp.
void LKM1638Board::setSegmentsDigit | ( | uint8_t | pos, |
uint8_t | segments | ||
) |
Write LED segments of a digit.
pos | Position 0..7 |
segments | Segment LED's |
Definition at line 222 of file ErriezLKM1638Board.cpp.
|
protected |
Swap bits.
data | 9-bit unsigned value |
Definition at line 610 of file ErriezLKM1638Board.cpp.
|
protected |
Swap dual color LED's.
led | LED's |
Definition at line 599 of file ErriezLKM1638Board.cpp.
|
protected |
Swap digit position.
pos | Position |
Definition at line 588 of file ErriezLKM1638Board.cpp.
|
protected |
Write digit position.
pos | Digit number 0 is most right digit, 7 is most left digit |
Definition at line 206 of file ErriezLKM1638Board.cpp.
|
protected |
Write signed value to display.
value | signed value -2^31..2^31 |
radius | Radius 2 for binary, 10 for decimal, 16 for HEX |
maxDigits | Maximum number of digits |
Definition at line 506 of file ErriezLKM1638Board.cpp.
|
protected |
Write unsigned value to display.
value | Unsigned value 0..2^32 |
radius | Radius 2 for binary, 10 for decimal, 16 for HEX |
maxDigits | Maximum number of digits |
pad | Number of digits starting with a 0 |
Definition at line 471 of file ErriezLKM1638Board.cpp.