Minor Changes for functionality
Fork of MCP23S17 by
Revision 10:d00c555d15b2, committed 2016-08-12
- Comitter:
- jolyon
- Date:
- Fri Aug 12 11:00:31 2016 +0000
- Parent:
- 9:068b1e8909bb
- Commit message:
- Adding SPI & programmable thresholds
Changed in this revision
| MCP23S17.cpp | Show annotated file Show diff for this revision Revisions of this file |
| MCP23S17.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/MCP23S17.cpp Sat Aug 28 09:48:38 2010 +0000
+++ b/MCP23S17.cpp Fri Aug 12 11:00:31 2016 +0000
@@ -40,7 +40,7 @@
}
void MCP23S17::_init() {
- _write(IOCON, (IOCON_BYTE_MODE | IOCON_HAEN )); // Hardware addressing on, operations toggle between A and B registers
+ _write(SPIIOCON, (IOCON_BYTE_MODE | IOCON_HAEN )); // Hardware addressing on, operations toggle between A and B registers
}
void MCP23S17::direction(Port port, char direction) {
@@ -56,24 +56,24 @@
}
void MCP23S17::mirrorInterrupts(bool mirror) {
- char iocon = _read(IOCON);
+ char iocon = _read(SPIIOCON);
if (mirror) {
iocon = iocon | INTERRUPT_MIRROR_BIT;
} else {
iocon = iocon & ~INTERRUPT_MIRROR_BIT;
}
- _write(IOCON, iocon);
+ _write(SPIIOCON, iocon);
}
void MCP23S17::interruptPolarity(Polarity polarity) {
- char iocon = _read(IOCON);
+ char iocon = _read(SPIIOCON);
if (polarity == ACTIVE_LOW) {
iocon = iocon & ~INTERRUPT_POLARITY_BIT;
} else {
iocon = iocon | INTERRUPT_POLARITY_BIT;
}
- _write(IOCON, iocon);
+ _write(SPIIOCON, iocon);
}
void MCP23S17::defaultValue(Port port, char valuesToCompare) {
--- a/MCP23S17.h Sat Aug 28 09:48:38 2010 +0000 +++ b/MCP23S17.h Fri Aug 12 11:00:31 2016 +0000 @@ -18,7 +18,7 @@ #define GPINTENA 0x04 #define DEFVALA 0x06 #define INTCONA 0x08 -#define IOCON 0x0A +#define SPIIOCON 0x0A #define GPPUA 0x0C #define GPIOA 0x12 #define OLATA 0x14
