FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
devices::SIPO< CLOCK_, LATCH_, DATA_ > Class Template Reference

This template class supports one SIPO chip, connected to the MCU through 3 pins. More...

#include <fastarduino/devices/sipo.h>

Public Member Functions

 SIPO ()=default
 Create a new SIPO handler, according to pins defined by class template parameters. More...
 
void init ()
 Initialize (direction, value) all used pins. More...
 
template<typename T >
void output (T data)
 Handles output and latching of all bits in data to the SIPO chip. More...
 

Static Public Attributes

static constexpr const board::DigitalPin CLOCK = CLOCK_
 The output pin that will send the clock signal to the chip. More...
 
static constexpr const board::DigitalPin LATCH = LATCH_
 The output pin that will tell the chip to copy its shift register content to its output pins. More...
 
static constexpr const board::DigitalPin DATA = DATA_
 The output pin that will send serial data to the chip. More...
 

Detailed Description

template<board::DigitalPin CLOCK_, board::DigitalPin LATCH_, board::DigitalPin DATA_>
class devices::SIPO< CLOCK_, LATCH_, DATA_ >

This template class supports one SIPO chip, connected to the MCU through 3 pins.

These 3 pins are described below (different chips may have different naming for each pin but you should expect the 3 pins in all SIPO chips):

  • CLOCK pin: this is used to clock data input to DATA pin: one cycle per bit.
  • DATA pin: this is used to pass serial in data to the chip, one bit per CLOCK cycle.
  • LATCH pin: this pin is used to let the chip know that all data bits have been transferred and should now be made available to the actual output pins of the chip.

Some SIPO chips (e.g. the 74HC595) allow daisy-chaining, allowing you to use several chips but only 3 pins on the MCU. Daisy-chained SIPO are transparently supported by this class.

Template Parameters
CLOCK_the output pin that will send the clock signal to the chip
LATCH_the output pin that will tell the chip to copy its shift register content to its output pins
DATA_the output pin that will send serial data to the chip

Definition at line 57 of file sipo.h.

Constructor & Destructor Documentation

◆ SIPO()

template<board::DigitalPin CLOCK_, board::DigitalPin LATCH_, board::DigitalPin DATA_>
devices::SIPO< CLOCK_, LATCH_, DATA_ >::SIPO ( )
default

Create a new SIPO handler, according to pins defined by class template parameters.

This does not initialize the 3 output pins, for this you shall use init().

See also
init()

Member Function Documentation

◆ init()

template<board::DigitalPin CLOCK_, board::DigitalPin LATCH_, board::DigitalPin DATA_>
void devices::SIPO< CLOCK_, LATCH_, DATA_ >::init ( )
inline

Initialize (direction, value) all used pins.

This must be executed before any other API. This is not executed directly from constructor, in order to allow more optimized initialization with other pins, at port level, in the final program.

Definition at line 88 of file sipo.h.

◆ output()

template<board::DigitalPin CLOCK_, board::DigitalPin LATCH_, board::DigitalPin DATA_>
template<typename T >
void devices::SIPO< CLOCK_, LATCH_, DATA_ >::output ( data)
inline

Handles output and latching of all bits in data to the SIPO chip.

Template Parameters
Tthe type of data; this allows pushing more than 8 bits of data, e.g. if you have connected several chips in daisy-chain.
Parameters
datathe data to serialize to SIPO chip (or chips if daisy chained).

Definition at line 102 of file sipo.h.

Member Data Documentation

◆ CLOCK

template<board::DigitalPin CLOCK_, board::DigitalPin LATCH_, board::DigitalPin DATA_>
constexpr const board::DigitalPin devices::SIPO< CLOCK_, LATCH_, DATA_ >::CLOCK = CLOCK_
staticconstexpr

The output pin that will send the clock signal to the chip.

Definition at line 61 of file sipo.h.

◆ LATCH

template<board::DigitalPin CLOCK_, board::DigitalPin LATCH_, board::DigitalPin DATA_>
constexpr const board::DigitalPin devices::SIPO< CLOCK_, LATCH_, DATA_ >::LATCH = LATCH_
staticconstexpr

The output pin that will tell the chip to copy its shift register content to its output pins.

Definition at line 63 of file sipo.h.

◆ DATA

template<board::DigitalPin CLOCK_, board::DigitalPin LATCH_, board::DigitalPin DATA_>
constexpr const board::DigitalPin devices::SIPO< CLOCK_, LATCH_, DATA_ >::DATA = DATA_
staticconstexpr

The output pin that will send serial data to the chip.

Definition at line 65 of file sipo.h.


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