Library for ELEC2645 Gamepad PCB. University of Leeds Version 2 January 2020
Dependents: ELEC2645_Ticker_WAV ELEC2645_Project_username ELEC2645_Project_el18vgt ELEC2645_Project_el17oc11 ... more
Revision 24:33639c2eacb3, committed 2020-01-31
- Comitter:
- eencae
- Date:
- Fri Jan 31 10:49:11 2020 +0000
- Parent:
- 23:8e1a30a69caa
- Commit message:
- Updated docs
Changed in this revision
Gamepad.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 8e1a30a69caa -r 33639c2eacb3 Gamepad.h --- a/Gamepad.h Mon Jan 27 15:26:16 2020 +0000 +++ b/Gamepad.h Fri Jan 31 10:49:11 2020 +0000 @@ -50,6 +50,7 @@ * @brief Library for interfacing with ELEC2645 Gamepad PCB, University of Leeds * @author Dr Craig A. Evans * @author Dr Alex Valavanis + * @author Joshua Davy */ class Gamepad { @@ -224,17 +225,29 @@ */ bool start_held(); - - // play single note of specific duration + /** Play a single tone for the specifed duration + *@param note frequency (in Hz) + *@param duration (in s) + */ void tone(const float frequency,const float duration); - // play array of notes and duration, must send length and beats per minute + /** Play a melody + *@param length of note array + *@param array of note frequencies (in Hz) - 0 treated as a rest + *@param array of note durations (4 corresponds to 1/4, 8 is 1/8 etc.) + *@param beats per minute + *@param whether to repeat or play just once + */ void play_melody(int length,const int *notes,const int *durations,float bpm,bool repeat); - // change the BPM + /** Set the BPM of the melody + *@param beats per minute + */ void set_bpm(float bpm); - // write to DAC + /** Write an analog voltage to the speaker + *@param voltage in range 0.0 to 1.0 (corresponds 0.0 to 3.3 V) + */ void write_dac(float val);