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 3:f00ee94327c6, committed 2010-11-28
- Comitter:
- jimherd
- Date:
- Sun Nov 28 21:21:17 2010 +0000
- Parent:
- 2:2a17f52c550a
- Child:
- 4:32fd6ee97dff
- Commit message:
Changed in this revision
MCP23017.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/MCP23017.h Sun Nov 28 21:10:15 2010 +0000 +++ b/MCP23017.h Sun Nov 28 21:21:17 2010 +0000 @@ -100,31 +100,55 @@ * pinmode * Set units to sequential, bank0 mode */ - + /** + */ void pinMode(int pin, int mode); + /** + */ void digitalWrite(int pin, int val); + /** + */ int digitalRead(int pin); // These provide a more advanced mapping of the chip functionality // See the data sheet for more information on what they do //Returns a word with the current pin states (ie contents of the GPIO register) + /** + */ unsigned short digitalWordRead(); // Allows you to write a word to the GPIO register + /** + */ void digitalWordWrite(unsigned short w); // Sets up the polarity mask that the MCP23017 supports // if set to 1, it will flip the actual pin value. + /** + */ void inputPolarityMask(unsigned short mask); //Sets which pins are inputs or outputs (1 = input, 0 = output) NB Opposite to arduino's //definition for these + /** + */ void inputOutputMask(unsigned short mask); // Allows enabling of the internal 100k pullup resisters (1 = enabled, 0 = disabled) + /** + */ void internalPullupMask(unsigned short mask); - + /** + */ int read(void); + /** + */ void write(int data); + /** + */ void writeRegister(int regAddress, unsigned char val); + /** + */ void writeRegister(int regAddress, unsigned short val); + /** + */ int readRegister(int regAddress); protected: