blob: b30e2529852e468616ae311fd0fc333349e60bf1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*
* tone.h
*
* Created on: May 14, 2022
* Author: bruce
*/
#ifndef INC_TONE_H_
#define INC_TONE_H_
#include "dac.h"
/**
* SysTick handler. Since tones are controlled by software, the SysTick timer
* must be used accurately manage the times.
*/
void SysTick_Handler();
/**
* Accessor for the counter. Useful for knowing what the current "time" is
* in the system.
*/
uint32_t get_counter ();
void reset_counter ();
/**
* Utility function that converts a frequency into a Systick timer ticks.
*/
uint32_t hertz_to_systicks (float hertz);
/**
* Adds a tone to be played.
*/
uint8_t add_tone (uint8_t note, uint8_t velocity);
/**
* Removes a tone from the current group of tones that can be played.
*/
uint8_t remove_tone (uint8_t note);
/**
* Starts playing any tones that have been added.
*/
void play_tones ();
#endif /* INC_TONE_H_ */
|