From 589275a3ba60d22ac40dd321cf04ef8e06009381 Mon Sep 17 00:00:00 2001 From: Thammi Date: Fri, 30 Aug 2013 19:57:51 +0200 Subject: [PATCH] Save data memory --- firmware/apps/ducklings.c | 4 +++- firmware/include/pentabug/music.h | 2 +- firmware/lib/music.c | 2 +- firmware/main.c | 6 ++++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/firmware/apps/ducklings.c b/firmware/apps/ducklings.c index 4059009..cf6f1c2 100644 --- a/firmware/apps/ducklings.c +++ b/firmware/apps/ducklings.c @@ -1,5 +1,7 @@ #include +#include + #include #include #include @@ -7,7 +9,7 @@ #define NOTE_BREAK MLDY_LENGTH, 16, NOTE_PAUSE -static uint16_t notes[] = { +static const uint16_t notes[] PROGMEM = { NOTE_C, NOTE_D, NOTE_E, NOTE_F, MLDY_LENGTH, 2, NOTE_G, MLDY_LENGTH, 2, NOTE_G, NOTE_BREAK, NOTE_A, NOTE_A, NOTE_A, NOTE_A, MLDY_LENGTH, 2, NOTE_G, NOTE_BREAK, NOTE_A, NOTE_A, NOTE_A, NOTE_A, MLDY_LENGTH, 2, NOTE_G, NOTE_BREAK, diff --git a/firmware/include/pentabug/music.h b/firmware/include/pentabug/music.h index 7937412..6404b0e 100644 --- a/firmware/include/pentabug/music.h +++ b/firmware/include/pentabug/music.h @@ -25,7 +25,7 @@ void set_note(uint16_t note, uint8_t octave); // plays a melody consisting of the array of tunes of length len with speed ms for each tune -void play_melody(uint16_t melody[], size_t len, uint8_t octave, int speed); +void play_melody(const uint16_t melody[], size_t len, uint8_t octave, int speed); // stop the currently playing note void stop_note(void); diff --git a/firmware/lib/music.c b/firmware/lib/music.c index 1d5b7fa..4e0b3b4 100644 --- a/firmware/lib/music.c +++ b/firmware/lib/music.c @@ -29,7 +29,7 @@ void stop_note(void) { stop_timer(); } -void play_melody(uint16_t notes[], size_t len, uint8_t octave, int speed) { +void play_melody(const uint16_t notes[], size_t len, uint8_t octave, int speed) { int pause = speed / 20; uint8_t length = 4; diff --git a/firmware/main.c b/firmware/main.c index 2ceac37..d79d760 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -2,14 +2,16 @@ #include #include +#include + #include #include #include #include #include -static uint16_t up_mldy[] = { NOTE_C, NOTE_D, MLDY_LENGTH, 2, NOTE_F, NOTE_PAUSE }; -static uint16_t down_mldy[] = { NOTE_F, NOTE_E, MLDY_LENGTH, 2, NOTE_C, NOTE_PAUSE }; +static const uint16_t up_mldy[] PROGMEM = { NOTE_C, NOTE_D, MLDY_LENGTH, 2, NOTE_F, NOTE_PAUSE }; +static const uint16_t down_mldy[] PROGMEM = { NOTE_F, NOTE_E, MLDY_LENGTH, 2, NOTE_C, NOTE_PAUSE }; static inline void run_app(struct app_t* app) { app_should_stop = 0;