From 31262cdfb1a1faf178669a40025eee317bae6547 Mon Sep 17 00:00:00 2001 From: tbarnes98 Date: Fri, 21 Jan 2022 17:29:41 -0600 Subject: [PATCH] small changes --- .vscode/c_cpp_properties.json | 24 ++++++++++++++++++++++++ labW5barnestr/Inc/piezoSpeaker.h | 2 +- labW5barnestr/Src/main.c | 2 ++ labW5barnestr/Src/piezoSpeaker.c | 5 +++-- 4 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 .vscode/c_cpp_properties.json diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..52474a9 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,24 @@ +{ + "configurations": [ + { + "name": "Win32", + "includePath": [ + "${workspaceFolder}/**" + ], + "defines": [ + "_DEBUG", + "UNICODE", + "_UNICODE" + ], + "cStandard": "c11", + "cppStandard": "c++17", + "browse": { + "path": [ + "${workspaceFolder}" + ] + }, + "intelliSenseMode": "linux-gcc-arm" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/labW5barnestr/Inc/piezoSpeaker.h b/labW5barnestr/Inc/piezoSpeaker.h index 8607a4b..4e3dcad 100644 --- a/labW5barnestr/Inc/piezoSpeaker.h +++ b/labW5barnestr/Inc/piezoSpeaker.h @@ -158,7 +158,7 @@ void play_song(Note *song, int size); #define Db8 4434.92 #define D8 4698.64 #define Eb8 4978.03 -// Ending "termination" value indicating end of asong +// Ending "termination" value indicating end of a song #define T 5000.00 // Tempo value set at 240 beats per min #define BPM 240 diff --git a/labW5barnestr/Src/main.c b/labW5barnestr/Src/main.c index 3e94f66..636325a 100644 --- a/labW5barnestr/Src/main.c +++ b/labW5barnestr/Src/main.c @@ -57,6 +57,8 @@ Note t2n1 ={G3, S/3}, t2n46={Ab3,S/3}, t2n2 ={A3, S/3}, t2n47={Bb3,S/3}, t2n3 ={ t2n41={D4, Q}, t2n42={F4, Q}, t2n43={Bb4, Q}, t2n44={D5, Q}, t2n45={F5, Q}, t2n61={Bb5, W}, t2n62={B5, Q}, t2n63={B5, Q}, t2n64={B5, Q}, t2n65={C6, W}; + Note song3[100] = { {G3, Q}, {}}; + void printHelp() { printf("*Commands*\n\r"); printf("'rmw {hex address}' - Reads mem at a given address\n\r"); diff --git a/labW5barnestr/Src/piezoSpeaker.c b/labW5barnestr/Src/piezoSpeaker.c index 0d5d6e1..6319820 100644 --- a/labW5barnestr/Src/piezoSpeaker.c +++ b/labW5barnestr/Src/piezoSpeaker.c @@ -69,8 +69,9 @@ void play_note(double frequency, double duration){ } -void play_song(Note *song, int size){ - for(int i = 0; i < size; i++){ +void play_song(Note *song){ + static int i = 0; + while(song[i].freq != T){ play_note(song[i].freq, song[i].duration); } }