66 #define COMMEN_MODE_CYCLES 16 83 #define ADC_Enable(_adc) ((_adc)->CTRLA |= ADC_ENABLE_bm) 89 #define ADC_Disable(_adc) ((_adc)->CTRLA = (_adc)->CTRLA & (~ADC_ENABLE_bm)) 95 #define ADC_Pipeline_Flush(_adc) ((_adc)->CTRLA |= ADC_FLUSH_bm) 110 #define ADC_ConvMode_and_Resolution_Config(_adc, _signedMode, _resolution) \ 111 ((_adc)->CTRLB = ((_adc)->CTRLB & (~(ADC_RESOLUTION_gm|ADC_CONMODE_bm)))| \ 112 (_resolution| ( _signedMode? ADC_CONMODE_bm : 0))) 127 #define ADC_Prescaler_Config(_adc, _div) \ 128 ((_adc)->PRESCALER = ((_adc)->PRESCALER & (~ADC_PRESCALER_gm)) | _div) 137 #define ADC_Referance_Config(_adc, _convRef) \ 138 ((_adc)->REFCTRL = ((_adc)->REFCTRL & ~(ADC_REFSEL_gm)) | _convRef) 146 #define ADC_SweepChannels_Config(_adc, _sweepChannels) \ 147 ((_adc)->EVCTRL = ((_adc)->EVCTRL & (~ADC_SWEEP_gm)) | _sweepChannels) 163 #define ADC_Events_Config(_adc, _eventChannels, _eventMode) \ \ 164 (_adc)->EVCTRL = ((_adc)->EVCTRL & (~(ADC_EVSEL_gm | ADC_EVACT_gm))) | \ 165 ((uint8_t) _eventChannels | _eventMode) 182 #define ADC_Ch_Interrupts_Config(_adc_ch, _interruptMode, _interruptLevel) \ 183 (_adc_ch)->INTCTRL = (((_adc_ch)->INTCTRL & \ 184 (~(ADC_CH_INTMODE_gm | ADC_CH_INTLVL_gm))) | \ 185 ((uint8_t) _interruptMode | _interruptLevel)) 197 #define ADC_Ch_InputMode_and_Gain_Config(_adc_ch, _inputMode, _gain) \ 198 (_adc_ch)->CTRL = ((_adc_ch)->CTRL & \ 199 (~(ADC_CH_INPUTMODE_gm|ADC_CH_GAINFAC_gm))) | \ 200 ((uint8_t) _inputMode|_gain) 212 #define ADC_Ch_InputMux_Config(_adc_ch, _posInput, _negInput) \ 213 ((_adc_ch)->MUXCTRL = (uint8_t) _posInput | _negInput) 222 #define ADC_Ch_Conversion_Complete(_adc_ch) \ 223 (((_adc_ch)->INTFLAGS & ADC_CH_CHIF_bm) != 0x00) 239 #define ADC_CompareValue_Set(_adc, _value) ((_adc)->CMP = _value) 246 #define ADC_FreeRunning_Enable(_adc) ((_adc)->CTRLB |= ADC_FREERUN_bm) 253 #define ADC_FreeRunning_Disable(_adc) \ 254 ((_adc)->CTRLB = (_adc)->CTRLB & (~ADC_FREERUN_bm)) 265 #define ADC_Ch_Conversion_Start(_adc_ch) ((_adc_ch)->CTRL |= ADC_CH_START_bm) 279 #define ADC_Conversions_Start(_adc, _channelMask) \ 280 (_adc)->CTRLA |= _channelMask & \ 281 (ADC_CH0START_bm | ADC_CH1START_bm | \ 282 ADC_CH2START_bm | ADC_CH3START_bm) 291 #define ADC_BandgapReference_Enable(_adc) ((_adc)->REFCTRL |= ADC_BANDGAP_bm) 298 #define ADC_BandgapReference_Disable(_adc) ((_adc)->REFCTRL &= ~ADC_BANDGAP_bm) 307 #define ADC_TempReference_Enable(_adc) ((_adc)->REFCTRL |= ADC_TEMPREF_bm) 314 #define ADC_TempReference_Disable(_adc) \ 315 ((_adc)->REFCTRL = (_adc)->REFCTRL & (~ADC_TEMPREF_bm)) uint8_t ADC_ResultCh_GetLowByte(ADC_CH_t *adc_ch, uint8_t offset)
This function clears the interrupt flag and returns the low byte of the coversion result...
uint16_t ADC_ResultCh_GetWord(ADC_CH_t *adc_ch, uint8_t offset)
This function clears the interrupt flag and returns the coversion result.
uint8_t ADC_Offset_Get(ADC_t *adc)
This function get the offset of the ADC.
This file implements some macros that makes the IAR C-compiler and avr-gcc work with the same code ba...
void ADC_CalibrationValues_Set(ADC_t *adc)
This function get the calibration data from the production calibration.
uint8_t ADC_ResultCh_GetHighByte(ADC_CH_t *adc_ch)
This function clears the interrupt flag and returns the high byte of the coversion result...
uint8_t SP_ReadCalibrationByte(uint8_t index)
void ADC_Wait_8MHz(ADC_t *adc)
This function waits until the adc common mode is settled.
void ADC_Wait_32MHz(ADC_t *adc)
This function waits until the adc common mode is settled.