summaryrefslogtreecommitdiff
path: root/project/Core/Src/Activties
diff options
context:
space:
mode:
Diffstat (limited to 'project/Core/Src/Activties')
-rw-r--r--project/Core/Src/Activties/activity13.c15
-rw-r--r--project/Core/Src/Activties/activity4.c10
2 files changed, 16 insertions, 9 deletions
diff --git a/project/Core/Src/Activties/activity13.c b/project/Core/Src/Activties/activity13.c
index 19eb0a4..16c2c1b 100644
--- a/project/Core/Src/Activties/activity13.c
+++ b/project/Core/Src/Activties/activity13.c
@@ -7,20 +7,27 @@
#include <stdint.h>
#include <stdio.h>
#include "systick.h"
+#include "tone.h"
+#include "dac.h"
//write 1s for half the freq and 0s for the other half
void play_freq(uint8_t hz) {
- uint32_t rollover =herz_to_systicks(hz);
+ uint32_t rollover = hertz_to_systicks(hz);
int count = systick_get_count();
- if ((count % rollover) < (rollover >> 1))
+ if ((count % rollover) < (rollover >> 1)) {
+ DAC_Set_Value(3000);
printf("1");
- else
+ }
+ else {
+ DAC_Set_Value(0);
printf("0");
+ }
}
void activity13_run() {
init_systick();
+ DAC_Init();
for(;;) {
- play_freq(1);
+ play_freq(3000);
}
}
diff --git a/project/Core/Src/Activties/activity4.c b/project/Core/Src/Activties/activity4.c
index 898cd2d..c2a0d63 100644
--- a/project/Core/Src/Activties/activity4.c
+++ b/project/Core/Src/Activties/activity4.c
@@ -12,13 +12,13 @@
#include "activity4.h"
void activity4_run() {
- header_t* p_header = get_header(get_song(0).p_song);
+ header_t p_header = get_header(get_song(0).p_song);
printf ("Header: \r\n");
- printf ("\tLength: %lu\r\n", p_header->length);
- printf ("\tFormat: %u\r\n", p_header->format);
- printf ("\tNum Tracks: %u\r\n", p_header->ntrcks);
- printf ("\tDivision: %u\r\n", p_header->division);
+ printf ("\tLength: %lu\r\n", p_header.length);
+ printf ("\tFormat: %u\r\n", p_header.format);
+ printf ("\tNum Tracks: %u\r\n", p_header.ntrcks);
+ printf ("\tDivision: %u\r\n", p_header.division);
}
header_t get_header(uint8_t *p_song) {