Skip to content
Open
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
1 change: 1 addition & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ShiftRegister74HC595 KEYWORD1
setAll KEYWORD2
setAll_P KEYWORD2
setRegister KEYWORD2
getAll KEYWORD2
set KEYWORD2
setNoUpdate KEYWORD2
Expand Down
1 change: 1 addition & 0 deletions src/ShiftRegister74HC595.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ShiftRegister74HC595
ShiftRegister74HC595(const uint8_t serialDataPin, const uint8_t clockPin, const uint8_t latchPin);

void setAll(const uint8_t * digitalValues);
void setRegister(const uint8_t reg, const uint8_t digitalValues);
#ifdef __AVR__
void setAll_P(const uint8_t * digitalValuesProgmem); // Experimental, PROGMEM data
#endif
Expand Down
11 changes: 11 additions & 0 deletions src/ShiftRegister74HC595.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ void ShiftRegister74HC595<Size>::setAll(const uint8_t * digitalValues)
updateRegisters();
}

// Set all pins of a single shift registers at once.
// digitalVAlues is a uint8_t, reg is a uint8_t from 0 to Size -1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// digitalVAlues is a uint8_t, reg is a uint8_t from 0 to Size -1
// digitalValues is a uint8_t, reg is a uint8_t from 0 to Size -1

Copy link

@jasonwbarnett jasonwbarnett Jan 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Simsso Can you apply this patch before merging to fix the case?

template<uint8_t Size>
void ShiftRegister74HC595<Size>::setRegister(const uint8_t reg, const uint8_t digitalValues)
{
if (reg >=0 && reg < Size) {
memcpy( _digitalValues + reg, &digitalValues, 1); // dest, src, size
updateRegisters();
}
}

// Experimental
// The same as setAll, but the data is located in PROGMEM
// For example with:
Expand Down