Basic library of routines to interface to a Microchip MCP23017 16-bit I/O expander using an I2C interface.
Dependents: acd52832_beep_buzzer_ints
Fork of MCP23017 by
Revision 14:2e65b7f39273, committed 2016-09-23
- Comitter:
- jurica238814
- Date:
- Fri Sep 23 12:12:24 2016 +0000
- Parent:
- 13:d57de266cf19
- Commit message:
- IO expander ints done.
Changed in this revision
MCP23017.cpp | Show annotated file Show diff for this revision Revisions of this file |
MCP23017.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r d57de266cf19 -r 2e65b7f39273 MCP23017.cpp --- a/MCP23017.cpp Mon Nov 29 12:46:43 2010 +0000 +++ b/MCP23017.cpp Fri Sep 23 12:12:24 2016 +0000 @@ -19,6 +19,18 @@ #include "MCP23017.h" #include "mbed.h" +bool interrupt = 0; + +void setInt(){ + interrupt = 1; + } +void clearInt(){ + interrupt = 0; + } +bool getInt(){ + return interrupt; + } + union { uint8_t value8[2]; uint16_t value16;
diff -r d57de266cf19 -r 2e65b7f39273 MCP23017.h --- a/MCP23017.h Mon Nov 29 12:46:43 2010 +0000 +++ b/MCP23017.h Fri Sep 23 12:12:24 2016 +0000 @@ -51,6 +51,15 @@ * @endcode * */ + + /* + * Interrupt setters and getters + */ + void setInt(); + void clearInt(); + bool getInt(); + + class MCP23017 { public: /** Constructor for the MCP23017 connected to specified I2C pins at a specific address @@ -106,6 +115,8 @@ void writeRegister(int regAddress, unsigned char val); void writeRegister(int regAddress, unsigned short val); int readRegister(int regAddress); + + /*----------------------------------------------------------------------------- * pinmode