1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-11 19:24:10 +01:00
LibrePilot/flight/modules/Osd/WavPlayer/wavplayer.c

104 lines
2.6 KiB
C
Raw Normal View History

2012-07-15 20:43:44 +02:00
/**
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
* @addtogroup WavPlayerModule WavPlayer Module
* @brief Process WavPlayer information
* @{
*
2013-04-20 17:07:19 +02:00
* @file wavplayer.c
2012-07-15 20:43:44 +02:00
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief WavPlayer module
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// ****************
#include "openpilot.h"
// ****************
// Private functions
static void WavPlayerTask(void *parameters);
// ****************
// Private constants
#define STACK_SIZE_BYTES 1600
2012-07-15 20:43:44 +02:00
#define TASK_PRIORITY (tskIDLE_PRIORITY + 4)
2012-07-15 20:43:44 +02:00
// ****************
// Private variables
static xTaskHandle WavPlayerTaskHandle;
static uint32_t timeOfLastCommandMs;
static uint32_t timeOfLastUpdateMs;
// ****************
int32_t WavPlayerStart(void)
{
2013-04-20 17:07:19 +02:00
// Start WavPlayer task
xTaskCreate(WavPlayerTask, "WavPlayer", STACK_SIZE_BYTES / 4, NULL, TASK_PRIORITY, &WavPlayerTaskHandle);
2012-07-15 20:43:44 +02:00
2013-04-20 17:07:19 +02:00
return 0;
2012-07-15 20:43:44 +02:00
}
/**
* Initialise the WavPlayer module
* \return -1 if initialisation failed
* \return 0 on success
*/
int32_t WavPlayerInitialize(void)
{
2013-04-20 17:07:19 +02:00
return 0;
2012-07-15 20:43:44 +02:00
}
MODULE_INITCALL(WavPlayerInitialize, WavPlayerStart);
2012-07-15 20:43:44 +02:00
// ****************
/**
2013-04-20 17:07:19 +02:00
* Main WavPlayer task. It does not return.
2012-07-15 20:43:44 +02:00
*/
static void WavPlayerTask(__attribute__((unused)) void *parameters)
2012-07-15 20:43:44 +02:00
{
2013-04-20 17:07:19 +02:00
portTickType lastSysTime;
2013-04-20 17:07:19 +02:00
// Loop forever
lastSysTime = xTaskGetTickCount();
uint32_t timeNowMs = xTaskGetTickCount() * portTICK_RATE_MS;
2012-07-15 20:43:44 +02:00
timeOfLastUpdateMs = timeNowMs;
2013-04-20 17:07:19 +02:00
timeOfLastCommandMs = timeNowMs;
2012-07-23 18:47:50 +02:00
#if defined(PIOS_INCLUDE_WAVE)
2013-04-20 17:07:19 +02:00
WavePlayer_Start();
2012-07-23 18:47:50 +02:00
#endif
2013-04-20 17:07:19 +02:00
// Loop forever
while (1) {
vTaskDelayUntil(&lastSysTime, 50 / portTICK_RATE_MS);
timeNowMs = xTaskGetTickCount() * portTICK_RATE_MS;
}
2012-07-15 20:43:44 +02:00
}
// ****************
/**
2013-04-20 17:07:19 +02:00
* @}
* @}
*/