mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 10:26:52 +08:00
libtunes: complete API doc, minor changes
This commit is contained in:
committed by
Daniel Agar
parent
61b3827962
commit
6c8b16391e
@@ -149,7 +149,7 @@ void Tunes::set_string(const char *string)
|
|||||||
|
|
||||||
int Tunes::get_next_tune(unsigned &frequency, unsigned &duration, unsigned &silence)
|
int Tunes::get_next_tune(unsigned &frequency, unsigned &duration, unsigned &silence)
|
||||||
{
|
{
|
||||||
// Return the vaules for frequency and duration if the custom msg was recieved
|
// Return the vaules for frequency and duration if the custom msg was received
|
||||||
if (_using_custom_msg) {
|
if (_using_custom_msg) {
|
||||||
_using_custom_msg = false;
|
_using_custom_msg = false;
|
||||||
frequency = _frequency;
|
frequency = _frequency;
|
||||||
|
|||||||
+21
-11
@@ -64,15 +64,15 @@ public:
|
|||||||
~Tunes() = default;
|
~Tunes() = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set tune to be played
|
* Set tune to be played.
|
||||||
*
|
*
|
||||||
* @param tune_control struct containig the uORB message
|
* @param tune_control struct containig the uORB message
|
||||||
*/
|
*/
|
||||||
void set_control(const tune_control_s &tune_control);
|
void set_control(const tune_control_s &tune_control);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* parse a tune string, formatted with the syntax of the Microsoft GWBasic/QBasic, in frequency(Hz),
|
* Parse a tune string, formatted with the syntax of the Microsoft GWBasic/QBasic.
|
||||||
* duration(us) and silence(us).
|
* This has to be kept in memory for the whole duration of the melody.
|
||||||
*
|
*
|
||||||
* @param string tune input string
|
* @param string tune input string
|
||||||
*/
|
*/
|
||||||
@@ -129,18 +129,28 @@ private:
|
|||||||
*/
|
*/
|
||||||
unsigned note_duration(unsigned &silence, unsigned note_length, unsigned dots);
|
unsigned note_duration(unsigned &silence, unsigned note_length, unsigned dots);
|
||||||
|
|
||||||
// Calculate the duration in microseconds of a rest corresponding to
|
/**
|
||||||
// a given note length.
|
* Calculate the duration in microseconds of a rest corresponding to
|
||||||
//
|
* a given note length.
|
||||||
|
*
|
||||||
|
* @param rest_length rest lenght in fraction of a note
|
||||||
|
* @param dots number of extension dots
|
||||||
|
* @return rest duration (us)
|
||||||
|
*/
|
||||||
unsigned rest_duration(unsigned rest_length, unsigned dots);
|
unsigned rest_duration(unsigned rest_length, unsigned dots);
|
||||||
|
|
||||||
// Find the next character in the string, discard any whitespace and
|
/**
|
||||||
// return the canonical (uppercase) version.
|
* Find the next character in the string, discard any whitespace.
|
||||||
//
|
*
|
||||||
|
* @return uppercase version of the char.
|
||||||
|
*/
|
||||||
int next_char();
|
int next_char();
|
||||||
|
|
||||||
// Extract a number from the string, consuming all the digit characters.
|
/**
|
||||||
//
|
* Extract a number from the string, consuming all the digit characters.
|
||||||
|
*
|
||||||
|
* @return extracted number.
|
||||||
|
*/
|
||||||
unsigned next_number();
|
unsigned next_number();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user