![]() |
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... | |
RTOS-integrated ADC Framework.
| #define SF_ADC_PERIODIC_CODE_VERSION_MAJOR (2U) |
Version of code that implements the API defined in this file
| 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.
| 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.
| SSP_SUCCESS | Successful close. |
| SSP_ERR_ASSERTION | One or more pointers point to NULL. |
| SSP_ERR_NOT_OPEN | Driver 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
| 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
| 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.
| SSP_SUCCESS | Initialization was successful. |
| SSP_ERR_ASSERTION | One of the following parameters may be NULL: p_api_ctrl or p_cfg. See HAL driver for other possible causes. |
| SSP_ERR_INVALID_ARGUMENT | An invalid argument is used |
| SSP_ERR_INTERNAL | An internal ThreadX error has occurred. This is typically a failure to create/use a mutex or to create an internal thread. |
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
| 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.
| SSP_SUCCESS | ADC Periodic Scan started successfully. |
| SSP_ERR_ASSERTION | One or more pointers point to NULL. |
| SSP_ERR_NOT_OPEN | Driver control block not valid. Call SF_ADC_PERIODIC_Open to configure. |
| SSP_ERR_INTERNAL | An internal ThreadX error has occurred. This is typically a failure to create/use a mutex or to create an internal thread. |
| SSP_ERR_IN_USE | The module is currently busy performing another operation |
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.
| 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.
| SSP_SUCCESS | Periodic ADC scan stopped successfully. |
| SSP_ERR_ASSERTION | One or more pointers point to NULL.. |
| SSP_ERR_NOT_OPEN | Driver control block not valid. Call SF_ADC_PERIODIC_Open to configure. |
| SSP_ERR_INTERNAL | An internal ThreadX error has occurred. This is typically a failure to create/use a mutex or to create an internal thread. |
| SSP_ERR_IN_USE | The module is currently busy performing another operation |
Get mutex, stop timer, then release mutex
Return the mutex.
| ssp_err_t SF_ADC_PERIODIC_VersionGet | ( | ssp_version_t *const | p_version | ) |
Gets version and stores it in provided pointer p_version.
| SSP_SUCCESS | Version returned successfully. |
| SSP_ERR_ASSERTION | Parameter p_version was null. |