Skip to content

Class daisy::ShiftRegister4021

template <size_t num_daisychained, size_t num_parallel>

ClassList > daisy > ShiftRegister4021

Device Driver for CD4021 shift register. More...

  • #include <sr_4021.h>

Classes

Type Name
struct Config

Public Functions

Type Name
const Config & GetConfig () const
void Init (const Config & cfg)
ShiftRegister4021 ()
bool State (int index) const
void Update ()
~ShiftRegister4021 ()

Detailed Description

Author:

shensley

CD4021B-Q1: CMOS 8-STAGE STATIC SHIFT REGISTER

Supply Voltage: 3V to 18V Clock Freq: 3MHz at 5V (less at 3v3) -> 8.5MHz at 15V Pin Descriptions: * Parallel Data[1-8] - 7, 6, 5, 4, 13, 14, 115, 1 * Serial Data - 11 * Clock - 10 * P/!S - 9 * Q[6-8] - 2, 12, 3

Driver has support for daisy chaining and running up to 2 same-sized chains in parallel from a single set of clk/latch pins to reduce pin/code overhead when using multiple devices.

When dealing with multiple parallel/daisy-chained devices the states of all inputs will be filled in the following order (example uses two chained and two parallel): data[chain0,parallel0], data[chain1,parallel0], data[chain0,parallel1], data[chain1,parallel1];

When combining multiple daisy chained and parallel devices the number of devices chained should match for each parallel device chain.

Public Functions Documentation

function GetConfig

inline const  Config & daisy::ShiftRegister4021::GetConfig () const

function Init

inline void daisy::ShiftRegister4021::Init (
    const  Config & cfg
) 

Initializes the Device(s)


function ShiftRegister4021

inline daisy::ShiftRegister4021::ShiftRegister4021 () 

function State

inline bool daisy::ShiftRegister4021::State (
    int index
) const

returns the last read state of the input at the index. true indicates the pin is held HIGH.

See above for the layout of data when using multiple devices in series or parallel.


function Update

inline void daisy::ShiftRegister4021::Update () 

Reads the states of all pins on the connected device(s)


function ~ShiftRegister4021

inline daisy::ShiftRegister4021::~ShiftRegister4021 () 


The documentation for this class was generated from the following file external-docs/libDaisy/src/dev/sr_4021.h