lib to set the address of the MCP4728

Dependents:   MCP4728setaddrProg mbedSerialInterface_talkback2 MCP4728test mbedSerialInterface_sequencer

Committer:
wbeaumont
Date:
Wed Jun 21 14:08:47 2017 +0000
Revision:
2:6ebeef601a90
Parent:
1:1ba04e54bd3c
added info for the class initiation parameters

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wbeaumont 0:19560a1deb3c 1
wbeaumont 0:19560a1deb3c 2
wbeaumont 0:19560a1deb3c 3
wbeaumont 0:19560a1deb3c 4 class I2CInterface;
wbeaumont 0:19560a1deb3c 5 //class DigitalOut;
wbeaumont 0:19560a1deb3c 6 //class InterruptIn;
wbeaumont 0:19560a1deb3c 7
wbeaumont 0:19560a1deb3c 8 class MPC4728_address_set{
wbeaumont 0:19560a1deb3c 9 I2CInterface *i2cd;
wbeaumont 0:19560a1deb3c 10 DigitalOut *LDAC;
wbeaumont 0:19560a1deb3c 11 DigitalOut *Cntout;
wbeaumont 0:19560a1deb3c 12 InterruptIn cntin;
wbeaumont 0:19560a1deb3c 13 int sclcnt;
wbeaumont 0:19560a1deb3c 14 unsigned char oldaddress;
wbeaumont 0:19560a1deb3c 15 void count_down( );
wbeaumont 0:19560a1deb3c 16 int ldac1;
wbeaumont 0:19560a1deb3c 17 int ldac0;
wbeaumont 0:19560a1deb3c 18
wbeaumont 0:19560a1deb3c 19 public:
wbeaumont 2:6ebeef601a90 20 /*
wbeaumont 2:6ebeef601a90 21 sclcntpin : the pin physically connected to the I2C SCL line that counts the clock pulses ( via interrupt)
wbeaumont 2:6ebeef601a90 22 LDACpin pointer to the pin that change polarity after x SCL clock pulses to set the address (see data sheet)
wbeaumont 2:6ebeef601a90 23 i2cdevice : pointer to the I2C interface
wbeaumont 2:6ebeef601a90 24 Cntoutpin : this is to debug the count down interrupt. This toggles everty time the cnt down interrupt is called ( no function for the MPC4728)
wbeaumont 2:6ebeef601a90 25 ldac_invert : if this active the LDAC line is set from 1 to 0
wbeaumont 2:6ebeef601a90 26 */
wbeaumont 0:19560a1deb3c 27 MPC4728_address_set(PinName sclcntpin, DigitalOut *LDACpin, I2CInterface* i2cdevice, DigitalOut *Cntoutpin , bool ldac_invert=false );
wbeaumont 0:19560a1deb3c 28 int getsclcnt( ){return sclcnt;}
wbeaumont 1:1ba04e54bd3c 29 int readaddress(char& address, char& eepromaddr , char& regaddr );
wbeaumont 0:19560a1deb3c 30
wbeaumont 0:19560a1deb3c 31 int setaddress(char currentaddress, char newaddress );
wbeaumont 0:19560a1deb3c 32
wbeaumont 0:19560a1deb3c 33 void start_scl_cnt(int cnts) ;
wbeaumont 0:19560a1deb3c 34
wbeaumont 0:19560a1deb3c 35 };//endclass