Microchip® Advanced Software Framework

dac_sound_player.c File Reference

SAM DAC Sound Player Application.

Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>
#include "data.x"

Functions

static void configure_dac (struct dac_module *dac_module)
 Configures the DAC in event triggered mode. More...
 
static void configure_events (struct events_resource *event)
 Configures the event system to link the sample timer to the DAC. More...
 
static void configure_tc (struct tc_module *tc_module)
 Configures the TC to generate output events at the sample frequency. More...
 
int main (void)
 Main application routine. More...
 

Variables

const uint32_t number_of_samples
 Number of samples in the waveform. More...
 
const uint32_t sample_rate = 16000
 Sample rate of the sound table. More...
 
const uint16_t wav_samples []
 Embedded waveform table of sound samples to output. More...
 

static void configure_dac ( struct dac_module dac_module)
static

Configures the DAC in event triggered mode.

Configures the DAC to use the module's default configuration, with output channel mode configured for event triggered conversions.

Parameters
dev_instPointer to the DAC module software instance to initialize
static void configure_events ( struct events_resource event)
static

Configures the event system to link the sample timer to the DAC.

Configures the event system, linking the TC module used for the audio sample rate timing to the DAC, so that a new conversion is triggered each time the DAC receives an event from the timer.

static void configure_tc ( struct tc_module tc_module)
static

Configures the TC to generate output events at the sample frequency.

Configures the TC in Frequency Generation mode, with an event output once each time the audio sample frequency period expires.

Parameters
dev_instPointer to the TC module software instance to initialize
int main ( void  )

Main application routine.

const uint32_t number_of_samples
Initial value:
=
(sizeof(wav_samples) / sizeof(wav_samples[0]))
const uint16_t wav_samples[]
Embedded waveform table of sound samples to output.
Definition: dac_sound_player.c:97

Number of samples in the waveform.

const uint32_t sample_rate = 16000

Sample rate of the sound table.

const uint16_t wav_samples[]

Embedded waveform table of sound samples to output.