v 0.4
Dependents: MCP23S17Test MCP23S17_Basic_IO_Demo HelloWorld Lab3-SnakeGame ... more
Revision 4:d501c74550a0, committed 2010-08-22
- Comitter:
- romilly
- Date:
- Sun Aug 22 12:12:58 2010 +0000
- Parent:
- 3:089a2a754567
- Child:
- 5:cb3c24f94370
- Commit message:
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 Sun Aug 22 12:05:06 2010 +0000 +++ b/MCP23S17.cpp Sun Aug 22 12:12:58 2010 +0000 @@ -16,7 +16,7 @@ char MCP23S17::_read(char address) { _ncs = 0; - _spi.write(_readOpcode); + _spi.write(_readOpcode); _spi.write(address); char result = _spi.write(0); _ncs = 1; @@ -36,23 +36,23 @@ } void MCP23S17::directionA(char direction) { - _write(IODIRA, direction); + _write(IODIRA, direction); } void MCP23S17::directionB(char direction) { - _write(IODIRB, direction); + _write(IODIRB, direction); } - void intconA(char interruptsEnabledMask) { - _write(INTCONA, interruptsEnabledMask); - } +void MCP23S17::gpIntEnA(char interruptsEnabledMask) { + _write(GPINTENA, interruptsEnabledMask); +} void MCP23S17::outputA(char byte) { - _write(OLATA, byte); + _write(OLATA, byte); } void MCP23S17::outputB(char byte) { - _write(OLATB, byte); + _write(OLATB, byte); } char MCP23S17::inputA() {
--- a/MCP23S17.h Sun Aug 22 12:05:06 2010 +0000 +++ b/MCP23S17.h Sun Aug 22 12:12:58 2010 +0000 @@ -9,15 +9,16 @@ #ifndef SER23K256_H #define SER23K256_H -// all register addresses assume IOVCON.BANK = 0 (POR default) +// all register addresses assume IOCON.BANK = 0 (POR default) -#define IODIRA 0x00 -#define IODIRB 0x01 -#define IOCON 0x0A -#define GPIOA 0x12 -#define GPIOB 0x13 -#define OLATA 0x14 -#define OLATB 0x15 +#define IODIRA 0x00 +#define IODIRB 0x01 +#define GPINTENA 0x02 +#define IOCON 0x0A +#define GPIOA 0x12 +#define GPIOB 0x13 +#define OLATA 0x14 +#define OLATB 0x15 // Control settings @@ -30,7 +31,7 @@ MCP23S17(SPI& spi, PinName ncs, char writeOpcode); void directionA(char direction); void directionB(char direction); - void intconA(char interruptsEnabledMask); + void gpIntEnA(char interruptsEnabledMask); char inputA(); char inputB(); void outputA(char byte);