v 0.4
Dependents: MCP23S17Test MCP23S17_Basic_IO_Demo HelloWorld Lab3-SnakeGame ... more
Revision 9:068b1e8909bb, committed 2010-08-28
- Comitter:
- romilly
- Date:
- Sat Aug 28 09:48:38 2010 +0000
- Parent:
- 8:841b19734955
- Commit message:
- Added pull=up configuration
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 |
diff -r 841b19734955 -r 068b1e8909bb MCP23S17.cpp --- a/MCP23S17.cpp Mon Aug 23 10:57:59 2010 +0000 +++ b/MCP23S17.cpp Sat Aug 28 09:48:38 2010 +0000 @@ -2,7 +2,7 @@ * Copyright (c) 2010 Romilly Cocking * Released under the MIT License: http://mbed.org/license/mit * -* version 0.3 +* version 0.4 */ #include "mbed.h" @@ -47,6 +47,9 @@ _write(port, IODIRA, direction); } +void MCP23S17::configurePullUps(Port port, char offOrOn) { + _write(port, GPPUA, offOrOn); +} void MCP23S17::interruptEnable(Port port, char interruptsEnabledMask) { _write(port, GPINTENA, interruptsEnabledMask);
diff -r 841b19734955 -r 068b1e8909bb MCP23S17.h --- a/MCP23S17.h Mon Aug 23 10:57:59 2010 +0000 +++ b/MCP23S17.h Sat Aug 28 09:48:38 2010 +0000 @@ -2,7 +2,7 @@ * Copyright (c) 2010 Romilly Cocking * Released under the MIT License: http://mbed.org/license/mit * -* version 0.3 +* version 0.4 */ #include "mbed.h" @@ -15,16 +15,13 @@ // all register addresses assume IOCON.BANK = 0 (POR default) #define IODIRA 0x00 -#define IODIRB 0x01 #define GPINTENA 0x04 -#define GPINTENB 0x05 #define DEFVALA 0x06 #define INTCONA 0x08 #define IOCON 0x0A +#define GPPUA 0x0C #define GPIOA 0x12 -#define GPIOB 0x13 #define OLATA 0x14 -#define OLATB 0x15 // Control settings @@ -39,6 +36,7 @@ public: MCP23S17(SPI& spi, PinName ncs, char writeOpcode); void direction(Port port, char direction); + void configurePullUps(Port port, char offOrOn); void interruptEnable(Port port, char interruptsEnabledMask); void interruptPolarity(Polarity polarity); void mirrorInterrupts(bool mirror);