summaryrefslogtreecommitdiff
path: root/project/Core/Inc/tone.h
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2025-08-31 13:25:35 -0400
committersowgro <tpoke.ferrari@gmail.com>2025-08-31 13:25:35 -0400
commit0ff718e7cd7159c30636aa323a666ac1af684f63 (patch)
tree247e13a76a15d3f826ba949a5a4d82b79a35e652 /project/Core/Inc/tone.h
parent0f2ea7deaf0cba2f0ca07f6611c5a9e87d531f5b (diff)
download340-repo-Sowgro-0ff718e7cd7159c30636aa323a666ac1af684f63.tar.gz
340-repo-Sowgro-0ff718e7cd7159c30636aa323a666ac1af684f63.tar.bz2
340-repo-Sowgro-0ff718e7cd7159c30636aa323a666ac1af684f63.zip
Setup project
Diffstat (limited to 'project/Core/Inc/tone.h')
-rw-r--r--project/Core/Inc/tone.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/project/Core/Inc/tone.h b/project/Core/Inc/tone.h
new file mode 100644
index 0000000..b30e252
--- /dev/null
+++ b/project/Core/Inc/tone.h
@@ -0,0 +1,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_ */