libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
SHIFTREGISTER

Digital Shift Registers. More...

Detailed Description

Digital Shift Registers.

Classes

class  daisy::ShiftRegister4021< num_daisychained, num_parallel >
 Device Driver for CD4021 shift register. More...
 
class  daisy::ShiftRegister595
 Device Driver for 8-bit shift register.
CD74HC595 - 8-bit serial to parallel output shift. More...
 

Enumerations

enum  daisy::ShiftRegister595::Pins { daisy::ShiftRegister595::PIN_LATCH , daisy::ShiftRegister595::PIN_CLK , daisy::ShiftRegister595::PIN_DATA , daisy::ShiftRegister595::NUM_PINS }
 

Functions

 daisy::ShiftRegister595::ShiftRegister595 ()
 
 daisy::ShiftRegister595::~ShiftRegister595 ()
 
void daisy::ShiftRegister595::Init (Pin *pin_cfg, size_t num_daisy_chained=1)
 
void daisy::ShiftRegister595::Set (uint8_t idx, bool state)
 
void daisy::ShiftRegister595::Write ()
 

Enumeration Type Documentation

◆ Pins

The following pins correspond to the hardware connections to the 595.

Note
TODO: This should probably be switched to using a pin config structure similar to other drivers
Enumerator
PIN_LATCH 
PIN_CLK 

LATCH corresonds to Pin 12 "RCLK"

PIN_DATA 

CLK corresponds to Pin 11 "SRCLK"

NUM_PINS 

DATA corresponds to Pin 14 "SER"

Function Documentation

◆ Init()

void daisy::ShiftRegister595::Init ( Pin pin_cfg,
size_t  num_daisy_chained = 1 
)

Initializes the GPIO, and data for the ShiftRegister

Parameters
pin_cfgis an array of Pin corresponding the the Pins enum above.
num_daisy_chained(default = 1) is the number of 595 devices daisy chained together.

◆ Set()

void daisy::ShiftRegister595::Set ( uint8_t  idx,
bool  state 
)

Sets the state of the specified output.

Parameters
idxThe index starts with QA on the first device and ends with QH on the last device.
stateA true state will set the output HIGH, while a false state will set the output LOW.

◆ ShiftRegister595()

daisy::ShiftRegister595::ShiftRegister595 ( )
inline

◆ Write()

void daisy::ShiftRegister595::Write ( )

Writes the states of shift register out to the connected devices.

◆ ~ShiftRegister595()

daisy::ShiftRegister595::~ShiftRegister595 ( )
inline