The PCAL9555, PCAL9554 series is a low-voltage 16-bit/8-bit General Purpose Input/Output (GPIO) expander with interrupt. This conponent library is compatible to basic operation os GPIO expanders: PCAL9555, PCA9555, PCA9535, PCA9539, PCAL9554, PCA9554 and PCA9538. On addition to this, this library is including mbed-SDK-style APIs. APIs that similar to DigitaiInOut, DigitalOut, DigitalIn, BusInOUt, BusOut and BusIn are available.

Dependents:   PCAL9555_Hello OM13082-JoyStick OM13082_LED OM13082-test ... more

What is this?

This conponent library is compatible to basic operation os GPIO expanders: PCAL9555, PCA9555, PCA9535, PCA9539, PCAL9554, PCA9554 and PCA9538 .

On addition to this, this library is including mbed-SDK-style APIs. APIs that similar to DigitaiInOut, DigitalOut, DigitalIn, BusInOut, BusOut and BusIn are available.

How to use?

Wiring

/media/uploads/nxp_ip/gpio16.png
Wiring between mbed and 16-bit GPIO expander

/media/uploads/nxp_ip/gpio08.png
Wiring between mbed and 8-bit GPIO expander

Very basic register level I/O bit operation

PCAL9555 and PCAL9554 are class libraries for those compatible GPIO expander chips.
Those class libraries provides interface for bit operation of its I/O port.
For 16-bit GPIO expanders, the input/output access and its direction setting can be done by 16-bit data. For 8-bit GPIO expanders, those can be done by 8-bit data.

  #include    "mbed.h"
  #include    "PCAL9555.h"
 
  PCAL9555    gpio( p28, p27, 0xE8 );     //  using PCA9539
 
  int main() {
      gpio.configure( 0xFFFF );           //  Set all pins: input
      printf( "  0x%04X\r\n", (int)gpio );//  Print pins state
 
      gpio.configure( 0x0000 );           //  Set all pins: output
      int count   = 0;
      while(1) {
          gpio.write( count++ );
      }
  }


High level APIs

To use the GPIO expanders more simple, this library is including mbed-SDK-style APIs.
APIs that similar to DigitaiInOut, DigitalOut, DigitalIn, BusInOut, BusOut and BusIn are available.

GpioDigitalOut, GpioDigitaiInOut, GpioDigitalIn

Next code shows sample of DigitalOut equivalent API GpioDigitalOut usage.
A pin on the PCAL9555 is defined as pin and its state is changed by assignment.
(For single pin operation, GpioDigitaiInOut and GpioDigitalIn are available also.)

  #include "mbed.h"
  #include "PCAL9555.h"
  
  PCAL9555        gpio_exp( p28, p27, 0xE8 );    //  SDA, SCL, Slave_address(option)
  GpioDigitalOut  pin( gpio_exp, X0_0 );
   
  int main() {
      while( 1 ) {
          pin = 1;
          wait( 0.2 );
          pin = 0;
          wait( 0.2 );
      }
  }


GpioBusOut, GpioBusInOut, GpioBusIn

BusOut equivalent API GpioBusOut is available too.
In next code, pins are grouped as mypins to manage the output as bus output.
(Same as GpioDigitalInOut and GpioDigitalIn APIs, GpioBusInOut and GpioBusIn are available also.)

  #include "mbed.h"
  #include "PCAL9555.h"
  
  PCAL9555    gpio_exp( p28, p27, 0xE8 );    //  SDA, SCL, Slave_address(option)
  GpioBusOut  mypins( gpio_exp, X0_0, X0_1, X0_2, X0_3 );
   
  int main() {
      while( 1 ) {
          for( int i = 0; i < 16; i++ ) {
              mypins  = i;
              wait( 0.25 );
          }
      }
  }


The high level APIs can be used in combination

Those high level APIs can be used in combination.
Each pins can be managed by instances.

  #include    "mbed.h"
  #include    "PCAL9555.h"
 
  PCAL9555        gpio( p28, p27, 0xE8 );     //  using PCA9539
 
  //  The GPIO pins are grouped in some groups and operated as bus I/O
  GpioBusIn       bus_in( gpio, X0_0, X0_1, X0_2, X0_3 );
  GpioBusOut      bus_out( gpio, X0_4, X0_5, X0_6 );
  GpioBusInOut    bus_io( gpio, X1_7, X1_6, X1_5, X1_4, X1_3, X1_2, X1_1, X1_0 );
  GpioDigitalOut  myled( gpio, X0_7 );
 
  int main() {
      bus_io.input();
      printf( "I/O = 0x%02X\r\n", (int)bus_io );
      printf( "In  = 0x%01X\r\n", (int)bus_in );
 
      bus_io.output();
 
      int count   = 0;
      while(1) {
          bus_out = count;
          bus_io  = count;
          myled   = count & 0x1;
          count++;
          wait( 0.1 );
      }
  }
Committer:
nxp_ip
Date:
Thu Mar 19 02:21:57 2015 +0000
Revision:
1:fd7cfa821b6a
Parent:
0:6c9a51a50eea
API document update

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nxp_ip 0:6c9a51a50eea 1 /** PCA(L)9554 8-bit I2C-bus GPIO expander
nxp_ip 0:6c9a51a50eea 2 *
nxp_ip 0:6c9a51a50eea 3 * An operation sample of PCA(L)9554 and PCA9538.
nxp_ip 0:6c9a51a50eea 4 * mbed accesses the PCAL9554 registers through I2C.
nxp_ip 0:6c9a51a50eea 5 *
nxp_ip 0:6c9a51a50eea 6 * @class PCAL9554
nxp_ip 0:6c9a51a50eea 7 * @author Akifumi (Tedd) OKANO, NXP Semiconductors
nxp_ip 1:fd7cfa821b6a 8 * @version 0.6
nxp_ip 1:fd7cfa821b6a 9 * @date 19-Mar-2015
nxp_ip 0:6c9a51a50eea 10 *
nxp_ip 0:6c9a51a50eea 11 * Released under the Apache 2 license
nxp_ip 0:6c9a51a50eea 12 *
nxp_ip 0:6c9a51a50eea 13 * About PCAL9554:
nxp_ip 0:6c9a51a50eea 14 * http://www.jp.nxp.com/products/interface_and_connectivity/i2c/i2c_general_purpose_i_o/series/PCAL9554B_PCAL9554C.html
nxp_ip 0:6c9a51a50eea 15 */
nxp_ip 0:6c9a51a50eea 16
nxp_ip 0:6c9a51a50eea 17 #ifndef MBED_PCAL9554
nxp_ip 0:6c9a51a50eea 18 #define MBED_PCAL9554
nxp_ip 0:6c9a51a50eea 19
nxp_ip 0:6c9a51a50eea 20 #include "mbed.h"
nxp_ip 0:6c9a51a50eea 21 #include "PCAL955x.h"
nxp_ip 0:6c9a51a50eea 22 #include "CompGpioExpAPI.h"
nxp_ip 0:6c9a51a50eea 23
nxp_ip 0:6c9a51a50eea 24 /** PCAL9554 class
nxp_ip 0:6c9a51a50eea 25 *
nxp_ip 0:6c9a51a50eea 26 * This is a driver code for the Low-voltage 8-bit I2C-bus GPIO with Agile I/O.
nxp_ip 0:6c9a51a50eea 27 * This class provides interface for PCAL9554 operation.
nxp_ip 0:6c9a51a50eea 28 * Detail information is available on next URL.
nxp_ip 0:6c9a51a50eea 29 * http://www.jp.nxp.com/products/interface_and_connectivity/i2c/i2c_general_purpose_i_o/series/PCAL9554B_PCAL9554C.html
nxp_ip 0:6c9a51a50eea 30 *
nxp_ip 0:6c9a51a50eea 31 *
nxp_ip 0:6c9a51a50eea 32 * PCAL9554 library's basic IO operation is compatible to PCA9554, PCA9538.
nxp_ip 0:6c9a51a50eea 33 * This library can be used for those GPIO expander chips also.
nxp_ip 1:fd7cfa821b6a 34 * Next sample code shows operation based on low-level-API (operated by just device instane)
nxp_ip 0:6c9a51a50eea 35 *
nxp_ip 0:6c9a51a50eea 36 * Example:
nxp_ip 0:6c9a51a50eea 37 * @code
nxp_ip 1:fd7cfa821b6a 38 * // GPIO-expander operation sample using a device instance
nxp_ip 1:fd7cfa821b6a 39 *
nxp_ip 0:6c9a51a50eea 40 * #include "mbed.h"
nxp_ip 0:6c9a51a50eea 41 * #include "PCAL9555.h"
nxp_ip 0:6c9a51a50eea 42 *
nxp_ip 0:6c9a51a50eea 43 * PCAL9555 gpio( p28, p27, 0xE8 ); // using PCA9539
nxp_ip 0:6c9a51a50eea 44 *
nxp_ip 0:6c9a51a50eea 45 * int main() {
nxp_ip 0:6c9a51a50eea 46 * gpio.configure( 0xFFFF ); // Set all pins: input
nxp_ip 0:6c9a51a50eea 47 * printf( " 0x%04X\r\n", (int)gpio );// Print pins state
nxp_ip 0:6c9a51a50eea 48 *
nxp_ip 0:6c9a51a50eea 49 * gpio.configure( 0x0000 ); // Set all pins: output
nxp_ip 0:6c9a51a50eea 50 * int count = 0;
nxp_ip 0:6c9a51a50eea 51 * while(1) {
nxp_ip 0:6c9a51a50eea 52 * gpio.write( count++ );
nxp_ip 0:6c9a51a50eea 53 * }
nxp_ip 0:6c9a51a50eea 54 * }
nxp_ip 0:6c9a51a50eea 55 * @endcode
nxp_ip 0:6c9a51a50eea 56 *
nxp_ip 0:6c9a51a50eea 57 * GpioDigitalInOut, GpioDigitalOut, GpioDigitalIn,
nxp_ip 0:6c9a51a50eea 58 * GpioBusInOut, GpioBusOut and GpioBusIn API class are available also.
nxp_ip 0:6c9a51a50eea 59 * For those API details, please find those class library page.
nxp_ip 0:6c9a51a50eea 60 * The GpioDigital* and GpioBus* APIs can be used as next sample code.
nxp_ip 0:6c9a51a50eea 61 *
nxp_ip 0:6c9a51a50eea 62 * @code
nxp_ip 1:fd7cfa821b6a 63 * // GPIO-expander operation sample using high-level-API
nxp_ip 1:fd7cfa821b6a 64 *
nxp_ip 0:6c9a51a50eea 65 * #include "mbed.h"
nxp_ip 0:6c9a51a50eea 66 * #include "PCAL9554.h"
nxp_ip 0:6c9a51a50eea 67 *
nxp_ip 0:6c9a51a50eea 68 * PCAL9555 gpio( p28, p27, 0xE0 ); // using PCA9538
nxp_ip 0:6c9a51a50eea 69 *
nxp_ip 0:6c9a51a50eea 70 * // The GPIO pins are grouped in some groups and operated as bus I/O
nxp_ip 0:6c9a51a50eea 71 * GpioBusIn bus_in( gpio, X0, X1, X2, X3 );
nxp_ip 0:6c9a51a50eea 72 * GpioBusOut bus_out( gpio, X4, X5, X6 );
nxp_ip 0:6c9a51a50eea 73 * GpioDigitalOut myled( gpio, X7 );
nxp_ip 0:6c9a51a50eea 74 *
nxp_ip 0:6c9a51a50eea 75 * int main() {
nxp_ip 0:6c9a51a50eea 76 * int count = 0;
nxp_ip 0:6c9a51a50eea 77 * while(1) {
nxp_ip 0:6c9a51a50eea 78 * printf( "In = 0x%01X\r\n", (int)bus_in );
nxp_ip 0:6c9a51a50eea 79 * bus_out = count;
nxp_ip 0:6c9a51a50eea 80 * myled = count & 0x1;
nxp_ip 0:6c9a51a50eea 81 * count++;
nxp_ip 0:6c9a51a50eea 82 * wait( 0.1 );
nxp_ip 0:6c9a51a50eea 83 * }
nxp_ip 0:6c9a51a50eea 84 * }
nxp_ip 0:6c9a51a50eea 85 * @endcode
nxp_ip 0:6c9a51a50eea 86 */
nxp_ip 0:6c9a51a50eea 87 class PCAL9554 : public PCAL955x
nxp_ip 0:6c9a51a50eea 88 {
nxp_ip 1:fd7cfa821b6a 89
nxp_ip 0:6c9a51a50eea 90 public:
nxp_ip 0:6c9a51a50eea 91 /** Name of the PCAL9554 registers */
nxp_ip 0:6c9a51a50eea 92 enum command_reg {
nxp_ip 1:fd7cfa821b6a 93 InputPort = 0x00, /**< InputPort register */
nxp_ip 1:fd7cfa821b6a 94 OutoutPort, /**< OutoutPort register */
nxp_ip 1:fd7cfa821b6a 95 PolarityInversionPort, /**< PolarityInversionPort register */
nxp_ip 1:fd7cfa821b6a 96 ConfigurationPort, /**< ConfigurationPort register */
nxp_ip 1:fd7cfa821b6a 97 OutputDriveStrength0 = 0x40, /**< OutputDriveStrength0 register */
nxp_ip 1:fd7cfa821b6a 98 OutputDriveStrength1, /**< OutputDriveStrength1 register */
nxp_ip 1:fd7cfa821b6a 99 InputLatch, /**< InputLatch register */
nxp_ip 1:fd7cfa821b6a 100 PullUpPullDowmEnable, /**< PullUpPullDowmEnable register */
nxp_ip 1:fd7cfa821b6a 101 PullUpPullDowmSelection, /**< PullUpPullDowmSelection register */
nxp_ip 1:fd7cfa821b6a 102 InterruptMask, /**< InterruptMask register */
nxp_ip 1:fd7cfa821b6a 103 InterruptStatus, /**< InterruptStatus register */
nxp_ip 1:fd7cfa821b6a 104 OutputPortConfiguration = 0x4F, /**< OutputPortConfiguration register */
nxp_ip 0:6c9a51a50eea 105 };
nxp_ip 0:6c9a51a50eea 106
nxp_ip 1:fd7cfa821b6a 107 #if DOXYGEN_ONLY
nxp_ip 1:fd7cfa821b6a 108 /** GPIO-Expander pin names
nxp_ip 1:fd7cfa821b6a 109 * for when the high-level APIs
nxp_ip 1:fd7cfa821b6a 110 * (GpioDigitalOut, GpioDigitalInOut, GpioDigitalIn,
nxp_ip 1:fd7cfa821b6a 111 * GpioBusOut, GpioBusInOut are GpioBusIn) are used
nxp_ip 1:fd7cfa821b6a 112 */
nxp_ip 1:fd7cfa821b6a 113 typedef enum {
nxp_ip 1:fd7cfa821b6a 114 X0_0, /**< P0_0 pin */
nxp_ip 1:fd7cfa821b6a 115 X0_1, /**< P0_1 pin */
nxp_ip 1:fd7cfa821b6a 116 X0_2, /**< P0_2 pin */
nxp_ip 1:fd7cfa821b6a 117 X0_3, /**< P0_3 pin */
nxp_ip 1:fd7cfa821b6a 118 X0_4, /**< P0_4 pin */
nxp_ip 1:fd7cfa821b6a 119 X0_5, /**< P0_5 pin */
nxp_ip 1:fd7cfa821b6a 120 X0_6, /**< P0_6 pin */
nxp_ip 1:fd7cfa821b6a 121 X0_7, /**< P0_7 pin */
nxp_ip 1:fd7cfa821b6a 122 X0 = X0_0, /**< P0_0 pin */
nxp_ip 1:fd7cfa821b6a 123 X1 = X0_1, /**< P0_1 pin */
nxp_ip 1:fd7cfa821b6a 124 X2 = X0_2, /**< P0_2 pin */
nxp_ip 1:fd7cfa821b6a 125 X3 = X0_3, /**< P0_3 pin */
nxp_ip 1:fd7cfa821b6a 126 X4 = X0_4, /**< P0_4 pin */
nxp_ip 1:fd7cfa821b6a 127 X5 = X0_5, /**< P0_5 pin */
nxp_ip 1:fd7cfa821b6a 128 X6 = X0_6, /**< P0_6 pin */
nxp_ip 1:fd7cfa821b6a 129 X7 = X0_7, /**< P0_7 pin */
nxp_ip 1:fd7cfa821b6a 130
nxp_ip 1:fd7cfa821b6a 131 X_NC = ~0x0L /**< for when the pin is left no-connection */
nxp_ip 1:fd7cfa821b6a 132 } GpioPinName;
nxp_ip 1:fd7cfa821b6a 133 #endif
nxp_ip 1:fd7cfa821b6a 134
nxp_ip 0:6c9a51a50eea 135 /** Create a PCAL9554 instance connected to specified I2C pins with specified address
nxp_ip 0:6c9a51a50eea 136 *
nxp_ip 0:6c9a51a50eea 137 * @param i2c_sda I2C-bus SDA pin
nxp_ip 0:6c9a51a50eea 138 * @param i2c_sda I2C-bus SCL pin
nxp_ip 0:6c9a51a50eea 139 * @param i2c_address I2C-bus address (default: 0x40)
nxp_ip 0:6c9a51a50eea 140 */
nxp_ip 0:6c9a51a50eea 141 PCAL9554( PinName i2c_sda, PinName i2c_scl, char i2c_address = PCAL955x::DEFAULT_I2C_ADDR );
nxp_ip 0:6c9a51a50eea 142
nxp_ip 0:6c9a51a50eea 143 /** Create a PCAL9554 instance connected to specified I2C pins with specified address
nxp_ip 0:6c9a51a50eea 144 *
nxp_ip 0:6c9a51a50eea 145 * @param i2c_obj I2C object (instance)
nxp_ip 0:6c9a51a50eea 146 * @param i2c_address I2C-bus address (default: 0x40)
nxp_ip 0:6c9a51a50eea 147 */
nxp_ip 0:6c9a51a50eea 148 PCAL9554( I2C &i2c_obj, char i2c_address = PCAL955x::DEFAULT_I2C_ADDR );
nxp_ip 0:6c9a51a50eea 149
nxp_ip 0:6c9a51a50eea 150 /** Destractor
nxp_ip 0:6c9a51a50eea 151 */
nxp_ip 0:6c9a51a50eea 152 virtual ~PCAL9554();
nxp_ip 0:6c9a51a50eea 153
nxp_ip 0:6c9a51a50eea 154 /** Returns the number of I/O pins
nxp_ip 0:6c9a51a50eea 155 *
nxp_ip 0:6c9a51a50eea 156 * @returns
nxp_ip 0:6c9a51a50eea 157 * The number of I/O pins
nxp_ip 0:6c9a51a50eea 158 */
nxp_ip 0:6c9a51a50eea 159 virtual int number_of_pins( void );
nxp_ip 0:6c9a51a50eea 160
nxp_ip 0:6c9a51a50eea 161 #if DOXYGEN_ONLY
nxp_ip 0:6c9a51a50eea 162
nxp_ip 0:6c9a51a50eea 163 /** Set output port bits
nxp_ip 0:6c9a51a50eea 164 *
nxp_ip 0:6c9a51a50eea 165 * @param bit_pattern 16-bit output pattern for port1 and port0.
nxp_ip 0:6c9a51a50eea 166 *
nxp_ip 0:6c9a51a50eea 167 * @note
nxp_ip 0:6c9a51a50eea 168 * The data for pins, given as integer.
nxp_ip 0:6c9a51a50eea 169 * The 16-bit MSB goes to P1_7 pin and LSB goes to P0_0 pin.
nxp_ip 0:6c9a51a50eea 170 * Data will not come out from the pin if it is configured as input.
nxp_ip 0:6c9a51a50eea 171 *
nxp_ip 0:6c9a51a50eea 172 * @see configure()
nxp_ip 0:6c9a51a50eea 173 */
nxp_ip 0:6c9a51a50eea 174 void write( int bit_pattern );
nxp_ip 0:6c9a51a50eea 175
nxp_ip 0:6c9a51a50eea 176 /** Read pin states
nxp_ip 0:6c9a51a50eea 177 *
nxp_ip 0:6c9a51a50eea 178 * @return
nxp_ip 0:6c9a51a50eea 179 * 16-bit pattern from port1 and port0.
nxp_ip 0:6c9a51a50eea 180 *
nxp_ip 0:6c9a51a50eea 181 * @note
nxp_ip 0:6c9a51a50eea 182 * The data from pins, given as integer.
nxp_ip 0:6c9a51a50eea 183 * The 16-bit port data comes from IO pins, P1_7 as MSB, P0_0 as LSB.
nxp_ip 0:6c9a51a50eea 184 * Data cannot be read if the port is configured as output.
nxp_ip 0:6c9a51a50eea 185 *
nxp_ip 0:6c9a51a50eea 186 * @see configure()
nxp_ip 0:6c9a51a50eea 187 */
nxp_ip 0:6c9a51a50eea 188 int read( void );
nxp_ip 0:6c9a51a50eea 189
nxp_ip 0:6c9a51a50eea 190 /** Polarity setting
nxp_ip 0:6c9a51a50eea 191 *
nxp_ip 0:6c9a51a50eea 192 * @param bit_pattern 16-bit polarity setting pattern for port1 and port0.
nxp_ip 0:6c9a51a50eea 193 * If the bit is set to '1', the state will be inverted.
nxp_ip 0:6c9a51a50eea 194 * (Default state is all '0')
nxp_ip 0:6c9a51a50eea 195 *
nxp_ip 0:6c9a51a50eea 196 * @see configure()
nxp_ip 0:6c9a51a50eea 197 */
nxp_ip 0:6c9a51a50eea 198 void polarity( int bit_pattern );
nxp_ip 0:6c9a51a50eea 199
nxp_ip 0:6c9a51a50eea 200 /** Set IO congiguration
nxp_ip 0:6c9a51a50eea 201 *
nxp_ip 0:6c9a51a50eea 202 * @param bit_pattern 16-bit IO direction setting pattern for port1 and port0.
nxp_ip 0:6c9a51a50eea 203 *
nxp_ip 0:6c9a51a50eea 204 * @note
nxp_ip 0:6c9a51a50eea 205 * The data for pins, given as integer.
nxp_ip 0:6c9a51a50eea 206 * The 16-bit MSB goes to P1_7 pin and LSB goes to P0_0 pin.
nxp_ip 0:6c9a51a50eea 207 * Data will not come out from the pin if it is configured as input.
nxp_ip 0:6c9a51a50eea 208 *
nxp_ip 0:6c9a51a50eea 209 * @see write()
nxp_ip 0:6c9a51a50eea 210 * @see read()
nxp_ip 0:6c9a51a50eea 211 */
nxp_ip 0:6c9a51a50eea 212 void configure( int bit_pattern );
nxp_ip 0:6c9a51a50eea 213
nxp_ip 0:6c9a51a50eea 214 /** Set interrupt mask
nxp_ip 0:6c9a51a50eea 215 *
nxp_ip 0:6c9a51a50eea 216 * @param bit_pattern 16-bit interrupt mask
nxp_ip 0:6c9a51a50eea 217 *
nxp_ip 0:6c9a51a50eea 218 * @see interrupt_status()
nxp_ip 0:6c9a51a50eea 219 */
nxp_ip 0:6c9a51a50eea 220 void interrupt_mask( int bit_pattern );
nxp_ip 0:6c9a51a50eea 221
nxp_ip 0:6c9a51a50eea 222 /** Read interrupt status
nxp_ip 0:6c9a51a50eea 223 *
nxp_ip 0:6c9a51a50eea 224 * @return
nxp_ip 0:6c9a51a50eea 225 * 16-bit data from interrupt status registers
nxp_ip 0:6c9a51a50eea 226 *
nxp_ip 0:6c9a51a50eea 227 * @see interrupt_status()
nxp_ip 0:6c9a51a50eea 228 */
nxp_ip 0:6c9a51a50eea 229 int interrupt_status( void );
nxp_ip 0:6c9a51a50eea 230
nxp_ip 0:6c9a51a50eea 231 /** A shorthand for read()
nxp_ip 0:6c9a51a50eea 232 */
nxp_ip 0:6c9a51a50eea 233 operator int( void );
nxp_ip 0:6c9a51a50eea 234
nxp_ip 0:6c9a51a50eea 235 #endif
nxp_ip 0:6c9a51a50eea 236
nxp_ip 0:6c9a51a50eea 237 /** Write 16-bit data into registers
nxp_ip 0:6c9a51a50eea 238 *
nxp_ip 0:6c9a51a50eea 239 * @param reg_index Direst access to registers.
nxp_ip 0:6c9a51a50eea 240 * The registers can be referenced by regiser index
nxp_ip 0:6c9a51a50eea 241 * @param data 16-bit data. Data will be written into two 8-bit registers
nxp_ip 0:6c9a51a50eea 242 */
nxp_ip 0:6c9a51a50eea 243 virtual void reg_index_write( char register_index, int data );
nxp_ip 0:6c9a51a50eea 244
nxp_ip 0:6c9a51a50eea 245 /** Read 16-bit data from registers
nxp_ip 0:6c9a51a50eea 246 *
nxp_ip 0:6c9a51a50eea 247 * @param reg_index Direst access to registers.
nxp_ip 0:6c9a51a50eea 248 * The registers can be referenced by regiser index
nxp_ip 0:6c9a51a50eea 249 *
nxp_ip 0:6c9a51a50eea 250 * @return
nxp_ip 0:6c9a51a50eea 251 * 16-bit data from two registers.
nxp_ip 0:6c9a51a50eea 252 * The register which has lower address will be upper 8-bit data.
nxp_ip 0:6c9a51a50eea 253 */
nxp_ip 0:6c9a51a50eea 254 virtual int reg_index_read( char register_index );
nxp_ip 0:6c9a51a50eea 255
nxp_ip 0:6c9a51a50eea 256 /** A shorthand for write()
nxp_ip 0:6c9a51a50eea 257 */
nxp_ip 0:6c9a51a50eea 258 PCAL9554& operator= ( int bit_pattern );
nxp_ip 0:6c9a51a50eea 259 PCAL9554& operator= ( PCAL9554& rhs );
nxp_ip 0:6c9a51a50eea 260
nxp_ip 0:6c9a51a50eea 261 private:
nxp_ip 0:6c9a51a50eea 262
nxp_ip 0:6c9a51a50eea 263 static const char regmap[];
nxp_ip 0:6c9a51a50eea 264 const int n_of_pins;
nxp_ip 0:6c9a51a50eea 265 }
nxp_ip 0:6c9a51a50eea 266 ;
nxp_ip 0:6c9a51a50eea 267
nxp_ip 0:6c9a51a50eea 268 #endif // MBED_PCAL9554