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

Inconsistent behaviour in mcp23s08 (and others) #8

Open
PBudmark opened this issue Jul 14, 2017 · 0 comments
Open

Inconsistent behaviour in mcp23s08 (and others) #8

PBudmark opened this issue Jul 14, 2017 · 0 comments

Comments

@PBudmark
Copy link

The function mcp23s08::gpioPinMode uses the Arduino.h defines INPUT and OUTPUT for explicit setting of 'all input' and 'all output', but this usage restricts the freedom to set any combination of input/output, as INPUT has the value 0 and OUTPUT has the value 1.

If I try to set the combination 0b00000001 (GP0 input and GP1-7 as output), it will be interpreted as OUTPUT and all GP0-7 will be outputs.

Two new defines/constants would solve this problem, ALL_INPUT with value 0xFF and ALL_OUTPUT with value 0x00.

The same problem shows in functions mcp23s08::gpioPort and mcp23s08::portPullup, but here the defines HIGH with value 1 and LOW with value 0 are the problem.

Two new defines/constants would solve this problem, ALL_HIGH with value 0xFF and ALL_LOW with value 0x00.

The same problem shows also in the solutions with 16 GPIO, in those cases the defines/constants need to be 0xFFFF or 0x0000

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

No branches or pull requests

1 participant