Skip to content

Draft: Implement PCF8591 DAC/ADC in libDevCom

Karol Krizka requested to merge kk_pcf8591 into devel

datasheet

This device contains one D/A output and 4x A/D input channels. Thus the class inherits from both ADCDevice and DACDevice. Any ambiguous functions (ie: setCalibration present in both) should be accessed by explicitly casting to the desired interface. An example of using this the duality is in pcf8591_example.

The problematic naming clash is in the read function implemented in this class. The resolution is defaulting to the reading of the ADC value. There is no support in the device for reading the DAC value anyway. However this means that std::dynamic_cast<DACDevice>(mypcf)->read() will return the ADC value.

Draft The following behaviour is fixed as any operation requires the resetting of the control register. The final implementation will contain the current setting as an object property and apply it every time. The limitation will be that one cannot have two instances of the device (ie: multiple processes), as they will not be aware of each others state.

  • The DAC output is always on.
  • The ADC readings are always single-ended.
Edited by Karol Krizka

Merge request reports

Loading