Myriota Flex SDK 2.5.0
Loading...
Searching...
No Matches
Analog Input

Configure and control the FlexSense Analog Input Interface. More...

Enumerations

enum  FLEX_AnalogInputMode { FLEX_ANALOG_IN_VOLTAGE , FLEX_ANALOG_IN_CURRENT }
 Analog Input Modes. More...
 

Functions

int FLEX_AnalogInputInit (const FLEX_AnalogInputMode InputMode)
 
int FLEX_AnalogInputDeinit (void)
 
int FLEX_AnalogInputReadCurrent (uint32_t *const pMicroAmps)
 
int FLEX_AnalogInputReadVoltage (uint32_t *const pMilliVolts)
 

Detailed Description

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.

Enumeration Type Documentation

◆ 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

Function Documentation

◆ FLEX_AnalogInputInit()

int FLEX_AnalogInputInit ( const FLEX_AnalogInputMode InputMode)

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
[in]InputModethe operation mode selected from FLEX_AnalogInputMode.
Returns
FLEX_SUCCESS (0) if succeeded and < 0 if failed.
Return values
-FLEX_ERROR_IO_EXPANDERfailed to initialise i/o expander device.
-FLEX_ERROR_POWER_OUTfailed 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_EXPANDERfailed to de-initialise i/o expander device.
-FLEX_ERROR_POWER_OUTfailed 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]pMicroAmpsthe Current reading in uA.
Returns
FLEX_SUCCESS (0) if succeeded and < 0 if failed.
Return values
-FLEX_ERROR_EINVALpMicroAmps is a NULL parameter
-FLEX_ERROR_EOPNOTSUPPAnalog input set to incorrect state (i.e. trying to read current when init to voltage mode)
-FLEX_ERROR_READ_FAILError 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]pMilliVoltsthe Voltage reading in mV.
Returns
FLEX_SUCCESS (0) if succeeded and < 0 if failed.
Return values
-FLEX_ERROR_EINVALpMilliVolts is a NULL parameter
-FLEX_ERROR_EOPNOTSUPPAnalog input set to incorrect state (i.e. trying to read Voltage when init to current mode)
-FLEX_ERROR_READ_FAILError reading from ADC device