Skip to content

ShiftRegister595

Module: LIBDAISY / DEVICE / SHIFTREGISTER

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

#include <sr_595.h>

Public Types

Name
enum Pins

Public Functions

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

Detailed Description

class ShiftRegister595;

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

Author: shensley

Date: May 2020

Public Types Documentation

enum Pins

Enumerator Value Description
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"

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

Public Functions Documentation

function ShiftRegister595

inline ShiftRegister595()

function ~ShiftRegister595

inline ~ShiftRegister595()

function Init

void Init(
    dsy_gpio_pin * pin_cfg,
    size_t num_daisy_chained =1
)

Parameters:

  • pin_cfg is 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.

Initializes the GPIO, and data for the ShiftRegister


function Set

void Set(
    uint8_t idx,
    bool state
)

Parameters:

  • idx The index starts with QA on the first device and ends with QH on the last device.
  • state A true state will set the output HIGH, while a false state will set the output LOW.

Sets the state of the specified output.


function Write

void Write()

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

---

Updated on 2024-01-03 at 19:41:01 +0000