lathoub / Arduino-ShiftInOut

Arduino ShiftIn ShiftOut

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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();
  .. 
}

About

Arduino ShiftIn ShiftOut

License:GNU General Public License v2.0


Languages

Language:C++ 94.7%Language:C 5.3%