74xx595 Shift Register Class.
More...
#include <74hc595.hpp>
|
| typedef std::vector< uint8_t > | TData |
| | Type of Data buffer. More...
|
| |
|
| | HC595 () |
| | Constructor. More...
|
| |
| | HC595 (uint sinPin, uint clkPin=0xFF, uint clrPin=0xFF, uint rckPin=0xFF, uint oePin=0xFF, uint pulseTime=kDefaultPulseTime) |
| | Constructor. More...
|
| |
| void | configure (uint sinPin=0xFF, uint clkPin=0xFF, uint clrPin=0xFF, uint rckPin=0xFF, uint oePin=0xFF, uint pulseTime=kDefaultPulseTime) |
| | Configures the HC595 class object. More...
|
| |
| void | clear () |
| | Clears the output of the HC595. More...
|
| |
| void | outputEnable (bool value=true) |
| | Changes the Output Enable pin of the HC595. More...
|
| |
| void | outputDisable (void) |
| | Disables the output (put its in tristate). More...
|
| |
| void | writeByte (uint8_t value) |
| | Writes a byte to output of the HC595. More...
|
| |
| void | writeWord (uint16_t value) |
| | Writes a word to outputs of two HC595 (in cascade). More...
|
| |
| void | writeDWord (uint32_t value) |
| | Writes a double word to outputs of quad HC595 (in cascade). More...
|
| |
| void | writeData (const uint8_t *buffer, uint size) |
| | Writes data to outputs of "n" HC595 (arbitrary units in cascade). More...
|
| |
| void | setBit (uint bit, bool value=true) |
| | Sets a bit of any HC595 in cascade. More...
|
| |
| void | resetBit (uint bit) |
| | Resets a bit of any HC595 in cascade. More...
|
| |
| void | toggleBit (uint bit) |
| | Toggles a bit of any HC595 in cascade. More...
|
| |
| const TData & | getData (void) const |
| | Gets the data written in HC595 units. More...
|
| |
| const bool | getBit (uint bit) const |
| | Gets a bit of data written in HC595 units. More...
|
| |
| const bool | getOE (void) const |
| | Gets the Output Enable status. More...
|
| |
74xx595 Shift Register Class.
The purpose of this class is to interface a 74xx595 Shift Register. Datasheet available on: https://tinyurl.com/5crbkb52.
◆ TData
| typedef std::vector<uint8_t> TData |
◆ HC595() [1/2]
◆ HC595() [2/2]
| HC595 |
( |
uint |
sinPin, |
|
|
uint |
clkPin = 0xFF, |
|
|
uint |
clrPin = 0xFF, |
|
|
uint |
rckPin = 0xFF, |
|
|
uint |
oePin = 0xFF, |
|
|
uint |
pulseTime = kDefaultPulseTime |
|
) |
| |
Constructor.
Constructs a new HC595 class object, and configures it.
- Parameters
-
| sinPin | GPIO Pin number of Serial Data Input. |
| clkPin | GPIO Pin number of Data Clock (default = 0xFF, no pin). |
| clrPin | GPIO Pin number of ~Clear (default = 0xFF, no pin). |
| rckPin | GPIO Pin number of Latch Clock (default = 0xFF, no pin). |
| oePin | GPIO Pin number of Output Enable (default = 0xFF, no pin). |
| pulseTime | Pulse time, in microseconds (default = kDefaultPulseTime). |
◆ configure()
| void configure |
( |
uint |
sinPin = 0xFF, |
|
|
uint |
clkPin = 0xFF, |
|
|
uint |
clrPin = 0xFF, |
|
|
uint |
rckPin = 0xFF, |
|
|
uint |
oePin = 0xFF, |
|
|
uint |
pulseTime = kDefaultPulseTime |
|
) |
| |
Configures the HC595 class object.
- Parameters
-
| sinPin | GPIO Pin number of Serial Data Input (default = 0xFF, no pin). |
| clkPin | GPIO Pin number of Data Clock (default = 0xFF, no pin). |
| clrPin | GPIO Pin number of ~Clear (default = 0xFF, no pin). |
| rckPin | GPIO Pin number of Latch Clock (default = 0xFF, no pin). |
| oePin | GPIO Pin number of Output Enable (default = 0xFF, no pin). |
| pulseTime | Pulse time, in microseconds (default = kDefaultPulseTime). |
◆ clear()
Clears the output of the HC595.
◆ outputEnable()
| void outputEnable |
( |
bool |
value = true | ) |
|
Changes the Output Enable pin of the HC595.
- Parameters
-
| value | If true, activate OE. Else, disables the output (put its in tristate). |
◆ outputDisable()
| void outputDisable |
( |
void |
| ) |
|
Disables the output (put its in tristate).
◆ writeByte()
| void writeByte |
( |
uint8_t |
value | ) |
|
Writes a byte to output of the HC595.
- Parameters
-
| value | Value to write (bits 0..7). |
◆ writeWord()
| void writeWord |
( |
uint16_t |
value | ) |
|
Writes a word to outputs of two HC595 (in cascade).
- Parameters
-
| value | Value to write (bits 0..15). |
◆ writeDWord()
| void writeDWord |
( |
uint32_t |
value | ) |
|
Writes a double word to outputs of quad HC595 (in cascade).
- Parameters
-
| value | Value to write (bits 0..31). |
◆ writeData()
| void writeData |
( |
const uint8_t * |
buffer, |
|
|
uint |
size |
|
) |
| |
Writes data to outputs of "n" HC595 (arbitrary units in cascade).
- Parameters
-
| buffer | Pointer to values to write. |
| size | Size of buffer. |
◆ setBit()
| void setBit |
( |
uint |
bit, |
|
|
bool |
value = true |
|
) |
| |
Sets a bit of any HC595 in cascade.
- Parameters
-
| bit | Number of bit (0..n). |
| value | Value to set (default = true). |
◆ resetBit()
| void resetBit |
( |
uint |
bit | ) |
|
Resets a bit of any HC595 in cascade.
- Parameters
-
◆ toggleBit()
| void toggleBit |
( |
uint |
bit | ) |
|
Toggles a bit of any HC595 in cascade.
- Parameters
-
◆ getData()
Gets the data written in HC595 units.
- Returns
- Reference to "software stored" data buffer.
◆ getBit()
| const bool getBit |
( |
uint |
bit | ) |
const |
Gets a bit of data written in HC595 units.
- Parameters
-
- Returns
- Value of bit ("software stored").
◆ getOE()
| const bool getOE |
( |
void |
| ) |
const |
Gets the Output Enable status.
- Returns
- Value of Output Enable ("software stored").
◆ kDefaultPulseTime
| constexpr uint kDefaultPulseTime = 1 |
|
staticconstexpr |
Default value to pulse time, in microseconds.
The documentation for this class was generated from the following files: