Synergy Software Package User's Manual

RTOS-integrated ADC Periodic Framework Interface. More...

Data Structures

struct  sf_adc_periodic_callback_args_t
 
struct  sf_adc_periodic_cfg_t
 
struct  sf_adc_periodic_api_t
 
struct  sf_adc_periodic_instance_t
 

Macros

#define SF_ADC_PERIODIC_API_VERSION_MAJOR   (2U)
 

Typedefs

typedef void sf_adc_periodic_ctrl_t
 

Enumerations

enum  sf_adc_periodic_event_t { SF_ADC_PERIODIC_EVENT_NEW_DATA }
 

Detailed Description

RTOS-integrated ADC Periodic Framework Interface.

Summary

This is a ThreadX aware generic Periodic ADC sampling framework intended to be used to sample the ADC at periodic intervals, buffer the specified number of samples and then notify the application. The driver will use hardware triggers to allow for time-synchronous sampling. After initial configuration and the scan process is started, the framework uses a hardware timer to trigger an ADC scan in one-shot mode. Each scan can consist of one or more channels. When each scan is completed the ADC interrupt is intercepted by the DTC which moves the result of the scan into the user buffer. Each scan is defined as a sampling iteration and the number of samples generated for each scan will be equal to the number of channels if the channels are sequential eg: channels 1, 2, 3, 4. If the channels are not in sequence, eg: channels 1, 3, 4, 5, then the samples generated by each scan will also include data from the unused channels in between. Thus the second example here will result in 5 samples being stored to the user buffer each time even though only 4 channels have been configured for usage.

The user specifies the total number of sample iterations that need to occur before being notified. When the specified number of sampling iterations have occurred and the data for each iteration has been stored into the user buffer, the user is notified via the callback function with an index for the valid data in the buffer and an event indicating that sampling for the specified number of iterations is complete. Unless the user stops the scan process using the stop API call, the scan will continue to be triggered by the timer and data will be written into the user buffer which is treated by the framework as a circular buffer. For this reason, the buffer length must be at least twice the total number of samples that will be generate after all the iterations are completed. In the second example, where there are 5 samples generated for each iteration, if the sample count is set to 3, this will result in 15 samples being available in the buffer before the callback is called. Thus in this example, the buffer length must be set to 30 or larger. The name and length of the buffer is specified via the framework configuration structure.

Implemented by: ADC Interface

Related SSP architecture topics:

ADC Periodic Framework Interface description: ADC Periodic Framework

Macro Definition Documentation

◆ SF_ADC_PERIODIC_API_VERSION_MAJOR

#define SF_ADC_PERIODIC_API_VERSION_MAJOR   (2U)

Version of the API defined in this file

Typedef Documentation

◆ sf_adc_periodic_ctrl_t

typedef void sf_adc_periodic_ctrl_t

ADC periodic framework control block. Allocate an instance specific control block to pass into the ADC periodic framework API calls.

Implemented as

Enumeration Type Documentation

◆ sf_adc_periodic_event_t

Options for the callback events.

Enumerator
SF_ADC_PERIODIC_EVENT_NEW_DATA 

New data is available in the buffer.