Synergy Software Package User's Manual

RTOS-integrated ADC Framework. More...

Data Structures

struct  sf_adc_periodic_instance_ctrl_t
 

Macros

#define SF_ADC_PERIODIC_CODE_VERSION_MAJOR   (2U)
 

Functions

void sf_adc_periodic_demo_task (ULONG thread_input)
 
void app_callback (sf_adc_periodic_callback_args_t *p_args)
 
ssp_err_t SF_ADC_PERIODIC_Open (sf_adc_periodic_ctrl_t *const p_api_ctrl, sf_adc_periodic_cfg_t const *const p_cfg)
 Configures periodic ADC framework and optionally starts the timer. More...
 
ssp_err_t SF_ADC_PERIODIC_Start (sf_adc_periodic_ctrl_t *const p_api_ctrl)
 Gets mutex, starts the periodic ADC scan, and releases mutex. More...
 
ssp_err_t SF_ADC_PERIODIC_Stop (sf_adc_periodic_ctrl_t *const p_api_ctrl)
 Gets mutex, stops the periodic ADC scan, and releases mutex. More...
 
ssp_err_t SF_ADC_PERIODIC_Close (sf_adc_periodic_ctrl_t *const p_api_ctrl)
 The close function acquires the unit's mutex, closes all lower level drivers, releases and deletes the mutex. More...
 
ssp_err_t SF_ADC_PERIODIC_VersionGet (ssp_version_t *const p_version)
 Gets version and stores it in provided pointer p_version. More...
 

Detailed Description

RTOS-integrated ADC Framework.

Macro Definition Documentation

◆ SF_ADC_PERIODIC_CODE_VERSION_MAJOR

#define SF_ADC_PERIODIC_CODE_VERSION_MAJOR   (2U)

Version of code that implements the API defined in this file

Function Documentation

◆ app_callback()

void app_callback ( sf_adc_periodic_callback_args_t p_args)

Callback function that will be called when the requested number of sampling iterations are complete

If the event indicates that new data is available

Assuming only one channel is configured, data for that channel is available via the buffer index. Refer to the usage manual for more details.

◆ SF_ADC_PERIODIC_Close()

ssp_err_t SF_ADC_PERIODIC_Close ( sf_adc_periodic_ctrl_t *const  p_api_ctrl)

The close function acquires the unit's mutex, closes all lower level drivers, releases and deletes the mutex.

Return values
SSP_SUCCESSSuccessful close.
SSP_ERR_ASSERTIONOne or more pointers point to NULL.
SSP_ERR_NOT_OPENDriver control block not valid. Call SF_ADC_PERIODIC_Open to configure.

Get mutex since this will access hardware registers

Close the HAL layer modules

Delete RTOS services used

Clear information from control block so other functions know this instance is closed

◆ sf_adc_periodic_demo_task()

void sf_adc_periodic_demo_task ( ULONG  thread_input)

Initialize the framework

Check for error condition

Start the scan process

Check for error condition

Stop the scan process

Check for error condition

Restart the scan process

Check for error condition

Stop the scan process

Check for error condition

Close the framework

Check for error condition

◆ SF_ADC_PERIODIC_Open()

ssp_err_t SF_ADC_PERIODIC_Open ( sf_adc_periodic_ctrl_t *const  p_api_ctrl,
sf_adc_periodic_cfg_t const *const  p_cfg 
)

Configures periodic ADC framework and optionally starts the timer.

The SF_ADC_PERIODIC_Open function acquires a mutex for the ADC Unit used, then calls the driver .open function in the p_api parameter. The mutex is released following the driver layer open function.

Return values
SSP_SUCCESSInitialization was successful.
SSP_ERR_ASSERTIONOne of the following parameters may be NULL: p_api_ctrl or p_cfg. See HAL driver for other possible causes.
SSP_ERR_INVALID_ARGUMENTAn invalid argument is used
SSP_ERR_INTERNALAn internal ThreadX error has occurred. This is typically a failure to create/use a mutex or to create an internal thread.
Returns
See Common Error Codes or HAL driver for other possible return codes or causes.

Save driver structure pointer for use in other framework layer functions

Create a mutex

Initialize the HAL layer

If any of the HAL layer initializations failed, then delete the mutex and exit the function with the error code

Delete the mutex.

Mark control block open so other tasks know it is valid

◆ SF_ADC_PERIODIC_Start()

ssp_err_t SF_ADC_PERIODIC_Start ( sf_adc_periodic_ctrl_t *const  p_api_ctrl)

Gets mutex, starts the periodic ADC scan, and releases mutex.

Warning
The driver will enable the ADC to be triggered via timer event; there will be a time delay from the time this function is called to the time the hardware timer count expires and triggers the scan.
Return values
SSP_SUCCESSADC Periodic Scan started successfully.
SSP_ERR_ASSERTIONOne or more pointers point to NULL.
SSP_ERR_NOT_OPENDriver control block not valid. Call SF_ADC_PERIODIC_Open to configure.
SSP_ERR_INTERNALAn internal ThreadX error has occurred. This is typically a failure to create/use a mutex or to create an internal thread.
SSP_ERR_IN_USEThe module is currently busy performing another operation
Returns
See Common Error Codes or HAL driver for other possible return codes or causes. This function calls:

Get mutex, start timer, then release mutex

Enable the ADC to receive hardware triggers

If the scan was successfully enabled in the ADC HAL,

Start the timer to generate the ADC trigger events

Return the mutex.

◆ SF_ADC_PERIODIC_Stop()

ssp_err_t SF_ADC_PERIODIC_Stop ( sf_adc_periodic_ctrl_t *const  p_api_ctrl)

Gets mutex, stops the periodic ADC scan, and releases mutex.

Return values
SSP_SUCCESSPeriodic ADC scan stopped successfully.
SSP_ERR_ASSERTIONOne or more pointers point to NULL..
SSP_ERR_NOT_OPENDriver control block not valid. Call SF_ADC_PERIODIC_Open to configure.
SSP_ERR_INTERNALAn internal ThreadX error has occurred. This is typically a failure to create/use a mutex or to create an internal thread.
SSP_ERR_IN_USEThe module is currently busy performing another operation
Returns
See Common Error Codes or HAL driver for other possible return codes or causes. This function calls:

Get mutex, stop timer, then release mutex

Return the mutex.

◆ SF_ADC_PERIODIC_VersionGet()

ssp_err_t SF_ADC_PERIODIC_VersionGet ( ssp_version_t *const  p_version)

Gets version and stores it in provided pointer p_version.

Return values
SSP_SUCCESSVersion returned successfully.
SSP_ERR_ASSERTIONParameter p_version was null.