Atmel Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AUDIO - Mono Audio PWM DAC

Mono Audio DAC implemented with a PWM hardware module.

This software module constructs a 16-bit DAC output using two 8-bit PWM channels combined with a resistor ladder network. The interface provides functions to configure and control this software DAC.

Functions

void pwm_dac_decrease_volume (void)
 Decreases the output volume of the DAC. More...
 
void pwm_dac_flush (void)
 Flushes the sample buffer being output to the DAC. More...
 
uint8_t pwm_dac_get_volume (void)
 Return the current volume. More...
 
void pwm_dac_increase_volume (void)
 Increases the output volume of the DAC. More...
 
bool pwm_dac_is_volume_boosted (void)
 Returns the state of the boost mode of the DAC. More...
 
bool pwm_dac_is_volume_muted (void)
 Returns the state of the mute mode of the DAC. More...
 
void pwm_dac_mute (bool mute)
 Mute audio if mute set to true. More...
 
bool pwm_dac_output (void *sample_buffer, size_t sample_length)
 Outputs a sample buffer to the DAC. More...
 
void pwm_dac_set_volume (uint8_t volume)
 Set the current volume. More...
 
void pwm_dac_setup (uint32_t sample_rate_hz, uint8_t num_channels, uint8_t bits_per_sample, bool swap_channels, void(*callback)(uint32_t arg), uint32_t callback_opt, uint32_t pba_hz)
 Sets the DAC up with new settings. More...
 
void pwm_dac_start (uint32_t sample_rate_hz, uint8_t num_channels, uint8_t bits_per_sample, bool swap_channels, void(*callback)(uint32_t arg), uint32_t callback_opt, uint32_t pba_hz)
 Starts the DAC. More...
 
void pwm_dac_stop (void)
 Stops the DAC. More...
 

void pwm_dac_decrease_volume ( void  )

Decreases the output volume of the DAC.

Note
The DAC must have been started beforehand.

References pwm_dac_output_params.

void pwm_dac_flush ( void  )

Flushes the sample buffer being output to the DAC.

References pwm_dac_output_params, pwm_dac_output_sample(), PWM_DAC_PWM_CHANNEL_LSB, and PWM_DAC_PWM_CHANNEL_MSB.

Referenced by pwm_dac_stop().

uint8_t pwm_dac_get_volume ( void  )

Return the current volume.

Note
The DAC must have been started beforehand.

References pwm_dac_output_params.

void pwm_dac_increase_volume ( void  )

Increases the output volume of the DAC.

Note
The DAC must have been started beforehand.

References pwm_dac_output_params.

bool pwm_dac_is_volume_boosted ( void  )

Returns the state of the boost mode of the DAC.

Note
The DAC must have been started beforehand.
bool pwm_dac_is_volume_muted ( void  )

Returns the state of the mute mode of the DAC.

Note
The DAC must have been started beforehand.
void pwm_dac_mute ( bool  mute)

Mute audio if mute set to true.

bool pwm_dac_output ( void *  sample_buffer,
size_t  sample_length 
)

Outputs a sample buffer to the DAC.

Note
The DAC must have been started beforehand.

References pwm_dac_get_log2_aligned_byte_size(), pwm_dac_output_params, PWM_DAC_PWM_CHANNEL_LSB, PWM_DAC_PWM_CHANNEL_MSB, sample_buffer, and sample_length.

void pwm_dac_set_volume ( uint8_t  volume)

Set the current volume.

Note
The DAC must have been started beforehand.

References pwm_dac_output_params.

void pwm_dac_setup ( uint32_t  sample_rate_hz,
uint8_t  num_channels,
uint8_t  bits_per_sample,
bool  swap_channels,
void(*)(uint32_t arg callback,
uint32_t  callback_opt,
uint32_t  pba_hz 
)

Sets the DAC up with new settings.

Note
The DAC must have been started beforehand.

References bits_per_sample, callback, callback_opt, max, min, num_channels, pwm_dac_get_log2_aligned_byte_size(), PWM_DAC_GET_SAMPLE, pwm_dac_output_params, and swap_channels.

Referenced by pwm_dac_start().

void pwm_dac_start ( uint32_t  sample_rate_hz,
uint8_t  num_channels,
uint8_t  bits_per_sample,
bool  swap_channels,
void(*)(uint32_t arg callback,
uint32_t  callback_opt,
uint32_t  pba_hz 
)
void pwm_dac_stop ( void  )