Basic library of routines to interface to a Microchip MCP23017 16-bit I/O expander using an I2C interface.

Dependents:   Assignment_2_herpe Final_V1 ass2 ass2 ... more

Revision:
12:6d9d2b277f26
Parent:
11:8726c7be6d72
Child:
13:d57de266cf19
--- a/MCP23017.h	Mon Nov 29 11:46:57 2010 +0000
+++ b/MCP23017.h	Mon Nov 29 12:41:09 2010 +0000
@@ -1,6 +1,6 @@
 /*  MCP23017 library for Arduino
     Copyright (C) 2009 David Pye    <davidmpye@gmail.com
-    Modified for use on the MBED
+    Modified for use on the MBED ARM platform
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -21,7 +21,6 @@
 
 #include    "mbed.h"
 
-
 //
 // Register defines from data sheet - we set IOCON.BANK to 0
 // as it is easier to manage the registers sequentially.
@@ -98,8 +97,11 @@
      */           
     void config(unsigned short dir_config, unsigned short pullup_config, unsigned short polarity_config);
 
+    void writeRegister(int regAddress, unsigned char  val);
+    void writeRegister(int regAddress, unsigned short val);
+    int  readRegister(int regAddress);
 
-/* 
+/*----------------------------------------------------------------------------- 
  * pinmode
  * Set units to sequential, bank0 mode
  */  
@@ -124,9 +126,6 @@
     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:
     I2C     _i2c;