Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/arduino-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- uses: arduino/arduino-lint-action@v2
with:
library-manager: update
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/arduino_test_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ jobs:
runTest:
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jsoncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: json-syntax-check
uses: limitusus/json-syntax-check@v2
with:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).


## [0.4.2] - 2026-06-12
- update readme.md
- update GitHub actions
- minor edits

## [0.4.1] - 2025-10-12
- update GitHub actions
- update examples
Expand Down
2 changes: 1 addition & 1 deletion FastShiftIn.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// FILE: FastShiftIn.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.4.1
// VERSION: 0.4.2
// PURPOSE: Fast ShiftIn for 74HC165 register, AVR optimized
// DATE: 2013-09-29
// URL: https://github.com/RobTillaart/FastShiftIn
Expand Down
8 changes: 3 additions & 5 deletions FastShiftIn.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// FILE: FastShiftIn.h
// AUTHOR: Rob Tillaart
// VERSION: 0.4.1
// VERSION: 0.4.2
// PURPOSE: Fast ShiftIn for 74HC165 register, AVR optimized
// DATE: 2013-09-29
// URL: https://github.com/RobTillaart/FastShiftIn
Expand All @@ -11,7 +11,7 @@
#include "Arduino.h"


#define FASTSHIFTIN_LIB_VERSION (F("0.4.1"))
#define FASTSHIFTIN_LIB_VERSION (F("0.4.2"))

// uncomment next line to get SPEED OPTIMIZED CODE
// #define FASTSHIFTIN_AVR_LOOP_UNROLLED 1
Expand All @@ -26,10 +26,8 @@ class FastShiftIn
uint16_t read16(void);
uint32_t read24(void);
uint32_t read32(void);
uint32_t lastRead(void);

// Experimental 0.3.4
void read(uint8_t * array, uint8_t size);
uint32_t lastRead(void);

// returns false if bitOrder out of range.
bool setBitOrder(uint8_t bitOrder);
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2013-2025 Rob Tillaart
Copyright (c) 2013-2026 Rob Tillaart

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ The library provides wrapper functions to read multi-byte variables.
These are read16(), read24(), read32() and read(array, size).
The latter is used to shift in any size object.

Feedback as always is welcome.


### 0.4.0 breaking changes

Expand Down Expand Up @@ -95,7 +97,7 @@ bitOrder = { LSBFIRST, MSBFIRST };

- **FastShiftIn(uint8_t dataIn, uint8_t clockPin, uint8_t bitOrder = LSBFIRST)** Constructor

### Functions
### Read functions

- **uint16_t read(void)** reads a new value, 8 bit.
- **uint16_t read16(void)** reads a new value, 16 bit.
Expand All @@ -104,7 +106,8 @@ bitOrder = { LSBFIRST, MSBFIRST };
- **uint32_t lastRead()** returns last value read.
- **uint16_t readLSBFIRST(void)** optimized LSB read(), 8 bit.
- **uint16_t readMSBFIRST(void)** optimized MSB read(), 8 bit.

- **void read(uint8_t \*array, uint8_t size)** read an array of values.
The order in the array follows as BYTE order MSB / LSB.

### BitOrder

Expand All @@ -113,15 +116,6 @@ Returns false for other values ==> no change.
- **uint8_t getBitOrder(void)** returns LSBFIRST or MSBFIRST as set in the constructor
or latest set from **setBitOrder()**.


### Experimental

- **void read(uint8_t \*array, uint8_t size)** read an array of values.
The order in the array follows as BYTE order MSB / LSB, that is why this function
is made experimental. This might change in the future, and fill the array
in arrival order.


### Byte order

The functions **read16()**, **read24()** and **read32()** of this library assume
Expand Down Expand Up @@ -160,15 +154,17 @@ pull up resistors, especially if wires are exceeding 10 cm (4").
#### Could

- investigate ESP32 optimization readLSBFIRST readMSBFIRST
- see MCP_ADC issue 26 (does it work for all ESP32)
- performance ESP32
- example schema
- add invert flag?
- value = value ^ 0xFF;
- add invertClock()? => more difficult for user.
- penalty performance
- would it be interesting to make a fastShiftIn16() etc?
- squeeze performance but more maintenance.?

#### Wont

- add invertData()? => use can do value = value ^ 0xFF
- investigate separate **BYTE**-order,
- only MSBFirst and LSBFirst
- **void setByteOrder()** + **uint8_t getByteOrder()**
Expand Down
51 changes: 51 additions & 0 deletions examples/fastShiftIn_test/performance_0.4.1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Arduino UNO R3
IDE 1.8.19

fastShiftIn_test.ino
0.4.1

8 bits HIGH


Performance - time in us : read()
FastShiftIn1: 13.96
FastShiftIn2: 26.66
Delta: 12.70


Performance - time in us : read16()
FastShiftIn1: 26.16
FastShiftIn2: 51.56
Delta: 25.40


Performance - time in us : read24()
FastShiftIn1: 39.88
FastShiftIn2: 78.97
Delta: 39.10


Performance - time in us : read32()
FastShiftIn1: 52.20
FastShiftIn2: 103.62
Delta: 51.42


Performance - time in us : readLSBFIRST()
FastShiftIn1: 12.83
FastShiftIn2: 24.77
Delta: 11.94


Performance - time in us : readMSBFIRST()
FastShiftIn1: 12.82
FastShiftIn2: 24.77
Delta: 11.95


Performance - time in us : reference shiftIn()
Standard shiftIn1: 108.98
Standard shiftIn2: 217.04
Delta: 108.06

done...
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/FastShiftIn.git"
},
"version": "0.4.1",
"version": "0.4.2",
"license": "MIT",
"frameworks": "*",
"platforms": "*",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=FastShiftIn
version=0.4.1
version=0.4.2
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for (AVR) optimized shiftIn - e.g. for 74HC165
Expand Down
Loading