Bar Logo Dual Active Bridge Development Board (Part-No. )
 
Content
     
Loading...
Searching...
No Matches

High-Speed, 12-Bit Multiple SARs Analog-to-Digital Converter driver using dsPIC MCUs. More...

+ Collaboration diagram for ADC Multicore Driver:

Files

file  adc1.h
 This is the generated driver header file for the ADC1 driver.
 
file  adc_features.h
 This is the generated module feature header file for ADC driver This file provides module feature list available on the selected device. The macros defined in this file provides the flexibility to easily migrate the user application to other device which might have varied feature list. The content in this file is strictly "read only" and should not be altered.
 
file  adc_types.h
 This is the generated driver types header file for the ADC driver.
 
file  adc1.c
 This is the generated driver source file for ADC1 driver.
 

Data Structures

struct  ADC_INTERFACE
 Structure containing the function pointers of ADC driver. More...
 
struct  ADC_MULTICORE
 Structure containing the function pointers of ADC driver. More...
 

Macros

#define ADC1_SCAN_MODE_SELECTED   true
 Defines the scan option selection done for the shared channels.
 
#define ADC1_RESOLUTION   12
 Defines the ADC Resolution.
 
#define ADC_POWER_ENABLE_FEATURE_AVAILABLE   1
 This macro defines the ADC core power enable functionality.
 
#define ADC_CALIBRATION_FEATURE_AVAILABLE   1
 This macro defines the macro associated with ADC core calibration.
 
#define ADC_INDIVIDUAL_CHANNEL_INTERRUPT_FEATURE_AVAILABLE   1
 Defines the macro associated with ADC indvidual channel interrupts.
 
#define ADC_COMPARATOR_FEATURE_AVAILABLE   1
 Defines the macro associated with ADC comparator feature.
 

Functions

void ADC1_Initialize (void)
 Initializes ADC1 module, using the given initialization data This function must be called before any other ADC1 function is called.
 
void ADC1_Deinitialize (void)
 Deinitializes the ADC1 to POR values.
 
static void ADC1_Enable (void)
 This inline function enables the ADC1 module.
 
static void ADC1_Disable (void)
 This inline function disables the ADC1 module.
 
static void ADC1_SoftwareTriggerEnable (void)
 This inline function sets software common trigger.
 
static void ADC1_SoftwareTriggerDisable (void)
 This inline function resets software common trigger.
 
static void ADC1_ChannelSelect (enum ADC_CHANNEL channel)
 This inline function allows selection of a channel for conversion.
 
static uint16_t ADC1_ConversionResultGet (enum ADC_CHANNEL channel)
 Returns the conversion value for the channel selected.
 
static bool ADC1_IsConversionComplete (enum ADC_CHANNEL channel)
 This inline function returns the status of conversion.This function is used to determine if conversion is completed. When conversion is complete the function returns true otherwise false.
 
static void ADC1_ResolutionSet (enum ADC_RESOLUTION_TYPE resolution)
 This inline function helps to configure all cores with same resolution.
 
static void ADC1_InterruptEnable (void)
 This inline function enables the ADC1 interrupt.
 
static void ADC1_InterruptDisable (void)
 This inline function disables the ADC1 interrupt.
 
static void ADC1_InterruptFlagClear (void)
 Clears interrupt flag manually.
 
static void ADC1_InterruptPrioritySet (uint16_t priorityValue)
 This inline function allows selection of priority for interrupt.
 
void ADC1_CommonCallbackRegister (void(*callback)(void))
 This function can be used to override default callback and to define custom callback for ADC1 Common event.
 
void ADC1_CommonCallback (void)
 This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using ADC1_CommonCallbackRegister.
 
void ADC1_Tasks (void)
 This function is used to implement the tasks for polled implementations.
 
static void ADC1_IndividualChannelInterruptEnable (enum ADC_CHANNEL channel)
 This inline function enables individual channel interrupt.
 
static void ADC1_IndividualChannelInterruptDisable (enum ADC_CHANNEL channel)
 This inline function disables individual channel interrupt.
 
static void ADC1_IndividualChannelInterruptFlagClear (enum ADC_CHANNEL channel)
 This inline function clears individual channel interrupt flag.
 
static void ADC1_IndividualChannelInterruptPrioritySet (enum ADC_CHANNEL channel, enum INTERRUPT_PRIORITY priorityValue)
 This inline function allows selection of priority for individual channel interrupt.
 
void ADC1_ChannelCallbackRegister (void(*callback)(enum ADC_CHANNEL channel, uint16_t adcVal))
 This function can be used to override default callback ADC1_ChannelCallback and to define custom callback for ADC1 Channel event. Read the conversion result of the corresponding channel in the custom callback.
 
void ADC1_ChannelCallback (enum ADC_CHANNEL channel, uint16_t adcVal)
 This is the default callback function for all the analog channels. This callback is triggered once the channel conversion is done for a channel and to read the conversion result of the corresponding channel.
 
void ADC1_ComparatorCallbackRegister (void(*callback)(enum ADC_CMP comparator))
 This function can be used to override default callback and to define custom callback for ADC1_Comparator event.
 
void ADC1_ComparatorCallback (enum ADC_CMP comparator)
 Comparator callback function.
 
void ADC1_ChannelTasks (enum ADC_CHANNEL channel)
 This function call used only in polling mode, if channel conversion is done for requested channel, the calls the respective callback function.
 
void ADC1_CorePowerEnable (enum ADC_DEDICATED_CORE core)
 Enables analog and digital power for ADC1 dedicated core.
 
void ADC1_SharedCorePowerEnable (void)
 Enables power for ADC1 shared Core This function is used to set the analog and digital power for ADC1 shared Core.
 
void ADC1_PWMTriggerSourceSet (enum ADC_CHANNEL channel, enum ADC_PWM_INSTANCE pwmInstance, enum ADC_PWM_TRIGGERS triggerNumber)
 Sets PWM trigger source for corresponding analog input.
 

Variables

const struct ADC_INTERFACE ADC1
 Structure object of type ADC_INTERFACE with the custom name given by the user in the Melody Driver User interface. The default name e.g. ADC1 can be changed by the user in the ADC user interface. This allows defining a structure with application specific name using the 'Custom Name' field. Application specific name allows the API Portability.
 

Detailed Description

Macro Definition Documentation

◆ ADC1_RESOLUTION

#define ADC1_RESOLUTION   12

Definition at line 66 of file adc1.h.

◆ ADC1_SCAN_MODE_SELECTED

#define ADC1_SCAN_MODE_SELECTED   true

Definition at line 60 of file adc1.h.

◆ ADC_CALIBRATION_FEATURE_AVAILABLE

#define ADC_CALIBRATION_FEATURE_AVAILABLE   1

APIs Supported:
void ADCx_CoreCalibration (enum ADC_CHANNEL channel);
void ADC_SharedCoreCalibration (void);

x denotes instance of ADC in ADCx, channel denotes dedicated Core. Refer to device specific datasheet to check number of cores and ADC module instance. Refer driver header file for detailed description of the APIs.

Definition at line 104 of file adc_features.h.

◆ ADC_COMPARATOR_FEATURE_AVAILABLE

#define ADC_COMPARATOR_FEATURE_AVAILABLE   1

APIs Supported:
void ADCx_ComparatorEnable(void);
void ADCx_ComparatorDisable(void);
void ADCx_ComparatorLowThresholdSet(uint16_t threshold );
void ADCx_ComparatorHighThresholdSet(uint16_t threshold );
uint16_t ADCx_ComparatorEventStatusGet(void);
uint16_t ADCx_ComparatorEventChannelGet(void);

x denotes instance of ADC in ADCx. Refer to device specific datasheet to check number of comparators and ADC module instance. Refer driver header file for detailed description of the APIs.

Definition at line 139 of file adc_features.h.

◆ ADC_INDIVIDUAL_CHANNEL_INTERRUPT_FEATURE_AVAILABLE

#define ADC_INDIVIDUAL_CHANNEL_INTERRUPT_FEATURE_AVAILABLE   1

APIs Supported:
void ADCx_IndividualChannelInterruptEnable (enum ADC_CHANNEL channel);
void ADCx_IndividualChannelInterruptDisable (enum ADC_CHANNEL channel);
void ADCx_IndividualChannelInterruptFlagClear (enum ADC_CHANNEL channel);

x denotes instance of ADC, channel denotes dedicated ADC channel. Refer to device specific datasheet to check number of cores and ADC module instance. Refer driver header file for detailed description of the APIs.

Definition at line 120 of file adc_features.h.

◆ ADC_POWER_ENABLE_FEATURE_AVAILABLE

#define ADC_POWER_ENABLE_FEATURE_AVAILABLE   1

IMPORTANT********

This file defines the ADC module feature C-macros available on the selected device. The macros defined in this file provides the flexibility to easily migrate the user application to other device which might have varied feature list.

The file has to be manually included in main.c, if the user intends to migrate the application to another device which might have varied feature list.

          The content in this file is strictly "read only" and should 

not be altered. Failing to do so, the migration is not guaranteed.************* Macros defined for features supported in the device

APIs Supported:
void ADCx_CorePowerEnable (enum ADC_CHANNEL channel);
void ADC_SharedCorePowerEnable (void);

x denotes instance of ADC in ADCx, channel denotes dedicated Core. Refer to device specific datasheet to check number of cores and ADC module instance. Refer driver header file for detailed description of the APIs.

Definition at line 89 of file adc_features.h.

Function Documentation

◆ ADC1_ChannelCallback()

void ADC1_ChannelCallback ( enum ADC_CHANNEL  channel,
uint16_t  adcVal 
)
Parameters
[in]channel- conversion completed channel
[in]adcVal- conversion result of channel
Returns
none
+ Here is the caller graph for this function:

◆ ADC1_ChannelCallbackRegister()

void ADC1_ChannelCallbackRegister ( void(*)(enum ADC_CHANNEL channel, uint16_t adcVal)  callback)
Parameters
[in]callback- Address of the callback function.
Returns
none

Definition at line 672 of file adc1.c.

+ Here is the caller graph for this function:

◆ ADC1_ChannelSelect()

static void ADC1_ChannelSelect ( enum ADC_CHANNEL  channel)
inlinestatic
Precondition
ADC1_Initialize() function should have been called before calling this function.
Parameters
[in]channel- Channel for conversion
Returns
none

Definition at line 160 of file adc1.h.

◆ ADC1_ChannelTasks()

void ADC1_ChannelTasks ( enum ADC_CHANNEL  channel)
Precondition
ADC1_Initialize() function should have been
called before calling this function.
Parameters
[in]channel- Selected channel.
Returns
none
Note
This function has to be polled to notify channel callbacks and clear the channel interrupt flags in non-interrupt mode of ADC

◆ ADC1_CommonCallback()

void ADC1_CommonCallback ( void  )
Parameters
none
Returns
none
+ Here is the caller graph for this function:

◆ ADC1_CommonCallbackRegister()

void ADC1_CommonCallbackRegister ( void(*)(void)  callback)
Parameters
[in]callback- Address of the callback function.
Returns
none

Definition at line 561 of file adc1.c.

+ Here is the caller graph for this function:

◆ ADC1_ComparatorCallback()

void ADC1_ComparatorCallback ( enum ADC_CMP  comparator)
Parameters
[in]comparator- comparator in which compare event occurred
Returns
none
+ Here is the caller graph for this function:

◆ ADC1_ComparatorCallbackRegister()

void ADC1_ComparatorCallbackRegister ( void(*)(enum ADC_CMP comparator)  callback)
Parameters
[in]callback- Address of the callback function.
Returns
none

Definition at line 889 of file adc1.c.

+ Here is the caller graph for this function:

◆ ADC1_ConversionResultGet()

static uint16_t ADC1_ConversionResultGet ( enum ADC_CHANNEL  channel)
inlinestatic
Precondition
This inline function returns the conversion value only after the conversion is complete. Conversion completion status can be checked using ADC1_IsConversionComplete(channel) function.
Parameters
[in]channel- Selected channel
Returns
Returns the analog to digital converted value

Definition at line 178 of file adc1.h.

+ Here is the caller graph for this function:

◆ ADC1_CorePowerEnable()

void ADC1_CorePowerEnable ( enum ADC_DEDICATED_CORE  core)
Parameters
[in]core- Selected core
Returns
none

Definition at line 405 of file adc1.c.

+ Here is the caller graph for this function:

◆ ADC1_Deinitialize()

void ADC1_Deinitialize ( void  )
Parameters
none
Returns
none

Definition at line 310 of file adc1.c.

◆ ADC1_Disable()

static void ADC1_Disable ( void  )
inlinestatic
Precondition
ADC1_Initialize function should have been called before calling this function.
Parameters
none
Returns
none

Definition at line 121 of file adc1.h.

◆ ADC1_Enable()

static void ADC1_Enable ( void  )
inlinestatic
Precondition
ADC1_Initialize function should have been called before calling this function.
Parameters
none
Returns
none

Definition at line 108 of file adc1.h.

◆ ADC1_IndividualChannelInterruptDisable()

static void ADC1_IndividualChannelInterruptDisable ( enum ADC_CHANNEL  channel)
inlinestatic
Parameters
[in]channel- Selected channel
Returns
none

Definition at line 396 of file adc1.h.

◆ ADC1_IndividualChannelInterruptEnable()

static void ADC1_IndividualChannelInterruptEnable ( enum ADC_CHANNEL  channel)
inlinestatic
Parameters
[in]channel- Selected channel
Returns
none

Definition at line 353 of file adc1.h.

◆ ADC1_IndividualChannelInterruptFlagClear()

static void ADC1_IndividualChannelInterruptFlagClear ( enum ADC_CHANNEL  channel)
inlinestatic
Parameters
[in]channel- Selected channel
Returns
none

Definition at line 439 of file adc1.h.

◆ ADC1_IndividualChannelInterruptPrioritySet()

static void ADC1_IndividualChannelInterruptPrioritySet ( enum ADC_CHANNEL  channel,
enum INTERRUPT_PRIORITY  priorityValue 
)
inlinestatic
Parameters
[in]channel- Selected channel
[in]priorityValue- The numerical value of interrupt priority
Returns
none

Definition at line 476 of file adc1.h.

◆ ADC1_Initialize()

void ADC1_Initialize ( void  )
Parameters
none
Returns
none

Definition at line 113 of file adc1.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ADC1_InterruptDisable()

static void ADC1_InterruptDisable ( void  )
inlinestatic
Parameters
none
Returns
none

Definition at line 288 of file adc1.h.

◆ ADC1_InterruptEnable()

static void ADC1_InterruptEnable ( void  )
inlinestatic
Parameters
none
Returns
none

Definition at line 277 of file adc1.h.

◆ ADC1_InterruptFlagClear()

static void ADC1_InterruptFlagClear ( void  )
inlinestatic
Parameters
none
Returns
none

Definition at line 299 of file adc1.h.

◆ ADC1_InterruptPrioritySet()

static void ADC1_InterruptPrioritySet ( uint16_t  priorityValue)
inlinestatic
Parameters
[in]priorityValue- The numerical value of interrupt priority
Returns
none

Definition at line 310 of file adc1.h.

◆ ADC1_IsConversionComplete()

static bool ADC1_IsConversionComplete ( enum ADC_CHANNEL  channel)
inlinestatic
Precondition
ADC1_SoftwareTriggerEnable() function should have been called before calling this function.
Parameters
[in]channel- Selected channel
Returns
true - Conversion is complete.
false - Conversion is not complete.

Definition at line 223 of file adc1.h.

+ Here is the caller graph for this function:

◆ ADC1_PWMTriggerSourceSet()

void ADC1_PWMTriggerSourceSet ( enum ADC_CHANNEL  channel,
enum ADC_PWM_INSTANCE  pwmInstance,
enum ADC_PWM_TRIGGERS  triggerNumber 
)
Parameters
[in]channel- Selected channel
[in]pwmInstance- PWM instance for the trigger source
[in]triggerNumber- 1, for PWMx Trigger 1
[in]triggerNumber- 2, for PWMx Trigger 2
Returns
none
Note
Configure PWM trigger value using PWM_TriggerACompareValueSet, PWM_TriggerBCompareValueSet or PWM_TriggerCCompareValueSet before calling this funcion and enable corresponding PWM trigger using PWM_Trigger1Enable or PWM_Trigger2Enable post calling it.

Definition at line 529 of file adc1.c.

+ Here is the call graph for this function:

◆ ADC1_ResolutionSet()

static void ADC1_ResolutionSet ( enum ADC_RESOLUTION_TYPE  resolution)
inlinestatic
Parameters
[in]resolution- Resolution type
Returns
none

Definition at line 264 of file adc1.h.

◆ ADC1_SharedCorePowerEnable()

void ADC1_SharedCorePowerEnable ( void  )
Parameters
none
Returns
none

Definition at line 429 of file adc1.c.

+ Here is the caller graph for this function:

◆ ADC1_SoftwareTriggerDisable()

static void ADC1_SoftwareTriggerDisable ( void  )
inlinestatic
Precondition
ADC1_Initialize function should have been called before calling this function.
Parameters
none
Returns
none

Definition at line 147 of file adc1.h.

◆ ADC1_SoftwareTriggerEnable()

static void ADC1_SoftwareTriggerEnable ( void  )
inlinestatic
Precondition
ADC1_Initialize function should have been called before calling this function.
Parameters
none
Returns
none

Definition at line 134 of file adc1.h.

+ Here is the caller graph for this function:

◆ ADC1_Tasks()

void ADC1_Tasks ( void  )
Precondition
ADC1_Initialize() function should have been called before calling this function.
Parameters
none
Returns
none
Note
This function has to be polled to notify callbacks and clear the interrupt flags in non-interrupt mode of ADC

Variable Documentation

◆ ADC1

const struct ADC_INTERFACE ADC1
extern

Definition at line 91 of file adc1.c.