RUOFAN LI / Mbed 2 deprecated el17rl

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers bgm.h Source File

bgm.h

00001 #ifndef BGM_H
00002 #define BGM_H
00003 #include <bitset>
00004 
00005 #include "mbed.h"
00006 #include "N5110.h"
00007 
00008 namespace mbed
00009 {
00010 class AnalogIn;
00011 class InterruptIn;
00012 class PwmOut;
00013 class Timeout;
00014 }
00015 /*My bgm Class
00016 @Library for bgm object in the spaceship project
00017 @coded by Li Ruofan
00018 @May 2020
00019 */
00020 
00021 class Bgm
00022 {
00023 
00024 public:
00025 
00026     /** Constructor & Destructor */
00027     Bgm();
00028     
00029     ~Bgm();
00030     
00031     void tone(float frequency, float duration);
00032     /* Generate the bgm in the homepage: Chinese music "The East is Red" */
00033     void welcome();
00034     
00035     /* Generate a bgm in the battlefield: Australia music "sheep clipping" */
00036     void battlefield();
00037     
00038     /* Generate a bgm when the player is died: "London bridge is falling down" */
00039     void died();
00040 
00041 private:
00042     void init_buttons();
00043     void tone_off();
00044     mbed::Timeout *_timeout;
00045     mbed::PwmOut   *_buzzer;
00046 
00047 };
00048 
00049 #endif