General usable MCP4728 quad DAC implementation only limited function has to be used together with the DevInterface lib
Dependents: mbedSerialInterface_talkback2 MCP4728test mbedSerialInterface_sequencer
Diff: mcp4728.h
- Revision:
- 4:f45f4ff5a51a
- Parent:
- 3:2a2eafba8a1d
- Child:
- 5:164362cf5836
diff -r 2a2eafba8a1d -r f45f4ff5a51a mcp4728.h --- a/mcp4728.h Tue Jan 12 15:45:23 2016 +0000 +++ b/mcp4728.h Tue Jan 12 16:04:02 2016 +0000 @@ -88,12 +88,16 @@ /** Read the contents of the dac registers,( also eeprom settings) , and if an eeprom write is currently active. * result of the reading is stored in the channelstatus structure . - * @param checkall check if the channel nr and adress is returned correctly . - * @returns - * 0 on success, - * non-0 on failure + * @param checkall check if the channel nr and adress is returned correctly in 04x this is not tested /checked so set to false . + * @returns 0 on success non-0 on failure */ int update(bool checkall); + + /** Read the contents of the dac registers,( also eeprom settings) , and if an eeprom write is currently active. + * result of the reading is stored in the channelstatus structure . + * implementation of the update from the DACInterface + * @returns 0 on success non-0 on failure + */ virtual int update() { return update(false);} @@ -102,8 +106,9 @@ * @param ch : the channel nr * @param updatereq: if true the function update(true) is called else the class status table is used . * @param eprom: if true the values in the eprom are used else the values of the DAC channel - * @param str a pointer to an array of char by example chanstatstr[100] 100 is minuimum. + * @param str a pointer to an array of char by example chanstatstr[200] 200 is minuimum. * @param dimension of the str array ( so sizeoff(chanstatstr) + * @return the number of chars in the string or negative in case of an error */ int StatusString(int ch,bool updatereq ,bool eprom, char *str , int length); @@ -129,7 +134,7 @@ ( For version 0.4x this is internal, normal power , gain x2 ) @param value the DAC value to be set @param ch the channel nr 0..3 - @return the I2C result of the last update command + @return the I2C result when trying to set the DAC value */ virtual int setDACvalue( int value, int ch=0); @@ -140,7 +145,7 @@ Implementation of the setVoltagevalue of the DACInterface @param voltage by reference , the request DAC output voltage for the channel @param ch the channel nr 0..3 - @return the I2C result of the last update command + @return the I2C result when trying to set the DAC value */ virtual int setVoltage (float voltage, int ch=0); @@ -165,6 +170,7 @@ given the DAC configuration. There is no "under/ overflow" check @param voltage the requested voltage @param gain : the gain setting x1 or x2 + @param vref : use internal or external reference @return : the DAC value based the parameters to get the requested output voltage */ short int volt2dig( float voltage,GainMode gain, VrefMode vref); @@ -201,8 +207,6 @@ MCP4728ChStatus chstat[4]; - - }; #endif \ No newline at end of file