AGHAF  4.5.6
Annecy electronique Generic Hardware Access Framework
ADC

API to use ADC (Analog to Digital Converter) on exxotest devices. More...

enum  AGHAF_ADC_Event { AGHAF_ADC_EVENT_NONE , AGHAF_ADC_EVENT_TRIGGER , AGHAF_ADC_EVENT_STANDARD }
 Possible event reporting. More...
 
enum  AGHAF_ADC_TriggerSlope { AGHAF_ADC_TRIG_SLOPE_RISING = 0 , AGHAF_ADC_TRIG_SLOPE_FALLING = 1 }
 Trigger slope. More...
 
enum  AGHAF_ADC_TriggerState { AGHAF_ADC_TRIG_STATE_NONE = 0 , AGHAF_ADC_TRIG_STATE_LOW , AGHAF_ADC_TRIG_STATE_HIGH }
 Trigger state. More...
 
enum  AGHAF_ADC_Param {
  AGHAF_ADC_PARAM_EVENT , AGHAF_ADC_PARAM_PERIOD , AGHAF_ADC_PARAM_TRIGGER_INIT_SLOPE , AGHAF_ADC_PARAM_TRIGGER_LOW_THRESHOLD ,
  AGHAF_ADC_PARAM_TRIGGER_HIGH_THRESHOLD
}
 List of parameters used to configure an ADC bus. More...
 
typedef void * AGHAF_ADC
 handle on a ADC
 
typedef void(* AGHAF_ADC_onConversion) (uint64_t timestamp, int32_t value, AGHAF_ADC_TriggerState state, void *userContext)
 callback called on a ADC event More...
 
void AGHAF_ADC_setOnConversionCallback (AGHAF_ADC adc, AGHAF_ADC_onConversion callback, void *userContext)
 Set the callback called on a ADC event. More...
 
AGHAF_ADC AGHAF_ADC_get (AGHAF_Device device, uint8_t index)
 return the KLine bus at the index specified More...
 
uint8_t AGHAF_ADC_getIndex (AGHAF_ADC adc)
 return the index from an ADC More...
 
uint8_t AGHAF_ADC_getCount (AGHAF_Device device)
 return the number of Adcs available on a device More...
 
AGHAF_Status AGHAF_ADC_activate (AGHAF_ADC adc)
 start the communication with the ADC More...
 
AGHAF_Status AGHAF_ADC_deactivate (AGHAF_ADC adc)
 stop the communication with the ADC More...
 
AGHAF_Status AGHAF_ADC_isActivated (AGHAF_ADC adc, AGHAF_BOOL *isActivated)
 allow to know if the communication on the ADC is started or not More...
 
AGHAF_Status AGHAF_ADC_getParam (AGHAF_ADC adc, AGHAF_ADC_Param param, uint32_t *value)
 get a parameter from a ADC More...
 
AGHAF_Status AGHAF_ADC_setParam (AGHAF_ADC adc, AGHAF_ADC_Param param, uint32_t value)
 set a parameter from a ADC More...
 
AGHAF_Status AGHAF_ADC_getLastConversion (AGHAF_ADC adc, int32_t *value, AGHAF_ADC_TriggerState *triggerState)
 Return the current state from the ADC trigger. More...
 

Detailed Description

API to use ADC (Analog to Digital Converter) on exxotest devices.

Usage Example

Call order and priority

Device is in "init" state at startup.

The following section describes state management:


Symbol Description
Forbidden
Authorized
Followed status


Function Config Active
AGHAF_ADC_setOnConversionCallback
AGHAF_ADC_get
AGHAF_ADC_getIndex
AGHAF_ADC_getCount
AGHAF_ADC_activate
AGHAF_ADC_deactivate
AGHAF_ADC_isActivated
AGHAF_ADC_getParam
AGHAF_ADC_setParam
AGHAF_ADC_getLastConversion
image html snok.png

Typedef Documentation

◆ AGHAF_ADC_onConversion

typedef void(* AGHAF_ADC_onConversion) (uint64_t timestamp, int32_t value, AGHAF_ADC_TriggerState state, void *userContext)

callback called on a ADC event

Parameters
timestamptimestamp of the event
valuevalue in mV from the ADC
statestate from the trigger: AGHAF_ADC_TriggerState
userContextcontext given when setting the callabck in the system

Enumeration Type Documentation

◆ AGHAF_ADC_Event

Possible event reporting.

Enumerator
AGHAF_ADC_EVENT_NONE 

Disable ADC events reporting. This will reduce the load on the USB bus if you don't need these events. Use function to read the last conversion value.

AGHAF_ADC_EVENT_TRIGGER 

Reports conversion values only when a trigger has occurred.

AGHAF_ADC_EVENT_STANDARD 

Reports conversion values at the configured period.

◆ AGHAF_ADC_Param

List of parameters used to configure an ADC bus.

Enumerator
AGHAF_ADC_PARAM_EVENT 

Configure ADC events reporting.

Use: AGHAF_ADC_Event
Default: AGHAF_ADC_EVENT_STANDARD

AGHAF_ADC_PARAM_PERIOD 

Defines the period at which conversion values are reported and/or the interval at which the trigger threshold is tested.

Min: 1 ms
Max: 60000 ms
Default: 1000 ms

AGHAF_ADC_PARAM_TRIGGER_INIT_SLOPE 

Configures the initial trigger slope.\nThe slope will be inverted after each trigger.

Min: AGHAF_ADC_TriggerSlope
Default: AGHAF_ADC_TRIG_SLOPE_RISING

AGHAF_ADC_PARAM_TRIGGER_LOW_THRESHOLD 

Sets the low trigger threshold.

Min: 0 mV
Max: 36000 mV
Default: 11000 mV

AGHAF_ADC_PARAM_TRIGGER_HIGH_THRESHOLD 

Sets the high trigger threshold.

Min: 0 mV
Max: 36000 mV
Default: 12000 mV

◆ AGHAF_ADC_TriggerSlope

Trigger slope.

Enumerator
AGHAF_ADC_TRIG_SLOPE_RISING 

The conversion value must be above the high threshold to cause a trigger.

AGHAF_ADC_TRIG_SLOPE_FALLING 

The conversion value must be below the low threshold to cause a trigger.

◆ AGHAF_ADC_TriggerState

Trigger state.

Enumerator
AGHAF_ADC_TRIG_STATE_NONE 

No triggering occurred.

AGHAF_ADC_TRIG_STATE_LOW 

The conversion value has gone below the low threshold.

AGHAF_ADC_TRIG_STATE_HIGH 

The conversion value has gone above the high threshold.

Function Documentation

◆ AGHAF_ADC_activate()

AGHAF_Status AGHAF_ADC_activate ( AGHAF_ADC  adc)

start the communication with the ADC

Parameters
adchandle on the ADC
Returns
status request information
Examples
ADC/main.cpp.

◆ AGHAF_ADC_deactivate()

AGHAF_Status AGHAF_ADC_deactivate ( AGHAF_ADC  adc)

stop the communication with the ADC

Parameters
adchandle on the ADC
Returns
status request information
Examples
ADC/main.cpp.

◆ AGHAF_ADC_get()

AGHAF_ADC AGHAF_ADC_get ( AGHAF_Device  device,
uint8_t  index 
)

return the KLine bus at the index specified

Parameters
devicehandle on the device
indexindex from the ADC
Returns
handle on the uart (NULL if index invalid)
Examples
ADC/main.cpp.

◆ AGHAF_ADC_getCount()

uint8_t AGHAF_ADC_getCount ( AGHAF_Device  device)

return the number of Adcs available on a device

Parameters
devicehandle on the device
Returns
number of ADCs available
Examples
ADC/main.cpp.

◆ AGHAF_ADC_getIndex()

uint8_t AGHAF_ADC_getIndex ( AGHAF_ADC  adc)

return the index from an ADC

Parameters
adchandle on the ADC
Returns
index from the ADC

◆ AGHAF_ADC_getLastConversion()

AGHAF_Status AGHAF_ADC_getLastConversion ( AGHAF_ADC  adc,
int32_t *  value,
AGHAF_ADC_TriggerState triggerState 
)

Return the current state from the ADC trigger.

Parameters
adchandle on the ADC
valuepointer to fill the current conversion value in mV
triggerStatepointer to fill the current trigger state
Returns
request information
Examples
ADC/main.cpp.

◆ AGHAF_ADC_getParam()

AGHAF_Status AGHAF_ADC_getParam ( AGHAF_ADC  adc,
AGHAF_ADC_Param  param,
uint32_t *  value 
)

get a parameter from a ADC

Parameters
adchandle on the ADC
paramparameter to get
valuevalue to get
Returns
status request information

◆ AGHAF_ADC_isActivated()

AGHAF_Status AGHAF_ADC_isActivated ( AGHAF_ADC  adc,
AGHAF_BOOL isActivated 
)

allow to know if the communication on the ADC is started or not

Parameters
adchandle on the ADC
isActivatedboolean to know if the communication is started or not
Returns
status request information

◆ AGHAF_ADC_setOnConversionCallback()

void AGHAF_ADC_setOnConversionCallback ( AGHAF_ADC  adc,
AGHAF_ADC_onConversion  callback,
void *  userContext 
)

Set the callback called on a ADC event.

Parameters
adchandle on the ADC
callbackcallback to be used for the event
userContextcontext provided by the user for custom datas
Examples
ADC/main.cpp.

◆ AGHAF_ADC_setParam()

AGHAF_Status AGHAF_ADC_setParam ( AGHAF_ADC  adc,
AGHAF_ADC_Param  param,
uint32_t  value 
)

set a parameter from a ADC

Parameters
adchandle on the ADC
paramparameter to set
valuevalue to set
Returns
status request information