Jump to main content

##

# 2.4.19 ADCHS_DMACallbackRegister Function

## C

    void ADCHS_DMACallbackRegister(ADCHS_DMA_CALLBACK callback, uintptr_t context)

## Summary

Registers the application event handler which is called when the DMA transfer is complete

## Description

Registers the application event handler which is called when the DMA transfer is complete

## Precondition

ADCHS_Initialize() must have been called first for the associated instance.

## Parameters

Param | Description
--- | ---
callback | callback function pointer confirming to ADCHS_DMA_CALLBACK type
context | Allows the caller to provide a context value (usually a pointer to the callers context for multi-instance clients)

## Returns

None.

## Example

    void ADC_ResultHandler(ADCHS_DMA_STATUS dmaStatus, uintptr_t context)
    {
        if (dmaStatus & ADCHS_DMA_STATUS_RAF0)
        {
            bufferA_Full = true;
        }

        if (dmaStatus & ADCHS_DMA_STATUS_RBF0)
        {
            bufferB_Full = true;
        }
    }

    ADCHS_DMACallbackRegister(ADC_ResultHandler, (uintptr_t)NULL);

## Remarks

Context value can be set to NULL if not required. To disable callback function, pass NULL for the callback parameter.