Skip to content

lathoub/Arduino-ShiftInOut

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arduino-ShiftInOut

The Arduino ShiftInOut is a Serial to Parallel Shifting-Out and Parallel to Serial Shifting-In library.

The hardware bindings for the shifting are provided as C++ template arguments. Currently supported:

The DigitalRead and DigitalWrite functions can be overwritten if faster methods are available (also through C++ temmplate arguments). The Out-of-the-box implementation maps to the default implementation of DigitalRead and Write.

Usage

Shift-In

#include <ShiftIn.h>
#include <hardware/IC74HC165.h>

#define LATCHPIN A12
#define DATAPIN A14
#define CLOCKPIN A13
#define CHIPCOUNT 4

CREATE_NATIVE_74HC165(si, LATCHPIN, DATAPIN, CLOCKPIN, CHIPCOUNT);

void setup() {
  ...
}

void loop() {
  ...
  auto result = si.read();
  ...

Shift-Out

#include <ShiftOut.h>
#include <hardware/IC74HC595.h>

#define LATCHPIN A11
#define DATAPIN A15
#define CLOCKPIN A13
#define CHIPCOUNT 4

CREATE_NATIVE_74HC595(so, LATCHPIN, DATAPIN, CLOCKPIN, CHIPCOUNT);

void setup() {
  ...
}

void loop() {
  ..
  so.setAll(true).commit();
  .. 
}