Go to the source code of this file.
Macros | |
#define | DAC_CLK_HZ 25000000 |
#define | DAC_SIN_TABLE_SZ 45 |
Functions | |
_PRIVATE u16 | adjust_sample_volume (u16 sample, u8 volume) |
_PRIVATE void | next_sample (void) |
void | DAC_BUZInit (u8 timer_a, u8 timer_b, u8 int_priority) |
Initializes the DAC peripheral. | |
void | DAC_BUZDeinit (void) |
void | DAC_BUZSetVolume (u8 volume) |
Sets the volume of the buzzer. | |
void | DAC_BUZPlay (DAC_Tone tone, u16 bpm) |
Plays the given note for the given duration. | |
bool | DAC_BUZIsPlaying (void) |
void | DAC_BUZStop (void) |
Variables | |
_PRIVATE TIMER | DAC_SamplesTimer |
_PRIVATE TIMER | DAC_SecondsTimer |
_PRIVATE u8 | DAC_SinVolume = DAC_VOL_DEFAULT |
_PRIVATE u32 | DAC_SinTableIndex = 0 |
const u16 | DAC_Sin [] |
Sine wave samples for the DAC. They represent one complete period. Each sample needs to be sent to the DAC. | |
void DAC_BUZDeinit | ( | void | ) |
Definition at line 76 of file dac.c.
Initializes the DAC peripheral.
int_priority | The interrupt priority of the timer. If set to INT_PRIO_DEF, the default interrupt priority will be used. |
Definition at line 66 of file dac.c.
bool DAC_BUZIsPlaying | ( | void | ) |
Definition at line 114 of file dac.c.
Plays the given note for the given duration.
tone | The tone to be played |
bpm | The tempo of the note (i.e. 60, 120, 240, etc.) |
Definition at line 91 of file dac.c.
void DAC_BUZSetVolume | ( | u8 | volume | ) |
void DAC_BUZStop | ( | void | ) |
Definition at line 119 of file dac.c.
_PRIVATE void next_sample | ( | void | ) |
Definition at line 48 of file dac.c.
const u16 DAC_Sin[] |
Sine wave samples for the DAC. They represent one complete period. Each sample needs to be sent to the DAC.
Definition at line 16 of file dac.c.
_PRIVATE u8 DAC_SinVolume = DAC_VOL_DEFAULT |