Configure and control the FlexSense Analog Input Interface.
More...
Configure and control the FlexSense Analog Input Interface.
The FlexSense Analog input can be configured to read Current in micro-amps or Voltage in milli-volts.
- Warning
- To maximise the battery life of your FlexSense, we recommend initialising and de-initialising the Analog Input interface each time the job using it is called. This will reduce the idle power usage of your FlexSense.
◆ FLEX_AnalogInputMode
Analog Input Modes.
Enumerator |
---|
FLEX_ANALOG_IN_VOLTAGE | use when measuring Voltage at the Analog Input
|
FLEX_ANALOG_IN_CURRENT | use when measuring Current at the Analog Input
|
◆ FLEX_AnalogInputInit()
Initialise the Analog Input in Voltage or Current mode.
- Note
- De-initialise the Analog Input before a job is completed to preserve device power.
- Parameters
-
- Returns
- FLEX_SUCCESS (0) if succeeded and < 0 if failed.
- Return values
-
-FLEX_ERROR_IO_EXPANDER | failed to initialise i/o expander device. |
-FLEX_ERROR_POWER_OUT | failed to enable power to the analog input interface. |
◆ FLEX_AnalogInputDeinit()
int FLEX_AnalogInputDeinit |
( |
void | | ) |
|
De-initialise the Analog Input interface.
- Note
- De-initialise the Analog Input before a job is completed to preserve device power.
- Returns
- FLEX_SUCCESS (0) if succeeded and < 0 if failed.
- Return values
-
-FLEX_ERROR_IO_EXPANDER | failed to de-initialise i/o expander device. |
-FLEX_ERROR_POWER_OUT | failed to disable power to the analog input interface. |
◆ FLEX_AnalogInputReadCurrent()
int FLEX_AnalogInputReadCurrent |
( |
uint32_t *const | pMicroAmps | ) |
|
Get the Current reading in micro-amps from the Analog Input interface.
- Note
- The Analog Input interface needs to be initialised in Current mode before performing a Current reading.
- Parameters
-
[out] | pMicroAmps | the Current reading in uA. |
- Returns
- FLEX_SUCCESS (0) if succeeded and < 0 if failed.
- Return values
-
-FLEX_ERROR_EINVAL | pMicroAmps is a NULL parameter |
-FLEX_ERROR_EOPNOTSUPP | Analog input set to incorrect state (i.e. trying to read current when init to voltage mode) |
-FLEX_ERROR_READ_FAIL | Error reading from ADC device |
◆ FLEX_AnalogInputReadVoltage()
int FLEX_AnalogInputReadVoltage |
( |
uint32_t *const | pMilliVolts | ) |
|
Get the Voltage reading in milli-volts from the Analog Input interface.
- Note
- The Analog Input interface needs to be initialised in Voltage mode before performing a Voltage reading.
- Parameters
-
[out] | pMilliVolts | the Voltage reading in mV. |
- Returns
- FLEX_SUCCESS (0) if succeeded and < 0 if failed.
- Return values
-
-FLEX_ERROR_EINVAL | pMilliVolts is a NULL parameter |
-FLEX_ERROR_EOPNOTSUPP | Analog input set to incorrect state (i.e. trying to read Voltage when init to current mode) |
-FLEX_ERROR_READ_FAIL | Error reading from ADC device |