1.35.1.14 ADC_CALLBACK Typedef

C

typedef void (*ADC_CALLBACK)(ADC_STATUS status, uintptr_t context);
typedef void (*ADC_CALLBACK)(uint32_t status, uintptr_t context);
typedef void (*ADC_CALLBACK)(uint32_t interruptStatus, uint32_t eocInterruptStatus, uintptr_t context);
typedef void (*ADC_CALLBACK)(uintptr_t context);

Summary

Defines the data type and function signature for the adc peripheral callback function.

Description

This data type defines the function signature for the adc peripheral callback function. The adc peripheral will call back the client's function with this signature at the end of conversion.

Precondition

ADC_Initialize() must have been called for the given adc peripheral instance and ADC_CallbackRegister() must have been called to set the function to be called.

Parameters

Param Description
status interrupt status.
context Allows the caller to provide a context value (usually a pointer to the callers context for multi-instance clients)
interruptStatus Status of interrupt
eocInterruptStatus Status of EOC interrupt

Returns

None.

Example

void ADC_ResultReadyCallback( ADC_STATUS status, uintptr_t context )
{
    uint16_t adcResult = 0;
    adcResult = ADC_ConversionResultGet();
}
ADC_CallbackRegister(ADC_ResultReadyCallback, uintptr_t(NULL));
void ADC_Callback(uint32_t interruptStatus, uint32_t eocInterruptStatus, uintptr_t context)
{
    
}

ADC_CallbackRegister(ADC_Callback, NULL);
void ADC_Callback (uintptr_t context)
{
}

ADC_CallbackRegister(ADC_Callback, NULL);

Remarks

The callback feature is only available when the library was generated with interrupt option (in MHC) enabled.