forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move RTTTL into fri3d package and refactor a bit
- Loading branch information
Showing
10 changed files
with
227 additions
and
198 deletions.
There are no files selected for viewing
53 changes: 27 additions & 26 deletions
53
fri3d/fri3d_application/src/payload/examples/rtttl/main.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,34 @@ | ||
import time | ||
|
||
from examples.rtttl.rtttl_player import play_rtttl | ||
|
||
macarena = 'Los del Rio - Macarena:o=5,d=8,b=180,b=180:f,f,f,4f,f,f,f,f,f,f,f,a,c,c,4f,f,f,4f,f,f,f,f,f,f,d,c,4p,4f,f,f,4f,f,f,f,f,f,f,f,a,4p,2c6.,4a,c6,a,f,4p,2p' | ||
macarena_s = 'Los del Rio - Macarena - Short:o=5,d=8,b=180,b=180:4f,f,f,f,f,f,f,f,a,4p,2c6.,4a,c6,a,f' | ||
|
||
dump_dump = 'To The Dump To The Dump To The Dump Dump Dump:o=5,d=8,b=270,b=270:c,c,4c,c,c,4c,c,c,f,p,g,p,4a,c,c,4c,c,c,4c,a,a,g,p,e,p,4c,c,c,4c,c,c,4c,c,c,f,p,g,p,4a,f,a,1c6,a,g,f,p,a.,p,f' | ||
dump_dump_s = 'To The Dump To The Dump To The Dump Dump Dump - Short:o=5,d=8,b=270,b=270:c,c,4c,c,c,4c,c,c,f,p,g,p,4a' | ||
|
||
william = 'Rossini - William Tell Overture Finale:d=4,o=5,b=140:16c,16c,16c,16p,16c,16c,16c,16p,16c,16c,16f,16p,8g,16a,16p,16c,16c,16c,16p,16c,16c,16f,16p,16a,16a,16g,16p,8e,16c,16p,16c,16c,16c,16p,16c,16c,16c,16p,16c,16c,16f,16p,8g,16a,16p,16f,16a,c6,16p,16a#,16a,16g,16f,16p,16a,16p,16f,16p' | ||
|
||
take_on_me = 'a-ha - Take On Me:o=5,d=8,b=160,b=160:f#,f#,f#,d,p,b4,p,e,p,e,p,e,g#,g#,a,b,a,a,a,e,p,d,p,f#,p,f#,p,f#,e,e,f#,e,f#,f#,f#,d,p,b4,p,e,p,e,p,e,g#,g#,a,b,a,a,a,e,p,d,p,f#,p,f#,p,f#,e,e5' | ||
take_on_me_s = 'a-ha - Take On Me - Short:o=5,d=8,b=160,b=160:f#,f#,f#,d,p,b4,p,e,p,e,p,e,g#,g#,a,b,a,a,a,e,p,d,p,f#,p,f#,' | ||
|
||
good_bad_ugly = 'The Good The Bad The Ugly:d=8,o=5,b=125:16a,16d6,16a,16d6,2a,4f,4g,2d,4p,16a,16d6,16a,16d6,2a,4f,4g,2c6,4p,16a,16d6,16a,2d6,4f6,e6,d6,2c6,4p,16a,16d6,16a,16d6,4a.,4g,d,2d' | ||
good_bad_ugly_s = 'The Good The Bad The Ugly - Short:d=8,o=5,b=125:16a,16d6,16a,16d6,2a,4f,4g,2d' | ||
|
||
creeds_push_up = 'Creeds - Push Up:d=8,o=5,b=160:b,b,b,g,a,a,a,g,f#,f#,f#,f#,2f#,2p,b,b,b,g,a,a,a,g,f#,f#,f#,f#,2f#,2p, g,g,g,d,a,a,a,g,f#,f#,f#,f#,2f#,2p,g,g,g,d,e,e,e,g,f#,f#,f#,f#,2f#,2p, b,b,b,g,a,a,a,g,f#,f#,f#,f#,4p,b,b,b,g,a,a,a,g,f#,f#,f#,f#,4p, g,g,g,d,a,a,a,g,f#,f#,f#,f#,4p,g,g,g,d,e,e,e,g,f#,f#,f#,f#,4p' | ||
creeds_push_up_s = 'Creeds - Push Up - Short:d=8,o=5,b=160:b,b,b,g,a,a,a,g,f#,f#,f#,f#,2f#' | ||
|
||
|
||
short_songs = [macarena_s, dump_dump_s, take_on_me_s, good_bad_ugly_s, creeds_push_up_s] | ||
songs = [macarena, dump_dump, william, take_on_me, good_bad_ugly, creeds_push_up] | ||
|
||
from fri3d.rtttl import songs, RTTTL | ||
|
||
frere_jacques = "Frère Jacques:d=4,o=6,b=112:c,d,e,c,c,d,e,c,e,f,g,p,e,f,g,p,8g,8a,8g,8f,e,c,8g,8a,8g,8f,e,c,c,g5,c,p,c,g5,c" | ||
nokia = "Nokia:d=4,o=5,b=225:8e6,8d6,f#,g#,8c#6,8b,d,e,8b,8a,c#,e,2a" | ||
|
||
short_songs = [ | ||
songs.macarena_s, | ||
songs.dump_dump_s, | ||
songs.take_on_me_s, | ||
songs.good_bad_ugly_s, | ||
songs.creeds_push_up_s | ||
] | ||
|
||
long_songs = [ | ||
songs.macarena, | ||
songs.dump_dump, | ||
songs.william, | ||
songs.take_on_me, | ||
songs.good_bad_ugly, | ||
songs.creeds_push_up | ||
] | ||
|
||
RTTTL(nokia).play(volume=100) | ||
RTTTL(frere_jacques).play(volume=10) | ||
|
||
for song in short_songs: | ||
play_rtttl(song) | ||
RTTTL(song).play() | ||
time.sleep(0.5) | ||
|
||
for song in songs: | ||
play_rtttl(song) | ||
for song in long_songs: | ||
RTTTL(song).play() | ||
time.sleep(0.5) |
164 changes: 0 additions & 164 deletions
164
fri3d/fri3d_application/src/payload/examples/rtttl/rtttl_player.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ def __init__(self): | |
self.duty = 0 | ||
|
||
|
||
hardware_buzzer = HardwareBuzzer() | ||
hardware_buzzer = HardwareBuzzer() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ def __init__(self): | |
self.duty = 0 | ||
|
||
|
||
hardware_buzzer = HardwareBuzzer() | ||
hardware_buzzer = HardwareBuzzer() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .rtttl import RTTTL |
Oops, something went wrong.