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

Make reset pin optional #4

Closed
thijstriemstra opened this issue Aug 18, 2020 · 7 comments
Closed

Make reset pin optional #4

thijstriemstra opened this issue Aug 18, 2020 · 7 comments

Comments

@thijstriemstra
Copy link
Contributor

I just found out the MCP203017 reset pin was hooked up to a different pin on the ESP32 than one I specified. But it doesn't seem to have made a difference, everything properly worked anyway. So is the reset pin optional?

@wollewald
Copy link
Owner

The reset function is only used by the Init function to ensure that the MCP23017 starts with a defined status. Otherwise, if you reset the ESP32, you might not reset the MCP23017. And then it could still "remember" its status before the ESP32 was reset and cause problems. And of course you need the reset pin if you want to use the reset function.

@thijstriemstra
Copy link
Contributor Author

But powering down the ESP32 and MCP23017 will reset the MCP23017 right? Unlike the ESP32 reset button?

@wollewald
Copy link
Owner

Yes that's right.

@thijstriemstra
Copy link
Contributor Author

thanks!

@thijstriemstra
Copy link
Contributor Author

thijstriemstra commented Aug 18, 2020

oh closed, too soon. For now I modified the library to not change the pinMode for the reset pin (e.g. when i pass in -1) but it would be nice to make the reset pin officially optional. So maybe the default should be -1 which indicates it's optional. I wouldn't change the examples, only add a note there saying it's optional.

I commented this out for now:

void MCP23017::Init(){
	//pinMode(resetPin, OUTPUT); 
	//reset();
	ioConA = B00000000;
        // etc..

@thijstriemstra thijstriemstra changed the title Reset optional? Make reset pin optional Aug 18, 2020
@wollewald
Copy link
Owner

Please try. You can use now:
MCP23017 myMCP(MCP_ADDRESS)
or
MCP23017 myMCP(MCP_ADDRESS, pinNumber)
All instructions in Init should ensure that the status of the MCP23017 is defined, even if not reset.

@thijstriemstra
Copy link
Contributor Author

awesome, thanks!

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

2 participants