PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
|
Serially interfaced, 8-Digit LED display driver. More...
#include <PropWare/hmi/output/max72xx.h>
Public Types | |
enum | Register { Register::NO_OP, Register::DIGIT_ZERO = 0x11, Register::DIGIT_ONE = 0x12, Register::DIGIT_TWO = 0x13, Register::DIGIT_THREE = 0x14, Register::DIGIT_FOUR = 0x15, Register::DIGIT_FIVE = 0x16, Register::DIGIT_SIX = 0x17, Register::DIGIT_SEVEN = 0x18, Register::DECODE_MODE = 0x19, Register::INTENSITY = 0x1A, Register::SCAN_LIMIT = 0x1B, Register::SHUTDOWN = 0x1C, Register::DISPLAY_TEST = 0x1D } |
Register addresses. More... | |
enum | BcdCharacter { ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, DASH, E, H, L, P, BLANK } |
Characters that will utilize the device's built-in font. More... | |
Public Member Functions | |
MAX72xx (SPI &bus, const Pin::Mask csMask, const bool alwaysSetSPIMode=false) | |
Create an object which communicates over the given SPI bus. More... | |
MAX72xx (const Pin::Mask csMask, const bool alwaysSetSPIMode=true) | |
Create an object which communicates over the shared SPI bus. More... | |
void | always_set_spi_mode (const bool alwaysSetMode) |
Choose whether to always set the SPI mode before writing to the device; Useful when multiple devices with different SPI specifications are connected to the bus. More... | |
void | start (const uint8_t intensity=DEFAULT_INTENSITY, const uint8_t scanLimit=DEFAULT_SCAN_LIMIT, const uint8_t bcdDecodeBits=DEFAULT_BCD_DECODE_BITS) const |
Initialize the device after power-on. More... | |
void | shutdown () const |
Disable the device by writing to the SHUTDOWN register. Values in other registers will not be lost. | |
void | set_intensity (const uint8_t intensity) const |
Set the device's brightness. More... | |
void | set_scan_limit (const uint8_t scanLimit) const |
Enables or disables specific digits on the device. More... | |
void | set_decode_mode (const uint8_t bcdDecodeBits) const |
Determines which digits will be decoded and which ones will be converted to the build-in font prior to output. More... | |
void | set_test_mode (const bool enableTestMode) const |
Enable or disable the test mode of the device. When enable, all LED segments will be lit. Test mode will override the shutdown register. More... | |
void | put_int (int32_t x, const BcdCharacter fillChar=BcdCharacter::BLANK, unsigned int width=0) const |
Write an integer to the device. More... | |
void | clear () const |
Write BcdCharacter::BLANK to all eight digits. | |
void | write (const Register address, const uint8_t value, const bool decimal=false) const |
Perform a manual write to the device. More... | |
Static Public Member Functions | |
static Register | to_register (unsigned int zeroIndexedDigit) |
Get the Register address of the requested 0-indexed digit on the device. More... | |
Static Public Attributes | |
static const SPI::Mode | SPI_MODE = SPI::Mode::MODE_1 |
static const uint8_t | DEFAULT_INTENSITY = 15 |
static const uint8_t | DEFAULT_SCAN_LIMIT = 7 |
static const uint8_t | DEFAULT_BCD_DECODE_BITS = 0xFF |
static const uint8_t | DECIMAL_POINT = BIT_7 |
Serially interfaced, 8-Digit LED display driver.
Example of enabling the device and counting from -200 to 200 with a 20 millisecond delay between each number
|
strong |
|
strong |
Register addresses.
PropWare::MAX72xx::MAX72xx | ( | SPI & | bus, |
const Pin::Mask | csMask, | ||
const bool | alwaysSetSPIMode = false |
||
) |
Create an object which communicates over the given SPI bus.
[in] | bus | SPI bus for communication |
[in] | csMask | Chip-select's pin mask |
[in] | alwaysSetSPIMode | When true, the SPI bus's mode will always be set prior to communication |
Definition at line 136 of file max72xx.h.
PropWare::MAX72xx::MAX72xx | ( | const Pin::Mask | csMask, |
const bool | alwaysSetSPIMode = true |
||
) |
void PropWare::MAX72xx::always_set_spi_mode | ( | const bool | alwaysSetMode | ) |
void PropWare::MAX72xx::put_int | ( | int32_t | x, |
const BcdCharacter | fillChar = BcdCharacter::BLANK , |
||
unsigned int | width = 0 |
||
) | const |
Write an integer to the device.
[in] | x | Value to be written. If the value is larger than 99,999,999 then it will be truncated and only it's lowest 8 digits will be displayed. Numbers smaller than -9,999,999 will be truncated (the sign will be truncated before the digits). |
[in] | fillChar | When the number of digits in the value is smaller than the width, this character will be used to fit empty digits |
[in] | width | Minimum number of digits used to display the value. For negative numbers, the sign will count as one digit in the width. |
void PropWare::MAX72xx::set_decode_mode | ( | const uint8_t | bcdDecodeBits | ) | const |
Determines which digits will be decoded and which ones will be converted to the build-in font prior to output.
[in] | bcdDecodeBits | Each bit represents one of the digits. A digit with its decode bit set high will be decoded by the built-in font, and a digit with its decode bit cleared low will have its register output directly to the LED segments. |
Definition at line 226 of file max72xx.h.
void PropWare::MAX72xx::set_intensity | ( | const uint8_t | intensity | ) | const |
void PropWare::MAX72xx::set_scan_limit | ( | const uint8_t | scanLimit | ) | const |
Enables or disables specific digits on the device.
[in] | scanLimit | 0 will enable only the least significant digit and 7 will enable all digits. Value must be between 0 and 7. |
Definition at line 213 of file max72xx.h.
void PropWare::MAX72xx::set_test_mode | ( | const bool | enableTestMode | ) | const |
Enable or disable the test mode of the device. When enable, all LED segments will be lit. Test mode will override the shutdown register.
[in] | enableTestMode | True to enable, false to disable. |
Definition at line 236 of file max72xx.h.
void PropWare::MAX72xx::start | ( | const uint8_t | intensity = DEFAULT_INTENSITY , |
const uint8_t | scanLimit = DEFAULT_SCAN_LIMIT , |
||
const uint8_t | bcdDecodeBits = DEFAULT_BCD_DECODE_BITS |
||
) | const |
Initialize the device after power-on.
[in] | intensity | Brightness value between 0 and 15, with 15 being maximum brightness |
[in] | scanLimit | 0 will enable only the least significant digit and 7 will enable all digits. Value must be between 0 and 7. |
[in] | bcdDecodeBits | Each bit represents one of the digits. A digit with its decode bit set high will be decoded by the built-in font, and a digit with its decode bit cleared low will have its register output directly to the LED segments. |
Definition at line 180 of file max72xx.h.
|
static |
Get the Register address of the requested 0-indexed digit on the device.
[in] | zeroIndexedDigit | Low values are to the right of the device and high values to the left |
Definition at line 124 of file max72xx.h.
void PropWare::MAX72xx::write | ( | const Register | address, |
const uint8_t | value, | ||
const bool | decimal = false |
||
) | const |
Perform a manual write to the device.
[in] | address | Address of the register that should be modified |
[in] | value | Value that should be written to the register |
[in] | decimal | When writing to a digit register, the decimal LED will be enabled if and only if this parameter is set to true . |
Definition at line 301 of file max72xx.h.
|
static |