-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
A note concerning 'REV D' #40
Comments
Thanks, Furthermore I remove the dedicated REV D class from the Future->Could section, never got a request for that. There is a PR pending so it will be in the description shortly, Thanks again for reporting, appreciated. |
I interpret this as that there is no need to change the library. |
Well, no direct need. For my current application it is simply a |
I will have a look again this evening, it might be simple to add in the library. |
It would mean that e.g. pinMode1 needs a guard bool MCP23017::pinMode1(uint8_t pin, uint8_t mode)
{
if (pin > 15)
{
_error = MCP23017_PIN_ERROR;
return false;
}
if ((mode != INPUT) && (mode != INPUT_PULLUP) && (mode != OUTPUT))
{
_error = MCP23017_VALUE_ERROR;
return false;
}
uint8_t dataDirectionRegister = MCP23x17_DDR_A;
if (pin > 7)
{
dataDirectionRegister = MCP23x17_DDR_B;
pin -= 8;
}
uint8_t val = readReg(dataDirectionRegister);
if (_error != MCP23017_OK)
{
return false;
}
uint8_t mask = 1 << pin;
// only work with valid
if ((mode == INPUT) || (mode == INPUT_PULLUP))
{
// REV D
// if (pin == 7) return false; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
val |= mask;
}
else if (mode == OUTPUT)
{
val &= ~mask;
}
// other values won't change val ....
writeReg(dataDirectionRegister, val);
if (_error != MCP23017_OK)
{
return false;
}
return true;
} Functions to investigate
(so no small change) mmmm, |
No, certainly no small change. And almost impossible to make it intuitive. I suggest you just print a warning that these functions are not guaranteed to work if GPA7 and GPB7 are used for input. |
REV D is explicitly mentioned in the readme.md, it now includes your remarks (this issue) and I will add some comments in the .h file too. I will link this issue to the upcoming PR (0.8.0 version) so it will close when all is merged into master. Thanks for your insights, appreciated. |
As I understand it, the problem with GPA7 and GPB7 as input is not a recent one. All chips since 2005 seem to have the same die.
Microchip confirms this in their document https://www.microchip.com/product-change-notifications/#/18149/SYST-30BCIH037:
"NOTE: Please be advised that this is a change to the document only the product has not been changed."
So there is no revision D as far as the hardware is concerned, the bug was already present all these years. Only now they have adapted the documentation.
So if you plan a change in the workings of the Arduino library you can safely assume there is no revision D.
Regards,
Hans.
The text was updated successfully, but these errors were encountered: