
Li Ruofan 201199450
bgm/bgm.h@7:e3844250b77d, 2020-05-15 (annotated)
- Committer:
- DannyLee
- Date:
- Fri May 15 22:23:22 2020 +0000
- Revision:
- 7:e3844250b77d
- Parent:
- 6:cbd9e1f26a10
Still has problems, actually I can't compile it
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DannyLee | 3:cf9fead9c3f4 | 1 | #ifndef BGM_H |
DannyLee | 3:cf9fead9c3f4 | 2 | #define BGM_H |
DannyLee | 3:cf9fead9c3f4 | 3 | #include <bitset> |
DannyLee | 3:cf9fead9c3f4 | 4 | |
DannyLee | 3:cf9fead9c3f4 | 5 | #include "mbed.h" |
DannyLee | 3:cf9fead9c3f4 | 6 | #include "N5110.h" |
DannyLee | 3:cf9fead9c3f4 | 7 | |
DannyLee | 6:cbd9e1f26a10 | 8 | namespace mbed |
DannyLee | 6:cbd9e1f26a10 | 9 | { |
DannyLee | 6:cbd9e1f26a10 | 10 | class AnalogIn; |
DannyLee | 6:cbd9e1f26a10 | 11 | class InterruptIn; |
DannyLee | 6:cbd9e1f26a10 | 12 | class PwmOut; |
DannyLee | 6:cbd9e1f26a10 | 13 | class Timeout; |
DannyLee | 6:cbd9e1f26a10 | 14 | } |
DannyLee | 3:cf9fead9c3f4 | 15 | /*My bgm Class |
DannyLee | 3:cf9fead9c3f4 | 16 | @Library for bgm object in the spaceship project |
DannyLee | 3:cf9fead9c3f4 | 17 | @coded by Li Ruofan |
DannyLee | 3:cf9fead9c3f4 | 18 | @May 2020 |
DannyLee | 3:cf9fead9c3f4 | 19 | */ |
DannyLee | 3:cf9fead9c3f4 | 20 | |
DannyLee | 3:cf9fead9c3f4 | 21 | class Bgm |
DannyLee | 3:cf9fead9c3f4 | 22 | { |
DannyLee | 3:cf9fead9c3f4 | 23 | |
DannyLee | 3:cf9fead9c3f4 | 24 | public: |
DannyLee | 3:cf9fead9c3f4 | 25 | |
DannyLee | 3:cf9fead9c3f4 | 26 | /** Constructor & Destructor */ |
DannyLee | 3:cf9fead9c3f4 | 27 | Bgm(); |
DannyLee | 3:cf9fead9c3f4 | 28 | |
DannyLee | 3:cf9fead9c3f4 | 29 | ~Bgm(); |
DannyLee | 3:cf9fead9c3f4 | 30 | |
DannyLee | 6:cbd9e1f26a10 | 31 | void tone(float frequency, float duration); |
DannyLee | 3:cf9fead9c3f4 | 32 | /* Generate the bgm in the homepage: Chinese music "The East is Red" */ |
DannyLee | 3:cf9fead9c3f4 | 33 | void welcome(); |
DannyLee | 3:cf9fead9c3f4 | 34 | |
DannyLee | 3:cf9fead9c3f4 | 35 | /* Generate a bgm in the battlefield: Australia music "sheep clipping" */ |
DannyLee | 3:cf9fead9c3f4 | 36 | void battlefield(); |
DannyLee | 3:cf9fead9c3f4 | 37 | |
DannyLee | 3:cf9fead9c3f4 | 38 | /* Generate a bgm when the player is died: "London bridge is falling down" */ |
DannyLee | 3:cf9fead9c3f4 | 39 | void died(); |
DannyLee | 3:cf9fead9c3f4 | 40 | |
DannyLee | 3:cf9fead9c3f4 | 41 | private: |
DannyLee | 3:cf9fead9c3f4 | 42 | void init_buttons(); |
DannyLee | 3:cf9fead9c3f4 | 43 | void tone_off(); |
DannyLee | 3:cf9fead9c3f4 | 44 | mbed::Timeout *_timeout; |
DannyLee | 3:cf9fead9c3f4 | 45 | mbed::PwmOut *_buzzer; |
DannyLee | 3:cf9fead9c3f4 | 46 | |
DannyLee | 3:cf9fead9c3f4 | 47 | }; |
DannyLee | 3:cf9fead9c3f4 | 48 | |
DannyLee | 3:cf9fead9c3f4 | 49 | #endif |