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 7:c282ea90cdb5, committed 2010-11-28
- Comitter:
- jimherd
- Date:
- Sun Nov 28 22:44:56 2010 +0000
- Parent:
- 6:1144e6353b50
- Child:
- 8:460f7a57725d
- 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 22:20:59 2010 +0000 +++ b/MCP23017.h Sun Nov 28 22:44:56 2010 +0000 @@ -97,59 +97,33 @@ void config(unsigned short dir_config, unsigned short pullup_config, unsigned short polarity_config); -/* ****************************************************************************** +/* * pinmode * Set units to sequential, bank0 mode */ - /** - */ - void pinMode(int pin, int 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: