High-Speed, 12-Bit Multiple SARs Analog-to-Digital Converter driver using dsPIC MCUs. More...
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. | |
Enumerations | |
enum | ADC_CHANNEL { FB_Vout , FB_AC_N , IL1_F , IL2_F , MAX_CHANNELS = 4 , ADC_MAX_CHANNELS = 4 } |
Defines the ADC channles that are selected from the MCC Melody User Interface for the ADC conversions. More... | |
enum | ADC_DEDICATED_CORE { CORE_0 = 0 , ADC_CORE_0 = 0 , CORE_1 = 1 , ADC_CORE_1 = 1 , MAX_DEDICATED_CORES = 2 , ADC_MAX_DEDICATED_CORES = 2 } |
Defines the ADC cores that are available for the module to use. More... | |
enum | ADC_RESOLUTION_TYPE { ADC_6_BIT_RESOLUTION = 0x0 , ADC_8_BIT_RESOLUTION = 0x1 , ADC_10_BIT_RESOLUTION = 0x2 , ADC_12_BIT_RESOLUTION = 0x3 } |
Defines the supported ADC resolution types. More... | |
enum | ADC_CMP { MAX_CMPS = 0 , ADC_MAX_CMPS = 0 } |
Defines the ADC comparators that are available for the module to use. More... | |
enum | ADC_PWM_INSTANCE { ADC_PWM_HS_NOT_AVAILABLE } |
Defines the ADC PWM trigger sources that are available for the module to use. More... | |
enum | ADC_PWM_TRIGGERS { ADC_PWM_TRIGGERS_NOT_AVAILABLE } |
Defines the PWM triggers that are available in each individual PWM. More... | |
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. | |
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. | |
#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 105 of file adc_features.h.
#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 140 of file adc_features.h.
#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 121 of file adc_features.h.
#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 90 of file adc_features.h.
enum ADC_CHANNEL |
Definition at line 55 of file adc_types.h.
enum ADC_CMP |
Enumerator | |
---|---|
MAX_CMPS | MAX_CMPS will be removed in future MCC releases. Use ADC_MAX_CMPS instead |
ADC_MAX_CMPS | Maximum Comparators configured by user in MCC Melody User Interface |
Definition at line 104 of file adc_types.h.
enum ADC_DEDICATED_CORE |
Definition at line 75 of file adc_types.h.
enum ADC_PWM_INSTANCE |
Enumerator | |
---|---|
ADC_PWM_HS_NOT_AVAILABLE | PWM HS not available |
Definition at line 117 of file adc_types.h.
enum ADC_PWM_TRIGGERS |
Enumerator | |
---|---|
ADC_PWM_TRIGGERS_NOT_AVAILABLE | PWM HS triggers available |
Definition at line 127 of file adc_types.h.
enum ADC_RESOLUTION_TYPE |
Enumerator | |
---|---|
ADC_6_BIT_RESOLUTION | ADC Resolution of 6 bit |
ADC_8_BIT_RESOLUTION | ADC Resolution of 8 bit |
ADC_10_BIT_RESOLUTION | ADC Resolution of 10 bit |
ADC_12_BIT_RESOLUTION | ADC Resolution of 12 bit |
Definition at line 90 of file adc_types.h.
void ADC1_ChannelCallback | ( | enum ADC_CHANNEL | channel, |
uint16_t | adcVal ) |
void ADC1_ChannelCallbackRegister | ( | void(*)(enum ADC_CHANNEL channel, uint16_t adcVal) | callback | ) |
|
inlinestatic |
[in] | channel | - Channel for conversion |
void ADC1_ChannelTasks | ( | enum ADC_CHANNEL | channel | ) |
[in] | channel | - Selected channel. |
void ADC1_CommonCallback | ( | void | ) |
void ADC1_CommonCallbackRegister | ( | void(*)(void) | callback | ) |
void ADC1_ComparatorCallback | ( | enum ADC_CMP | comparator | ) |
void ADC1_ComparatorCallbackRegister | ( | void(*)(enum ADC_CMP comparator) | callback | ) |
|
inlinestatic |
[in] | channel | - Selected channel |
void ADC1_CorePowerEnable | ( | enum ADC_DEDICATED_CORE | core | ) |
|
inlinestatic |
none |
|
inlinestatic |
none |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
void ADC1_Initialize | ( | void | ) |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
[in] | channel | - Selected channel |
|
inlinestatic |
void ADC1_SharedCorePowerEnable | ( | void | ) |
|
inlinestatic |
|
inlinestatic |
none |
void ADC1_Tasks | ( | void | ) |
none |
|
extern |