Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shiftIn return value misleading #116

Closed
oclyke opened this issue Jul 16, 2020 · 2 comments
Closed

shiftIn return value misleading #116

oclyke opened this issue Jul 16, 2020 · 2 comments
Labels

Comments

@oclyke
Copy link
Contributor

oclyke commented Jul 16, 2020

According to the shiftIn documentation the return parameter should be byte. For symmetry with the shiftOut function it would make sense to return uint8_t.

In this API the return value is currently specified as pin_size_t which can be either uint8_t or uint32_t

#ifdef EXTENDED_PIN_MODE
// Platforms who wnat to declare more than 256 pins need to define EXTENDED_PIN_MODE globally
typedef uint32_t pin_size_t;
#else
typedef uint8_t pin_size_t;
#endif

Suggest changing the declaration from:

pin_size_t shiftIn(pin_size_t dataPin, pin_size_t clockPin, BitOrder bitOrder);

to:

uint8_t shiftIn(pin_size_t dataPin, pin_size_t clockPin, BitOrder bitOrder);

Any reason not to do this?

@facchinm
Copy link
Member

@oclyke you are TOTALLY right. Can you open a PR for proper attribution? Thanks!

@oclyke
Copy link
Contributor Author

oclyke commented Jul 22, 2020

You bet, thanks @facchinm! (btw all the new ArduinoCore- repos are a nice system... keep up the good work!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants