main/task_sound.c

changeset 1
ad2c8b13eb88
parent 0
b74b0e4902c3
child 4
6d1f512cd074
--- a/main/task_sound.c	Sat Oct 20 13:23:15 2018 +0200
+++ b/main/task_sound.c	Sat Oct 20 17:09:48 2018 +0200
@@ -7,9 +7,9 @@
 #include "config.h"
 
 
-#define	PIEZO_BUZZER	CONFIG_BUZZER_GPIO
+#define	PIEZO_BUZZER	CONFIG_BUZZER_GPIO	///< GPIO pin with the piezo buzzer.
 
-EventGroupHandle_t	xEventGroupSound;
+EventGroupHandle_t	xEventGroupSound;	///< Event handle.
 
 
 static const char       *TAG = "task_sound";
@@ -23,20 +23,25 @@
 const int SOUND_WARN = BIT6;			///< When set, play warning sound.
 
 
-const uint16_t		_sound_Startup[]	= { 50, 10, 10, 10, 10, 10, 10, 10, 10, 10, 200, 
-							10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 
-							10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 
-							10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 
-							10, 10, 10, 10, 10, 10, 10, 10, 10, 10 };
-const uint16_t		_sound_Prompt[]		= { 2, 50, 125 };
-const uint16_t		_sound_TempReached[]	= { 6, 250, 75, 250, 75, 250, 75};
-const uint16_t		_sound_TimeOut[]	= {10, 25, 975, 25, 975, 25, 975, 25, 975, 500, 500 }; // 5 seconds
-const uint16_t		_sound_AddHop[]		= {18, 50, 50, 50, 50, 50, 225, 150, 50, 150, 50, 150, 225, 50, 50, 50 , 50 , 50, 50 };
-const uint16_t		_sound_End[]		= { 2, 1000, 75 };
-const uint16_t		_sound_Warn[]		= { 6, 100, 75, 100, 75, 100, 50 };
+/* Sound arrays. The first value is the length, followed by the on and off times. */
+static const uint16_t		_sound_Startup[]	= { 50, 10, 10, 10, 10, 10, 10, 10, 10, 10, 200, 
+							    10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 
+							    10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 
+							    10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 
+							    10, 10, 10, 10, 10, 10, 10, 10, 10, 10 };
+static const uint16_t		_sound_Prompt[]		= {  2, 50, 125 };
+static const uint16_t		_sound_TempReached[]	= {  6, 250, 75, 250, 75, 250, 75};
+static const uint16_t		_sound_TimeOut[]	= { 10, 25, 975, 25, 975, 25, 975, 25, 975, 500, 500 }; // 5 seconds
+static const uint16_t		_sound_AddHop[]		= { 18, 50, 50, 50, 50, 50, 225, 150, 50, 150, 50, 150, 225, 50, 50, 50 , 50 , 50, 50 };
+static const uint16_t		_sound_End[]		= {  2, 1000, 75 };
+static const uint16_t		_sound_Warn[]		= {  6, 100, 75, 100, 75, 100, 50 };
 
 
 
+/**
+ * @brief Play sounds on the piezo buzzer.
+ * @param sound The sound array.
+ */
 void BuzzerPlay(const uint16_t *sound)
 {
     for (int i = 1; i <= sound[0]; i += 2) {

mercurial