|
MaxMatrix
Drive chained 8x8 LED dot matrix modules with MAX7219.
|
A byte of raw data: eight dots of a column or a row, or the value of a register of the MAX7219. More...
#include <Byte.h>
Public Member Functions | |
| Byte ()=default | |
| Makes a byte whose bits are not set to anything, as std::byte; Byte{} has none set. | |
| constexpr | Byte (uint8_t value) |
| Makes a byte of the bits of value. | |
| MAXMATRIX_NODISCARD constexpr uint8_t | ToInteger () const |
| Returns the bits as a number. | |
| constexpr Byte | operator~ () const |
| Returns the bits that are not set in this byte. | |
Friends | |
| constexpr bool | operator== (Byte left, Byte right) |
| Returns whether two bytes have the same bits. | |
| constexpr bool | operator!= (Byte left, Byte right) |
| Returns whether two bytes differ in a bit. | |
| constexpr Byte | operator& (Byte left, Byte right) |
| Returns the bits set in both bytes. | |
| constexpr Byte | operator| (Byte left, Byte right) |
| Returns the bits set in either byte. | |
| constexpr Byte | operator<< (Byte value, uint8_t shift) |
| Returns the bits moved shift places up; those beyond bit 7 fall out. | |
| constexpr Byte | operator>> (Byte value, uint8_t shift) |
| Returns the bits moved shift places down; those below bit 0 fall out. | |
A byte of raw data: eight dots of a column or a row, or the value of a register of the MAX7219.
It takes only the bitwise operators, and is a number only through ToInteger(), so that a column cannot be passed where its value is meant, nor the other way round. A sketch makes one from a number in braces:
As std::byte, which it stands in for until every target has C++17, a byte made without braces holds any bits, and one made with empty braces none: Byte column{};. It is one uint8_t and costs no RAM of its own; the examples are 34 to 50 bytes of flash smaller with it than with uint8_t on the Uno (OIL 41).
|
inlineexplicitconstexpr |
Makes a byte of the bits of value.
| [in] | value | The bits, bit 0 the first dot. |
Returns whether two bytes differ in a bit.
| [in] | left | The one byte. |
| [in] | right | The other. |
Returns the bits set in both bytes.
| [in] | left | The one byte. |
| [in] | right | The other. |
Returns the bits moved shift places up; those beyond bit 7 fall out.
| [in] | value | The byte. |
| [in] | shift | The places, less than 8. |
Returns whether two bytes have the same bits.
| [in] | left | The one byte. |
| [in] | right | The other. |
Returns the bits moved shift places down; those below bit 0 fall out.
| [in] | value | The byte. |
| [in] | shift | The places, less than 8. |
Returns the bits set in either byte.
| [in] | left | The one byte. |
| [in] | right | The other. |