wimbeaumont Project / MCP4728setaddr

Dependents:   MCP4728setaddrProg mbedSerialInterface_talkback2 MCP4728test mbedSerialInterface_sequencer

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MCP4728setaddr.h Source File

MCP4728setaddr.h

00001 
00002 
00003 
00004 class I2CInterface;
00005 //class DigitalOut;
00006 //class InterruptIn;
00007 
00008 class MPC4728_address_set{
00009     I2CInterface *i2cd;
00010     DigitalOut *LDAC;
00011     DigitalOut *Cntout;
00012     InterruptIn cntin;
00013     int sclcnt;
00014     unsigned char oldaddress;
00015  void count_down( );
00016  int ldac1;
00017  int ldac0;
00018  
00019 public:
00020  /*
00021     sclcntpin  : the pin physically connected to the I2C SCL line that counts the clock pulses ( via interrupt) 
00022     LDACpin pointer to the pin that change polarity after x SCL clock pulses to set the address (see data sheet) 
00023     i2cdevice : pointer to the I2C interface 
00024     Cntoutpin :  this is to debug the count down interrupt.  This toggles everty time the cnt down interrupt is called ( no function for the MPC4728)
00025     ldac_invert :  if this active the LDAC line is set from  1 to 0 
00026  */    
00027  MPC4728_address_set(PinName sclcntpin, DigitalOut *LDACpin, I2CInterface* i2cdevice, DigitalOut *Cntoutpin , bool ldac_invert=false  );
00028  int getsclcnt( ){return sclcnt;}
00029   int readaddress(char& address, char& eepromaddr , char& regaddr );
00030 
00031   int setaddress(char currentaddress, char newaddress );
00032 
00033   void start_scl_cnt(int cnts) ;
00034 
00035 };//endclass