Skip to content

Commit

Permalink
Fix #15, loop unroll support
Browse files Browse the repository at this point in the history
  • Loading branch information
RobTillaart committed Sep 3, 2024
1 parent ff767ec commit a79da44
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
16 changes: 8 additions & 8 deletions FastShiftOut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,42 +173,42 @@ size_t FastShiftOut::writeLSBFIRST(uint8_t data)
uint8_t outmask1 = *_dataOutRegister | _dataOutBit;
uint8_t outmask2 = *_dataOutRegister & ~_dataOutBit;

if ((value & 0x80) == 0) *_dataOutRegister = outmask2;
if ((value & 0x01) == 0) *_dataOutRegister = outmask2;
else *_dataOutRegister = outmask1;
*_clockRegister = cbmask1;
*_clockRegister = cbmask2;

if ((value & 0x40) == 0) *_dataOutRegister = outmask2;
if ((value & 0x02) == 0) *_dataOutRegister = outmask2;
else *_dataOutRegister = outmask1;
*_clockRegister = cbmask1;
*_clockRegister = cbmask2;

if ((value & 0x20) == 0) *_dataOutRegister = outmask2;
if ((value & 0x04) == 0) *_dataOutRegister = outmask2;
else *_dataOutRegister = outmask1;
*_clockRegister = cbmask1;
*_clockRegister = cbmask2;

if ((value & 0x10) == 0) *_dataOutRegister = outmask2;
if ((value & 0x08) == 0) *_dataOutRegister = outmask2;
else *_dataOutRegister = outmask1;
*_clockRegister = cbmask1;
*_clockRegister = cbmask2;

if ((value & 0x08) == 0) *_dataOutRegister = outmask2;
if ((value & 0x10) == 0) *_dataOutRegister = outmask2;
else *_dataOutRegister = outmask1;
*_clockRegister = cbmask1;
*_clockRegister = cbmask2;

if ((value & 0x04) == 0) *_dataOutRegister = outmask2;
if ((value & 0x20) == 0) *_dataOutRegister = outmask2;
else *_dataOutRegister = outmask1;
*_clockRegister = cbmask1;
*_clockRegister = cbmask2;

if ((value & 0x02) == 0) *_dataOutRegister = outmask2;
if ((value & 0x40) == 0) *_dataOutRegister = outmask2;
else *_dataOutRegister = outmask1;
*_clockRegister = cbmask1;
*_clockRegister = cbmask2;

if ((value & 0x01) == 0) *_dataOutRegister = outmask2;
if ((value & 0x80) == 0) *_dataOutRegister = outmask2;
else *_dataOutRegister = outmask1;
*_clockRegister = cbmask1;
*_clockRegister = cbmask2;
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ pull up resistors, especially if wires are exceeding 10 cm (4").
- investigate ESP32 optimization readLSBFIRST readMSBFIRST
- performance ESP32
- example schema
- add invert flag?
- if ((value & m) == 0) ==> if ((value & m) == invertFlag...
- derived class?

#### Wont

Expand Down

0 comments on commit a79da44

Please sign in to comment.