libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
ShiftRegister595 Class Reference

Device Driver for 8-bit shift register.
CD74HC595 - 8-bit serial to parallel output shift. More...

Detailed Description

Device Driver for 8-bit shift register.
CD74HC595 - 8-bit serial to parallel output shift.

Author
shensley
Date
May 2020

#include <sr_595.h>

Public Types

enum  Pins { PIN_LATCH , PIN_CLK , PIN_DATA , NUM_PINS }
 

Public Member Functions

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

Member Enumeration Documentation

◆ Pins

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

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"

Constructor & Destructor Documentation

◆ ShiftRegister595()

ShiftRegister595::ShiftRegister595 ( )
inline

◆ ~ShiftRegister595()

ShiftRegister595::~ShiftRegister595 ( )
inline

Member Function Documentation

◆ Init()

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

Initializes the GPIO, and data for the ShiftRegister

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

◆ Set()

void 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.

◆ Write()

void ShiftRegister595::Write ( )

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


The documentation for this class was generated from the following file: