BLDC control on ATAVRMC303 with ATxMega128A1
adc_drv.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define Adc_get_10_bits_result()   ((U16)(ADCL+((U16)(ADCH<<8))))
 
#define Adc_get_8_bits_result()   ((U8)(ADCH))
 
#define ADHSM   7
 
#define Clear_adc_flag()   (ADCSRA &= (1<<ADIF) )
 
#define Clear_adc_mux()   (ADMUX &= ~((1<<MUX3)|(1<<MUX2)|(1<<MUX1)|(1<<MUX0)) )
 
#define Clear_sleep_mode()   (SMCR &= ~(1<<SM0)|(1<<SE) )
 
#define Disable_adc()   (ADCB.CTRLA &= ~ADC_ENABLE_bm)
 
#define Disable_adc_high_speed_mode()   (ADCSRB &= ~(1<<ADHSM))
 
#define Disable_adc_it()   (ADCSRA &= ~(1<<ADIE) )
 
#define Disable_all_it()   (SREG &= ~(0x80) )
 
#define Enable_adc()   (ADCB.CTRLB |= ADC_ENABLE_bm)
 
#define Enable_adc_high_speed_mode()   (ADCSRB |= (1<<ADHSM))
 
#define Enable_adc_it()   (ADCSRA |= (1<<ADIE) )
 
#define Enable_all_it()   (SREG |= (0x80) )
 
#define Enable_external_vref()   (ADCB.REFCTRL = ADC_REFSEL_EXT_gc)
 
#define Enable_internal_vref()   (ADCB.REFCTRL = ADC_REFSEL_INT1V_gc)
 
#define Enable_internal_vref_decoupled()   (ADCB.REFCTRL = ADC_REFSEL_INT1VDECOUPLED_gc)
 
#define Enable_vcc_vref()   (ADCB.REFCTRL = ADC_REFSEL_INTVCC_gc)
 
#define Enable_vcc_vref_decoupled()   (ADCB.REFCTRL = ADC_REFSEL_INTVCCDECOUPLED_gc)
 
#define Is_adc_conv_finished()   (ADCB.INTFLAGS & ADC_CH0IF_bm)
 
#define Is_adc_conv_not_finished()   (ADCB.INTFLAGS & ADC_CH0IF_bm)) ? FALSE : TRUE )
 
#define Left_adjust_adc_result()   (ADCB.CTRLA |= ADC_RESOLUTION_LEFT12BIT_gc)
 
#define Right_adjust_adc_result()   (ADCB.CTRLA = ((ADCB.CTRLA & ~ ADC_RESOLUTION_LEFT12BIT_gc) | ADC_RESOLUTION_12BIT_gc))
 
#define Select_adc_channel(channel)   (Clear_adc_mux(), ADMUX |= (channel) )
 
#define Set_prescaler(prescaler)
 
#define Start_amplified_conv()   (ADCSRB |= (1<<ADASCR) )
 
#define Start_amplified_conv_channel(channel)   (Select_adc_channel(channel), Start_amplified_conv() )
 
#define Start_conv()   (ADCB.CTRLB |= ADC_CH0START_bm)
 
#define Start_conv_channel(channel)   (Select_adc_channel(channel), Start_conv() )
 
#define Start_conv_idle()   (SMCR |= (1<<SM0)|(1<<SE) )
 
#define Start_conv_idle_channel(channel)   (Select_adc_channel(channel), Start_conv_idle() )
 
#define Stop_amplified_conv()   (ADCSRB &= ~(1<<ADASCR) )
 

Functions

void init_adc (void)
 Configures the ADC accordingly to the ADC Define Configuration values. More...
 

Macro Definition Documentation

◆ ADHSM

#define ADHSM   7

Definition at line 20 of file adc_drv.h.