This program is for writing to PCA9532 on the LPCXpresso Base Board.

Dependencies:   mbed

PCA9532.h

Committer:
Lerche
Date:
2010-02-06
Revision:
0:8dffae878f54

File content as of revision 0:8dffae878f54:

/* MIDI class for mbed Microcontroller
 * Copyright (c) 2008, cstyles -- Modified by Lerche for PCA9532
 */ 
#include "mbed.h"
#ifndef MBED_PCA9532_H
#define MBED_PCA9532_H
#define INPUT0 0x00
#define INPUT1 0x01
#define PSC0   0x02
#define PWM0   0x03
#define PSC1   0x04
#define PWM1   0x05
#define LS0    0x06
#define LS1    0x07
#define LS2    0x08
#define LS3    0x09

/* Class: PCA9532
 *  Abstraction for the LED dimmer on LPCXpresso Base Board
 */ 
 
namespace mbed {
class PCA9532 {
  public:
     /* Constructor: PCA9532
      *  Create an instance of the PCA9532 connected to specfied I2C pins, with the specified address.
      *
      * Variables:
      *  sda - The I2C data pin (p28)
      *  scl - The I2C clock pin (p27)
      *  addr - The address of this instance (0xC0) 
      */   
    PCA9532 (PinName sda, PinName scl, int addr);
     /* Function: read
      *  Read the IO pin level
      *
      * Variables:
      *  none
      */ 
    int read (void);
     /* Function: write
      *  Write the IO pin levels / Turn on LEDs
      *
      * Variables:
      *  data - An in, though only the bottom 8 bits are used
      *  command - Where to put the data. 
      */ 
    void write (int command, int data);
   
  private :   
    I2C _i2c;
    int _addr;
  };
}
#endif