Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Gamepad.h
- Revision:
- 24:33639c2eacb3
- Parent:
- 22:72357412608d
- Child:
- 25:ec8f4bea154c
--- 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);