2 ******************************************************************************
3 * @addtogroup OpenPilotModules OpenPilot Modules
5 * @addtogroup WavPlayerModule WavPlayer Module
6 * @brief Process WavPlayer information
10 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
11 * @brief WavPlayer module
12 * @see The GNU Public License (GPL) Version 3
14 *****************************************************************************/
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 3 of the License, or
19 * (at your option) any later version.
21 * This program is distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #include "openpilot.h"
37 static void WavPlayerTask(void *parameters
);
42 #define STACK_SIZE_BYTES 1600
44 #define TASK_PRIORITY (tskIDLE_PRIORITY + 4)
49 static xTaskHandle WavPlayerTaskHandle
;
51 static uint32_t timeOfLastCommandMs
;
52 static uint32_t timeOfLastUpdateMs
;
55 int32_t WavPlayerStart(void)
57 // Start WavPlayer task
58 xTaskCreate(WavPlayerTask
, "WavPlayer", STACK_SIZE_BYTES
/ 4, NULL
, TASK_PRIORITY
, &WavPlayerTaskHandle
);
63 * Initialise the WavPlayer module
64 * \return -1 if initialisation failed
65 * \return 0 on success
67 int32_t WavPlayerInitialize(void)
71 MODULE_INITCALL(WavPlayerInitialize
, WavPlayerStart
);
75 * Main WavPlayer task. It does not return.
78 static void WavPlayerTask(__attribute__((unused
)) void *parameters
)
80 portTickType lastSysTime
;
83 lastSysTime
= xTaskGetTickCount();
84 uint32_t timeNowMs
= xTaskGetTickCount() * portTICK_RATE_MS
;
86 timeOfLastUpdateMs
= timeNowMs
;
87 timeOfLastCommandMs
= timeNowMs
;
88 #if defined(PIOS_INCLUDE_WAVE)
93 vTaskDelayUntil(&lastSysTime
, 50 / portTICK_RATE_MS
);
94 timeNowMs
= xTaskGetTickCount() * portTICK_RATE_MS
;