47#include "adc_interface.h"
60#define ADC1_SCAN_MODE_SELECTED true
66#define ADC1_RESOLUTION 12
110 ADCON1Lbits.ADON = 1;
123 ADCON1Lbits.ADON = 0;
136 ADCON3Lbits.SWCTRG = 1;
149 ADCON3Lbits.SWCTRG = 0;
180 uint16_t result = 0x0U;
233 status = ADSTATLbits.AN2RDY;
236 status = ADSTATLbits.AN9RDY;
239 status = ADSTATLbits.AN10RDY;
242 status = ADSTATLbits.AN14RDY;
245 status = ADSTATLbits.AN15RDY;
248 status = ADSTATHbits.AN19RDY;
251 status = ADSTATLbits.AN0RDY;
254 status = ADSTATLbits.AN1RDY;
272 ADCORE0Hbits.RES = resolution;
273 ADCORE1Hbits.RES = resolution;
274 ADCON1Hbits.SHRRES = resolution;
318 IPC22bits.ADCIP = (uint16_t)0x7 & priorityValue;
364 IEC5bits.ADCAN2IE = 1;
368 IEC6bits.ADCAN9IE = 1;
372 IEC6bits.ADCAN10IE = 1;
376 IEC6bits.ADCAN14IE = 1;
380 IEC6bits.ADCAN15IE = 1;
384 IEC6bits.ADCAN19IE = 1;
388 IEC5bits.ADCAN0IE = 1;
392 IEC5bits.ADCAN1IE = 1;
411 IEC5bits.ADCAN2IE = 0;
415 IEC6bits.ADCAN9IE = 0;
419 IEC6bits.ADCAN10IE = 0;
423 IEC6bits.ADCAN14IE = 0;
427 IEC6bits.ADCAN15IE = 0;
431 IEC6bits.ADCAN19IE = 0;
435 IEC5bits.ADCAN0IE = 0;
439 IEC5bits.ADCAN1IE = 0;
458 IFS5bits.ADCAN2IF = 0;
461 IFS6bits.ADCAN9IF = 0;
464 IFS6bits.ADCAN10IF = 0;
467 IFS6bits.ADCAN14IF = 0;
470 IFS6bits.ADCAN15IF = 0;
473 IFS6bits.ADCAN19IF = 0;
476 IFS5bits.ADCAN0IF = 0;
479 IFS5bits.ADCAN1IF = 0;
498 IPC23bits.ADCAN2IP = priorityValue;
501 IPC25bits.ADCAN9IP = priorityValue;
504 IPC25bits.ADCAN10IP = priorityValue;
507 IPC26bits.ADCAN14IP = priorityValue;
510 IPC26bits.ADCAN15IP = priorityValue;
513 IPC27bits.ADCAN19IP = priorityValue;
516 IPC22bits.ADCAN0IP = priorityValue;
519 IPC23bits.ADCAN1IP = priorityValue;
This is the generated driver types header file for the ADC driver.
static bool ADC1_IsConversionComplete(enum ADC_CHANNEL channel)
This inline function returns the status of conversion.This function is used to determine if conversio...
static void ADC1_InterruptFlagClear(void)
Clears interrupt flag manually.
ADC_RESOLUTION_TYPE
Defines the supported ADC resolution types.
ADC_PWM_TRIGGERS
Defines the PWM triggers that are available in each individual PWM.
void ADC1_CommonCallback(void)
This is the default callback with weak attribute. The user can override and implement the default cal...
static void ADC1_IndividualChannelInterruptPrioritySet(enum ADC_CHANNEL channel, enum INTERRUPT_PRIORITY priorityValue)
This inline function allows selection of priority for individual channel interrupt.
static void ADC1_ResolutionSet(enum ADC_RESOLUTION_TYPE resolution)
This inline function helps to configure all cores with same resolution.
static void ADC1_IndividualChannelInterruptDisable(enum ADC_CHANNEL channel)
This inline function disables individual channel interrupt.
void ADC1_ComparatorCallback(enum ADC_CMP comparator)
Comparator callback function.
void ADC1_Deinitialize(void)
Deinitializes the ADC1 to POR values.
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.
void ADC1_SharedCorePowerEnable(void)
Enables power for ADC1 shared Core This function is used to set the analog and digital power for ADC1...
static void ADC1_IndividualChannelInterruptEnable(enum ADC_CHANNEL channel)
This inline function enables individual channel interrupt.
void ADC1_Tasks(void)
This function is used to implement the tasks for polled implementations.
ADC_CMP
Defines the ADC comparators that are available for the module to use.
static void ADC1_Enable(void)
This inline function enables the ADC1 module.
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_Compara...
const struct ADC_INTERFACE ADC1
Structure object of type ADC_INTERFACE with the custom name given by the user in the Melody Driver Us...
static void ADC1_InterruptEnable(void)
This inline function enables the ADC1 interrupt.
ADC_PWM_INSTANCE
Defines the ADC PWM trigger sources that are available for the module to use.
static void ADC1_InterruptPrioritySet(uint16_t priorityValue)
This inline function allows selection of priority for interrupt.
static void ADC1_IndividualChannelInterruptFlagClear(enum ADC_CHANNEL channel)
This inline function clears individual channel interrupt flag.
void ADC1_ChannelTasks(enum ADC_CHANNEL channel)
This function call used only in polling mode, if channel conversion is done for requested channel,...
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 th...
static void ADC1_SoftwareTriggerDisable(void)
This inline function resets software common trigger.
ADC_DEDICATED_CORE
Defines the ADC cores that are available for the module to use.
static void ADC1_Disable(void)
This inline function disables the ADC1 module.
void ADC1_Initialize(void)
Initializes ADC1 module, using the given initialization data This function must be called before any ...
static void ADC1_InterruptDisable(void)
This inline function disables the ADC1 interrupt.
static void ADC1_ChannelSelect(enum ADC_CHANNEL channel)
This inline function allows selection of a channel for conversion.
static void ADC1_SoftwareTriggerEnable(void)
This inline function sets software common trigger.
ADC_CHANNEL
Defines the ADC channles that are selected from the MCC Melody User Interface for the ADC conversions...
void ADC1_CommonCallbackRegister(void(*callback)(void))
This function can be used to override default callback and to define custom callback for ADC1 Common ...
void ADC1_CorePowerEnable(enum ADC_DEDICATED_CORE core)
Enables analog and digital power for ADC1 dedicated core.
static uint16_t ADC1_ConversionResultGet(enum ADC_CHANNEL channel)
Returns the conversion value for the channel selected.
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 call...
Structure containing the function pointers of ADC driver.