Headers for MAX32630FTHR Demo Board sample programs

Committer:
Lugs
Date:
Tue Jul 30 02:44:30 2019 +0000
Revision:
0:a6a8578e95af
actually working header-using version of mini piano player

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Lugs 0:a6a8578e95af 1 #ifndef _NOTEPLAYER_H_
Lugs 0:a6a8578e95af 2 #define _NOTEPLAYER_H_
Lugs 0:a6a8578e95af 3 #include "mbed.h"
Lugs 0:a6a8578e95af 4
Lugs 0:a6a8578e95af 5 extern float *audioDataBuffer;
Lugs 0:a6a8578e95af 6 extern volatile int bufferPOS;
Lugs 0:a6a8578e95af 7 extern PwmOut speaker;
Lugs 0:a6a8578e95af 8 extern Ticker SampleTime;
Lugs 0:a6a8578e95af 9
Lugs 0:a6a8578e95af 10 void loadBuffer();
Lugs 0:a6a8578e95af 11
Lugs 0:a6a8578e95af 12 typedef enum : unsigned char {
Lugs 0:a6a8578e95af 13 C2,Cs2,D2,Ds2,E2,F2,Fs2,G2,Gs2,A2,As2,B2, //C2:0
Lugs 0:a6a8578e95af 14 C3,Cs3,D3,Ds3,E3,F3,Fs3,G3,Gs3,A3,As3,B3, //C3:12
Lugs 0:a6a8578e95af 15 C4,Cs4,D4,Ds4,E4,F4,Fs4,G4,Gs4,A4,As4,B4, //C4:24
Lugs 0:a6a8578e95af 16 C5,Cs5,D5,Ds5,E5,F5,Fs5,G5,Gs5,A5,As5,B5, //C5:36
Lugs 0:a6a8578e95af 17 C6,Cs6,D6,Ds6,E6,F6,Fs6,G6,Gs6, //C6:48
Lugs 0:a6a8578e95af 18 rest,
Lugs 0:a6a8578e95af 19 END
Lugs 0:a6a8578e95af 20 } pitchname;
Lugs 0:a6a8578e95af 21
Lugs 0:a6a8578e95af 22 typedef struct {
Lugs 0:a6a8578e95af 23 unsigned char length;
Lugs 0:a6a8578e95af 24 pitchname pitch;
Lugs 0:a6a8578e95af 25 } note;
Lugs 0:a6a8578e95af 26
Lugs 0:a6a8578e95af 27 int pitch2freq(pitchname pitch2switch);
Lugs 0:a6a8578e95af 28 void placeNewSample();
Lugs 0:a6a8578e95af 29 note makeNote(int length, pitchname pitch2make);
Lugs 0:a6a8578e95af 30 void playNote(note note2play);
Lugs 0:a6a8578e95af 31
Lugs 0:a6a8578e95af 32 #endif