Senior Design / Mbed 2 deprecated MAX7314_Expander

Dependencies:   mbed PCA9538_Expander

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MAX7314.hpp Source File

MAX7314.hpp

00001 /*
00002 
00003     MAX7314.hpp
00004 
00005     Library include file for the MAX7314 16-bit I/O Expander with PWM
00006 
00007     Tom Gambone
00008     Chad Joppeck
00009 
00010     Based on code by mBed user: "Ale C.-" / Suky (PCA9538_Expander Library)
00011 
00012     4/13/2011 - Initial porting
00013 
00014 */
00015 
00016 #include "mbed.h"
00017 
00018 enum ExpPinName {
00019     exp_p0=0,
00020     exp_p1,
00021     exp_p2,
00022     exp_p3,
00023     exp_p4,
00024     exp_p5,
00025     exp_p6,
00026     exp_p7,
00027     exp_p8,
00028     exp_p9,
00029     exp_p10,
00030     exp_p11,
00031     exp_p12,
00032     exp_p13,
00033     exp_p14,
00034     exp_p15,
00035 };
00036 
00037 
00038 //*****************************************************************************
00039 
00040 
00041 class MAX7314_OutputPin {
00042 
00043 public:
00044     MAX7314_OutputPin(ExpPinName Pin,PinName PIN_SDA,PinName PIN_SCL,unsigned char Address);
00045     void vWrite(int value);
00046     int read();
00047 #ifdef MBED_OPERATORS
00048     MAX7314_OutputPin& operator= (int value);
00049     operator int();
00050 #endif
00051 protected:
00052     ExpPinName _Pin;
00053     unsigned char _Address;
00054     I2C Bus;
00055 };
00056 
00057 
00058 
00059 //*****************************************************************************
00060 
00061 
00062 
00063 class MAX7314_InputPin {
00064 
00065 public:
00066     MAX7314_InputPin(ExpPinName Pin,PinName PIN_SDA,PinName PIN_SCL,unsigned char Address);
00067     int read();
00068 #ifdef MBED_OPERATORS
00069     operator int();
00070 #endif
00071 protected:
00072     ExpPinName _Pin;
00073     unsigned char _Address;
00074     I2C Bus;
00075 };
00076 
00077 
00078 
00079 //*****************************************************************************
00080 
00081 
00082 
00083 class MAX7314 {
00084 
00085 public:
00086     MAX7314(PinName PIN_SDA,PinName PIN_SCL,unsigned char Address,PinName PIN_INT=NC);
00087     void vInit(unsigned char Dir,void (*fptr)(void));
00088     void vSetConfiguration(unsigned char Dir);
00089     void vSetPolarity(unsigned char Pol);
00090     unsigned char cRead(void);
00091     void vWrite(unsigned char Data);
00092     void vEnableSetInterrupt(void (*fptr)(void));
00093     void vDisableInterrupt(void);
00094     bool bReadPinINT(void);
00095 protected:
00096     I2C Bus;
00097     InterruptIn MAX7314_Event;
00098     DigitalIn _PIN_INT;
00099     unsigned char _Address;
00100 };