GY-63_MS5611/libraries/FastShiftIn
2021-05-28 14:16:25 +02:00
..
.github/workflows add arduino-lint 2021-05-28 13:17:38 +02:00
examples 2021-01-29 2021-01-29 12:31:58 +01:00
test 2021-01-29 2021-01-29 12:31:58 +01:00
.arduino-ci.yml 2021-01-29 2021-01-29 12:31:58 +01:00
FastShiftIn.cpp 2021-01-29 2021-01-29 12:31:58 +01:00
FastShiftIn.h 2021-01-29 2021-01-29 12:31:58 +01:00
keywords.txt 2021-01-29 2021-01-29 12:31:58 +01:00
library.json add license to library,json 2021-05-28 14:16:25 +02:00
library.properties 2021-01-29 2021-01-29 12:31:58 +01:00
LICENSE 2021-01-29 2021-01-29 12:31:58 +01:00
performance.txt update libraries E-I 2020-11-27 11:16:22 +01:00
readme.md 2021-01-29 2021-01-29 12:31:58 +01:00

Arduino CI License: MIT GitHub release

FastShiftIn

Arduino library for (AVR) optimized shiftIn - e.g. for 74HC165

A library for FastShiftOut also exist.

Description

FastShiftIn is a class that has optimized code (AVR only) to shift in data faster than the normal shiftIn() function. It speeds up the shift using low level ports and masks. These are predetermined in the constructor of the FastShiftIn object.

If not an ARDUINO_ARCH_AVR or ARDUINO_ARCH_MEGAAVR the class falls back to the default shiftIn() implementation.

Performance

The performance of read() is substantially faster than the default Arduino shiftIn(), but not as fast as HW SPI. Exact how big the performance gain is can be seen with the example sketch. It does a comparison and shows how the class is to be used.

Interface

The interface exists of the following functions:

  • int read(void) reads a new value
  • int lastRead() returns last value read
  • bool setBitOrder(bitOrder) set LSBFIRST or MSBFIRST. Returns false for other values.
  • uint8_t getBitOrder(void) returns LSBFIRST or MSBFIRST
  • int readLSBFIRST(void) optimized LSB read()
  • int readMSBFIRST(void) optimized MSB read()

Notes

  • The optimizations are AVR only for now, other platforms may follow.
  • The 74HC165 needs 0.1uF caps and the data and clock lines may need
    pull up resistors, especially if wires are exceeding 10 cm (4").

Operation

See examples