Library for the MAX11300
Diff: MAX113XX_Pixi.h
- Revision:
- 13:546dd29b1c7a
- Parent:
- 12:8054ee101bad
- Child:
- 14:cc5349db13a3
diff -r 8054ee101bad -r 546dd29b1c7a MAX113XX_Pixi.h --- a/MAX113XX_Pixi.h Tue May 09 19:04:38 2017 +0000 +++ b/MAX113XX_Pixi.h Tue May 09 22:06:19 2017 +0000 @@ -127,6 +127,14 @@ MODE_12 }; + ///Temperature sensors + enum TempSensor_e + { + Internal, + External1, + External2 + }; + ///Command results enum CmdResult_e { @@ -136,7 +144,7 @@ Success }; - MAX113XX_Pixi(Device_e device, PinName cnvt); + MAX113XX_Pixi(Device_e device, PinName cnvt=NC); ///@brief Read single ended ADC configured port ///@param[in] port - single ended ADC configured port @@ -146,11 +154,9 @@ ///@brief Read differential ADC configured port ///@param[in] posPort - positive port - ///@param[in] negPort - negative Port - ///@param[out] data - contents of ADC data register + ///@param[out] data - contents of positive port ADC data register ///@return Result of operation - CmdResult_e differentialADCRead(Ports_e posPort, Ports_e negPort, - uint16_t &data); + CmdResult_e differentialADCRead(Ports_e posPort, int16_t &data); ///@brief Write DAC configured port ///@param[in] port - DAC configured port @@ -158,6 +164,14 @@ ///@return Result of operation CmdResult_e dacWrite(Ports_e port, const uint16_t data); + ///@brief Write DAC configured port and read ADC for port + ///@param[in] port - DAC w/ADC Monitor configured port + ///@param[in] data - value to be written to DAC data register + ///@param[out] adcData - value read from adc + ///@return Result of operation + CmdResult_e dacWriteADCMonitor(Ports_e port, const uint16_t data, + uint16_t &adcData); + ///@brief Reads gpi configured port ///@param[in] port - gpi congigured port to be read ///@param[out] state - lsb of state matches port state @@ -171,11 +185,15 @@ CmdResult_e gpioWrite(Ports_e port, const uint8_t state); ///@brief Sets the state of a software controlled analog switch - ///@param[in] portA - One side of analog switch - ///@param[in] portB - The ther side of the analog switch - ///@param[in] state - True for closed, false for open + ///@param[in] lowPort - Port with lowest index + ///@param[in] state - True for closed, false for hi-z ///@return Result of operation - CmdResult_e setAnalogSwitchState(Ports_e portA, Ports_e portB, bool state); + CmdResult_e setAnalogSwitchState(Ports_e lowPort, bool state); + + ///@brief Reads temperature sensor + ///@param[in] sensor - internal, or external sensor one or two + ///@return Result of operation + CmdResult_e readTempSensor(TempSensor_e sensor, float &data); ///@brief Dumps pixi memory to provided Serial object ///@param[in] ser - output device @@ -230,7 +248,7 @@ ///@param[in] device - pixi device; MAX11300, MAX11301,... ///@param[in] cnvrt - pin to be used for convert MAX113XX_SPI(SPI & spiBus, PinName cs, MAX113XX_Pixi::Device_e device, - PinName cnvt); + PinName cnvt=NC); ///@brief MAX113XX_SPI Destructor ~MAX113XX_SPI(); @@ -263,7 +281,7 @@ ///@param[in] i2cBus - reference to I2C bus for this device ///@param[in] device - pixi device; MAX11300, MAX11301,... ///@param[in] cnvrt - pin to be used for convert - MAX113XX_I2C(I2C &i2cBus, MAX113XX_Pixi::Device_e device, PinName cnvt); + MAX113XX_I2C(I2C &i2cBus, MAX113XX_Pixi::Device_e device, PinName cnvt=NC); ///@brief MAX113XX_I2C Destructor ~MAX113XX_I2C();