Driver for the Digital to Analog Converter (DAC) Interface B.
It provides functions for configuring and using the DAC and its channels.
Modules | |
Related Project(s) | |
In this section you can find all the projects related to the DACIFB - DAC Interface B. | |
Data Structures | |
struct | dacifb_channel_opt_t |
Parameters for the configuration of the channel. More... | |
struct | dacifb_opt_t |
Parameters for the DACIFB. More... | |
Macros | |
#define | DACIFB_CHI_MIN_VALUE 500000 |
CHI Min Value of 2us. More... | |
#define | DACIFB_CHRx_MAX_VALUE 33333 |
CHRx Max Value of 35us. More... | |
#define | DACIFB_CHRx_MIN_VALUE 40000 |
CHRx Min Value of 25us. More... | |
Functions | |
bool | dacifb_check_eoc (volatile avr32_dacifb_t *dacifb, uint8_t channel) |
Check channel conversion status. More... | |
bool | dacifb_configure (volatile avr32_dacifb_t *dacifb, dacifb_opt_t *p_dacifb_opt, uint32_t pb_hz) |
Configure DACIFB. More... | |
bool | dacifb_configure_channel (volatile avr32_dacifb_t *dacifb, uint8_t channel, dacifb_channel_opt_t *p_dacifb_channel_opt, uint32_t prescaler_clock_hz) |
Configure DACIFB specific channel. More... | |
void | dacifb_get_calibration_data (volatile avr32_dacifb_t *dacifb, dacifb_opt_t *p_dacifb_opt, uint8_t instance) |
Get DACIFB Calibration Data. More... | |
void | dacifb_reload_timer (volatile avr32_dacifb_t *dacifb, uint8_t channel, uint8_t timer_us, uint32_t prescaler_clock_hz) |
Reload Timer for Automatic Trigger on DAC. More... | |
void | dacifb_set_value (volatile avr32_dacifb_t *dacifb, uint8_t channel, bool dual, uint32_t value) |
Set channel value. More... | |
void | dacifb_start_channel (volatile avr32_dacifb_t *dacifb, uint8_t channel, uint32_t cpu_hz) |
Start analog to digital conversion. More... | |
Channel Selection used by the DAC | |
#define | DACIFB_CHANNEL_SELECTION_NONE 0x0 |
#define | DACIFB_CHANNEL_SELECTION_A 0x1 |
#define | DACIFB_CHANNEL_SELECTION_B 0x2 |
#define | DACIFB_CHANNEL_SELECTION_AB 0x3 |
Reference used by the DAC | |
#define | DACIFB_REFERENCE_EXT 0x0 |
#define | DACIFB_REFERENCE_VDDANA 0x1 |
Trigger Mode used by the DAC | |
#define | DACIFB_TRIGGER_MODE_MANUAL 0x0 |
#define | DACIFB_TRIGGER_MODE_TIMER 0x1 |
#define | DACIFB_TRIGGER_MODE_EVENT 0x2 |
#define DACIFB_CHANNEL_SELECTION_A 0x1 |
Referenced by dacifb_configure_channel(), dacifb_reload_timer(), dacifb_set_value(), and dacifb_start_channel().
#define DACIFB_CHANNEL_SELECTION_AB 0x3 |
Referenced by dacifb_configure_channel(), dacifb_reload_timer(), dacifb_set_value(), and dacifb_start_channel().
#define DACIFB_CHANNEL_SELECTION_B 0x2 |
Referenced by dacifb_configure_channel(), dacifb_reload_timer(), dacifb_set_value(), and dacifb_start_channel().
#define DACIFB_CHANNEL_SELECTION_NONE 0x0 |
#define DACIFB_CHI_MIN_VALUE 500000 |
CHI Min Value of 2us.
Referenced by dacifb_configure().
#define DACIFB_CHRx_MAX_VALUE 33333 |
CHRx Max Value of 35us.
Referenced by dacifb_configure_channel().
#define DACIFB_CHRx_MIN_VALUE 40000 |
CHRx Min Value of 25us.
Referenced by dacifb_configure_channel().
#define DACIFB_REFERENCE_EXT 0x0 |
#define DACIFB_REFERENCE_VDDANA 0x1 |
#define DACIFB_TRIGGER_MODE_EVENT 0x2 |
Referenced by dacifb_configure_channel().
#define DACIFB_TRIGGER_MODE_MANUAL 0x0 |
Referenced by dacifb_configure_channel().
#define DACIFB_TRIGGER_MODE_TIMER 0x1 |
Referenced by dacifb_configure_channel().
bool dacifb_check_eoc | ( | volatile avr32_dacifb_t * | dacifb, |
uint8_t | channel | ||
) |
bool dacifb_configure | ( | volatile avr32_dacifb_t * | dacifb, |
dacifb_opt_t * | p_dacifb_opt, | ||
uint32_t | pb_hz | ||
) |
Configure DACIFB.
Mandatory to call. If not called, DACIFB channels will have side effects.
*dacifb | Base address of the DACIFB |
*p_dacifb_opt | Structure for the DACIFB core configuration |
pb_hz | Peripheral Bus frequency |
References Assert, dacifb_opt_t::channel_selection, clz, DACIFB_CHI_MIN_VALUE, dacifb_opt_t::dual, dacifb_opt_t::gain_calibration_value, dacifb_opt_t::low_power, NULL, dacifb_opt_t::offset_calibration_value, dacifb_opt_t::prescaler_clock_hz, and dacifb_opt_t::reference.
Referenced by dac_task_init(), and main().
bool dacifb_configure_channel | ( | volatile avr32_dacifb_t * | dacifb, |
uint8_t | channel, | ||
dacifb_channel_opt_t * | p_dacifb_channel_opt, | ||
uint32_t | prescaler_clock_hz | ||
) |
Configure DACIFB specific channel.
Sets channel Adjustment, Refresh_time and Trigger Mode settings.
*dacifb | Base address of the ADCIFA |
channel | DACIFB_CHANNEL_SELECTION_NONE / DACIFB_CHANNEL_SELECTION_A / DACIFB_CHANNEL_SELECTION_B / DACIFB_CHANNEL_SELECTION_AB |
p_dacifb_channel_opt | Structure for the sequencer configuration |
prescaler_clock_hz | Prescaler Clock in Hertz (should be > 500000Hz) |
References Assert, dacifb_channel_opt_t::auto_refresh_mode, clz, DACIFB_CHANNEL_SELECTION_A, DACIFB_CHANNEL_SELECTION_AB, DACIFB_CHANNEL_SELECTION_B, DACIFB_CHRx_MAX_VALUE, DACIFB_CHRx_MIN_VALUE, DACIFB_TRIGGER_MODE_EVENT, DACIFB_TRIGGER_MODE_MANUAL, DACIFB_TRIGGER_MODE_TIMER, dacifb_channel_opt_t::data_round_enable, dacifb_channel_opt_t::data_shift, dacifb_channel_opt_t::left_adjustment, NULL, and dacifb_channel_opt_t::trigger_mode.
Referenced by dac_task_init(), and main().
void dacifb_get_calibration_data | ( | volatile avr32_dacifb_t * | dacifb, |
dacifb_opt_t * | p_dacifb_opt, | ||
uint8_t | instance | ||
) |
Get DACIFB Calibration Data.
Mandatory to call if factory calibration data are wanted to be used. If not called, Calibration Data should be set by the application.
*dacifb | Base address of the DACIFB |
*p_dacifb_opt | Structure for the DACIFB core configuration |
instance | DACIFB core instance 0 for DACIFB0 or 1 for DACIFB1 |
References dacifb_opt_t::gain_calibration_value, and dacifb_opt_t::offset_calibration_value.
Referenced by dac_task_init(), and main().
void dacifb_reload_timer | ( | volatile avr32_dacifb_t * | dacifb, |
uint8_t | channel, | ||
uint8_t | timer_us, | ||
uint32_t | prescaler_clock_hz | ||
) |
Reload Timer for Automatic Trigger on DAC.
*dacifb | Base address of the DACIFB |
channel | DACIFB_CHANNEL_SELECTION_NONE / DACIFB_CHANNEL_SELECTION_A / DACIFB_CHANNEL_SELECTION_B / DACIFB_CHANNEL_SELECTION_AB |
timer_us | Timer Value in Microseconds |
prescaler_clock_hz | Prescaler Clock in Hertz (should be > 500000Hz) |
References Assert, DACIFB_CHANNEL_SELECTION_A, DACIFB_CHANNEL_SELECTION_AB, DACIFB_CHANNEL_SELECTION_B, and NULL.
Referenced by main().
void dacifb_set_value | ( | volatile avr32_dacifb_t * | dacifb, |
uint8_t | channel, | ||
bool | dual, | ||
uint32_t | value | ||
) |
Set channel value.
*dacifb | Base address of the DACIFB |
channel | channel to handle (0 to 1) |
dual | Dual Mode Selection |
value | Value to be converted |
References Assert, DACIFB_CHANNEL_SELECTION_A, DACIFB_CHANNEL_SELECTION_AB, DACIFB_CHANNEL_SELECTION_B, and NULL.
void dacifb_start_channel | ( | volatile avr32_dacifb_t * | dacifb, |
uint8_t | channel, | ||
uint32_t | cpu_hz | ||
) |
Start analog to digital conversion.
*dacifb | Base address of the DACIFB |
channel | DACIFB_CHANNEL_SELECTION_NONE / DACIFB_CHANNEL_SELECTION_A / DACIFB_CHANNEL_SELECTION_B / DACIFB_CHANNEL_SELECTION_AB |
cpu_hz | CPU Clock frequency |
References Assert, DACIFB_CHANNEL_SELECTION_A, DACIFB_CHANNEL_SELECTION_AB, DACIFB_CHANNEL_SELECTION_B, delay_us, and NULL.
Referenced by dac_task_init(), and main().