170 #if defined (__cplusplus)
206 uint32_t tmp = (uint32_t)baseAddr->
SC2;
209 return (tmp != 0u) ?
true :
false;
229 uint32_t tmp = baseAddr->
CFG1;
253 uint32_t tmp = baseAddr->
CFG1;
256 baseAddr->
CFG1 = tmp;
274 uint32_t tmp = baseAddr->
CFG2;
277 return (uint8_t)(tmp);
298 uint8_t rsampletime = (uint8_t)((sampletime > 0U) ? sampletime : 1U);
299 uint32_t tmp = baseAddr->
CFG2;
302 baseAddr->
CFG2 = tmp;
321 uint32_t tmp = baseAddr->
CFG1;
360 uint32_t tmp = baseAddr->
CFG1;
363 baseAddr->
CFG1 = tmp;
383 uint32_t tmp = baseAddr->
CFG1;
408 uint32_t tmp = baseAddr->
CFG1;
411 baseAddr->
CFG1 = tmp;
433 uint32_t tmp = baseAddr->
SC2;
459 uint32_t tmp = baseAddr->
SC2;
479 uint32_t tmp = (uint32_t)baseAddr->
SC2;
482 return (tmp != 0u) ?
true :
false;
500 uint32_t tmp = (uint32_t)baseAddr->
SC2;
503 baseAddr->
SC2 = (uint32_t)tmp;
522 uint32_t tmp = baseAddr->
SC2;
546 uint32_t tmp = baseAddr->
SC2;
568 uint32_t tmp = (uint32_t)baseAddr->
SC3;
571 return (tmp != 0u) ?
true :
false;
591 uint32_t tmp = (uint32_t)baseAddr->
SC3;
594 tmp |=
ADC_SC3_ADCO(state ? (uint32_t)1u : (uint32_t)0u);
595 baseAddr->
SC3 = (uint32_t)tmp;
620 uint32_t tmp = (uint32_t)baseAddr->
SC2;
623 return (tmp != 0u) ?
true :
false;
641 uint32_t tmp = (uint32_t)baseAddr->
SC2;
643 tmp |=
ADC_SC2_ACFE(state ? (uint32_t)1u : (uint32_t)0u);
644 baseAddr->
SC2 = (uint32_t)tmp;
662 uint32_t tmp = (uint32_t)baseAddr->
SC2;
665 return (tmp != 0u) ?
true :
false;
684 uint32_t tmp = (uint32_t)baseAddr->
SC2;
687 baseAddr->
SC2 = (uint32_t)tmp;
705 uint32_t tmp = (uint32_t)baseAddr->
SC2;
708 return (tmp != 0u) ?
true :
false;
727 uint32_t tmp = (uint32_t)baseAddr->
SC2;
730 baseAddr->
SC2 = (uint32_t)tmp;
749 return (uint16_t)baseAddr->
CV[0U];
767 const uint16_t value)
788 return (uint16_t)baseAddr->
CV[1U];
806 const uint16_t value)
834 uint32_t tmp = (uint32_t)baseAddr->
SC3;
837 return (tmp != 0u) ?
true :
false;
855 uint32_t tmp = baseAddr->
SC3;
858 tmp |=
ADC_SC3_AVGE(state ? (uint32_t)1u : (uint32_t)0u);
880 uint32_t tmp = baseAddr->
SC3;
906 uint32_t tmp = baseAddr->
SC3;
935 uint32_t tmp = (uint32_t)baseAddr->
SC3;
938 return (tmp != 0u) ?
true :
false;
956 uint32_t tmp = baseAddr->
SC3;
958 tmp |=
ADC_SC3_CAL(state ? (uint32_t)1u : (uint32_t)0u);
977 uint32_t tmp = baseAddr->
UG;
980 return (uint16_t)tmp;
996 const uint16_t value)
998 uint16_t clp0 = (uint16_t)baseAddr->
CLP0;
999 uint16_t clp1 = (uint16_t)baseAddr->
CLP1;
1000 uint16_t clp2 = (uint16_t)baseAddr->
CLP2;
1001 uint16_t clp3 = (uint16_t)baseAddr->
CLP3;
1002 uint16_t clps = (uint16_t)baseAddr->
CLPS;
1004 uint16_t sum = (uint16_t)(value + clp0 + clp1 + clp2 + clp3 + clps);
1006 uint16_t temp = (uint16_t)(sum & 0xF800U);
1007 if (temp != 0x0000U)
1012 baseAddr->
UG = (uint32_t)value;
1013 baseAddr->
G = (uint32_t)temp;
1032 uint32_t tmp = baseAddr->
USR_OFS;
1035 return (uint16_t)tmp;
1053 const uint16_t value)
1080 const uint8_t chanIndex)
1082 uint32_t tmp = (uint32_t)baseAddr->
SC1[chanIndex];
1085 return (tmp != 0u) ?
true :
false;
1103 const uint8_t chanIndex,
1106 uint32_t tmp = baseAddr->
SC1[chanIndex];
1108 tmp |=
ADC_SC1_AIEN(state ? (uint32_t)1u : (uint32_t)0u);
1110 baseAddr->
SC1[chanIndex] = tmp;
1147 const uint8_t chanIndex)
1149 uint32_t tmp = baseAddr->
SC1[chanIndex];
1191 const uint8_t chanIndex,
1194 uint32_t tmp = baseAddr->
SC1[chanIndex];
1197 baseAddr->
SC1[chanIndex] = tmp;
1215 const uint8_t chanIndex)
1217 uint32_t tmp = baseAddr->
SC1[chanIndex];
1220 return (tmp != 0u) ?
true :
false;
1237 const uint8_t chanIndex)
1239 uint32_t tmp = baseAddr->
R[chanIndex];
1242 return (uint16_t)tmp;
1280 uint32_t tmp = baseAddr->
SC2;
1312 uint32_t tmp = baseAddr->
SC2;
1330 uint32_t tmp = baseAddr->
SC2;
1338 #if defined (__cplusplus)
static void ADC_HAL_SetContinuousConvFlag(ADC_Type *const baseAddr, const bool state)
Sets the Continuous Conversion Flag state.
#define ADC_SC1_COCO_SHIFT
#define ADC_SC3_AVGS_SHIFT
static bool ADC_HAL_GetHwAverageEnableFlag(const ADC_Type *const baseAddr)
Gets the Hardware Average Enable Flag state.
#define ADC_USR_OFS_USR_OFS(x)
static uint16_t ADC_HAL_GetChanResult(const ADC_Type *const baseAddr, const uint8_t chanIndex)
Gets the conversion result for the selected measurement channel.
#define ADC_CFG1_ADICLK_SHIFT
static void ADC_HAL_SetChanInterruptEnableFlag(ADC_Type *const baseAddr, const uint8_t chanIndex, const bool state)
Sets the Channel Interrupt Enable to a new state.
#define ADC_CFG1_MODE_MASK
static void ADC_HAL_SetSampleTime(ADC_Type *const baseAddr, uint8_t sampletime)
Sets the Sample time in AD clock cycles.
static bool ADC_HAL_GetHwCompareGtEnableFlag(const ADC_Type *const baseAddr)
Gets the Hardware Compare Greater Than Enable Flag state.
adc_input_clock_t
Input clock source selection Implements : adc_input_clock_t_Class.
#define ADC_SC2_ADACT_MASK
adc_clk_divide_t
Clock Divider selection Implements : adc_clk_divide_t_Class.
#define ADC_SC2_REFSEL(x)
#define ADC_SC2_ACREN_SHIFT
adc_inputchannel_t
Input channel selection Implements : adc_inputchannel_t_Class.
static void ADC_HAL_SetUserOffsetValue(ADC_Type *const baseAddr, const uint16_t value)
Sets the User Offset Register value.
static adc_trigger_t ADC_HAL_GetTriggerMode(const ADC_Type *const baseAddr)
Gets the ADC Trigger Mode.
static bool ADC_HAL_GetConvActiveFlag(const ADC_Type *const baseAddr)
Gets the Conversion Active Flag.
static uint16_t ADC_HAL_GetHwCompareComp2Value(const ADC_Type *const baseAddr)
Gets the Compare Register 2 value.
#define ADC_SC3_AVGS_MASK
static void ADC_HAL_SetInputClock(ADC_Type *const baseAddr, const adc_input_clock_t inputClock)
Sets the AD Clock Input configuration.
static void ADC_HAL_SetCalibrationActiveFlag(ADC_Type *const baseAddr, const bool state)
Sets the Calibration Active Flag state.
#define ADC_CFG2_SMPLTS(x)
static void ADC_HAL_SetClockDivide(ADC_Type *const baseAddr, const adc_clk_divide_t clockDivide)
Sets the ADC clock divider configuration.
adc_resolution_t
Conversion resolution selection Implements : adc_resolution_t_Class.
#define ADC_SC2_ACFGT_MASK
#define ADC_SC2_TRGPRNUM_SHIFT
#define ADC_SC2_DMAEN_MASK
#define ADC_SC2_REFSEL_SHIFT
static bool ADC_HAL_GetContinuousConvFlag(const ADC_Type *const baseAddr)
Gets the Continuous Conversion Flag state.
#define ADC_SC2_ADACT_SHIFT
#define ADC_USR_OFS_USR_OFS_SHIFT
#define ADC_CFG1_ADIV_MASK
static uint16_t ADC_HAL_GetUserGainValue(const ADC_Type *const baseAddr)
Gets the User Gain Register value.
#define ADC_SC2_ADTRG_SHIFT
#define ADC_SC2_TRGPRNUM_MASK
#define ADC_SC2_TRGSTERR_MASK
static void ADC_HAL_ClearLatchTriggers(ADC_Type *const baseAddr)
Clear the latched triggers.
#define ADC_SC2_DMAEN_SHIFT
__I uint32_t R[ADC_R_COUNT]
static bool ADC_HAL_GetHwCompareRangeEnableFlag(const ADC_Type *const baseAddr)
Gets the Hardware Compare Range Enable state.
#define ADC_SC3_ADCO_MASK
static void ADC_HAL_SetUserGainValue(ADC_Type *const baseAddr, const uint16_t value)
Sets the User Gain Register value.
#define ADC_SC2_REFSEL_MASK
#define ADC_CFG1_ADICLK(x)
#define ADC_SC3_AVGE_SHIFT
static void ADC_HAL_SetHwAverageEnableFlag(ADC_Type *const baseAddr, const bool state)
Sets the Hardware Average Enable Flag state.
#define ADC_SC3_ADCO_SHIFT
static uint32_t ADC_HAL_GetTriggerLatchFlags(const ADC_Type *const baseAddr)
Get the trigger latch flags bits.
#define ADC_SC1_ADCH_MASK
static adc_inputchannel_t ADC_HAL_GetInputChannel(const ADC_Type *const baseAddr, const uint8_t chanIndex)
Gets the configured input channel for the selected measurement channel.
static void ADC_HAL_SetResolution(ADC_Type *const baseAddr, const adc_resolution_t resolution)
Sets the Resolution Mode configuration.
#define ADC_SC1_ADCH_SHIFT
static void ADC_HAL_SetHwCompareComp1Value(ADC_Type *const baseAddr, const uint16_t value)
Sets the Compare Register 1 value.
__IO uint32_t CV[ADC_CV_COUNT]
#define ADC_SC2_ADTRG_MASK
static uint32_t ADC_HAL_GetTriggerErrorFlags(const ADC_Type *const baseAddr)
Get the trigger latch error flags.
static void ADC_HAL_ClearTriggerErrorFlags(ADC_Type *const baseAddr)
Clear the latch trigger error flags.
#define ADC_CFG1_CLRLTRG(x)
void ADC_HAL_Init(ADC_Type *const baseAddr)
Initializes the ADC instance to reset values.
#define ADC_SC2_ACFGT_SHIFT
#define ADC_CFG1_MODE_SHIFT
adc_average_t
Hardware average selection Implements : adc_average_t_Class.
#define ADC_SC2_ACREN_MASK
static void ADC_HAL_SetHwCompareGtEnableFlag(ADC_Type *const baseAddr, const bool state)
Sets the Hardware Compare Greater Than Enable Flag state.
#define ADC_SC3_CAL_SHIFT
static void ADC_HAL_SetInputChannel(ADC_Type *const baseAddr, const uint8_t chanIndex, const adc_inputchannel_t inputChan)
Sets the input channel configuration for the measurement channel.
#define ADC_SC2_TRGSTLAT_SHIFT
static adc_clk_divide_t ADC_HAL_GetClockDivide(const ADC_Type *const baseAddr)
Gets the current ADC clock divider configuration.
#define ADC_SC2_ACFE_MASK
static bool ADC_HAL_GetDMAEnableFlag(const ADC_Type *const baseAddr)
Gets the DMA Enable Flag state.
static adc_average_t ADC_HAL_GetHwAverageMode(const ADC_Type *const baseAddr)
Gets the Hardware Average Mode.
#define ADC_USR_OFS_USR_OFS_MASK
static uint16_t ADC_HAL_GetUserOffsetValue(const ADC_Type *const baseAddr)
Gets the User Offset Register value.
static void ADC_HAL_SetTriggerMode(ADC_Type *const baseAddr, const adc_trigger_t trigger)
Sets the ADC Trigger Mode.
adc_trigger_t
Trigger type selection Implements : adc_trigger_t_Class.
#define ADC_SC1_AIEN_MASK
static void ADC_HAL_SetHwCompareEnableFlag(ADC_Type *const baseAddr, const bool state)
Sets the Hardware Compare Enable Flag state.
static void ADC_HAL_SetHwCompareRangeEnableFlag(ADC_Type *const baseAddr, const bool state)
Sets the Hardware Compare Range Enable state.
__IO uint32_t SC1[ADC_SC1_COUNT]
static adc_voltage_reference_t ADC_HAL_GetVoltageReference(const ADC_Type *const baseAddr)
Gets the ADC Reference Voltage selection.
static void ADC_HAL_SetHwCompareComp2Value(ADC_Type *const baseAddr, const uint16_t value)
Sets the Compare Register 2 value.
#define ADC_SC2_ACFE_SHIFT
#define ADC_SC2_TRGSTERR_SHIFT
#define ADC_CFG1_ADICLK_MASK
static uint16_t ADC_HAL_GetHwCompareComp1Value(const ADC_Type *const baseAddr)
Gets the Compare Register 1 value.
static uint32_t ADC_HAL_GetTriggerProcNumber(const ADC_Type *const baseAddr)
Get the index of the trigger under process.
static void ADC_HAL_SetVoltageReference(ADC_Type *const baseAddr, const adc_voltage_reference_t voltageRef)
Sets the ADC Reference Voltage selection.
static adc_resolution_t ADC_HAL_GetResolution(const ADC_Type *const baseAddr)
Gets the Resolution Mode configuration.
#define ADC_SC1_COCO_MASK
#define ADC_CFG2_SMPLTS_SHIFT
static adc_input_clock_t ADC_HAL_GetInputClock(const ADC_Type *const baseAddr)
Gets the AD Clock Input configuration.
static bool ADC_HAL_GetConvCompleteFlag(const ADC_Type *const baseAddr, const uint8_t chanIndex)
Gets the measurement channel Conversion Complete Flag state.
#define ADC_SC1_AIEN_SHIFT
#define ADC_SC2_TRGSTERR(x)
static void ADC_HAL_SetDMAEnableFlag(ADC_Type *const baseAddr, const bool state)
Sets the DMA Enable Flag state.
static uint8_t ADC_HAL_GetSampleTime(const ADC_Type *const baseAddr)
Gets the Sample time in AD clock cycles.
static void ADC_HAL_SetHwAverageMode(ADC_Type *const baseAddr, const adc_average_t averageMode)
Sets the Hardware Average Mode.
#define ADC_CFG2_SMPLTS_MASK
static bool ADC_HAL_GetChanInterruptEnableFlag(const ADC_Type *const baseAddr, const uint8_t chanIndex)
Gets the Channel Interrupt Enable state.
adc_voltage_reference_t
Voltage reference selection Implements : adc_voltage_reference_t_Class.
#define ADC_CFG1_ADIV_SHIFT
#define ADC_SC3_AVGE_MASK
static bool ADC_HAL_GetCalibrationActiveFlag(const ADC_Type *const baseAddr)
Gets the Calibration Active Flag state.
static bool ADC_HAL_GetHwCompareEnableFlag(const ADC_Type *const baseAddr)
Gets the Hardware Compare Enable Flag state.
#define ADC_SC2_TRGSTLAT_MASK