mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
Started new module
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@650 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
d7b3a158d6
commit
0723ff8b75
94
flight/OpenPilot/Modules/MKSerial/MKSerial.c
Normal file
94
flight/OpenPilot/Modules/MKSerial/MKSerial.c
Normal file
@ -0,0 +1,94 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file GPS.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief GPS module, handles GPS and NMEA stream
|
||||
* @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"
|
||||
#include "MkSerial.h"
|
||||
#include "gpsobject.h"
|
||||
|
||||
|
||||
// Debugging
|
||||
|
||||
|
||||
// Private functions
|
||||
static void MkSerialTask(void* parameters);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Private constants
|
||||
#define PORT COM_USART1
|
||||
#define STACK_SIZE 1024
|
||||
#define TASK_PRIORITY (tskIDLE_PRIORITY + 3)
|
||||
|
||||
|
||||
// Private types
|
||||
|
||||
// Private variables
|
||||
|
||||
|
||||
/**
|
||||
* Initialise the module
|
||||
* \return -1 if initialisation failed
|
||||
* \return 0 on success
|
||||
*/
|
||||
int32_t MkSerialInitialize(void)
|
||||
{
|
||||
// Start gps task
|
||||
xTaskCreate(MkSerialTask, (signed char*)"MkSerial", STACK_SIZE, NULL, TASK_PRIORITY, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gps task. Processes input buffer. It does not return.
|
||||
*/
|
||||
static void MkSerialTask(void* parameters)
|
||||
{
|
||||
PIOS_COM_ChangeBaud(PORT, 38400);
|
||||
PIOS_COM_SendString(PORT, "MKSerial Started\n");
|
||||
|
||||
while(1)
|
||||
{
|
||||
int32_t len;
|
||||
|
||||
len = PIOS_COM_ReceiveBufferUsed(PORT);
|
||||
if (len)
|
||||
{
|
||||
PIOS_COM_SendFormattedString(PORT, "Received %d: ", len);
|
||||
|
||||
for (int32_t n = 0; n < len; ++n)
|
||||
{
|
||||
PIOS_COM_SendChar(PORT, PIOS_COM_ReceiveBuffer(PORT));
|
||||
}
|
||||
|
||||
PIOS_COM_SendString(PORT, "\n");
|
||||
}
|
||||
vTaskDelay(100 / portTICK_RATE_MS);
|
||||
}
|
||||
|
||||
|
||||
}
|
34
flight/OpenPilot/Modules/MKSerial/inc/MkSerial.h
Normal file
34
flight/OpenPilot/Modules/MKSerial/inc/MkSerial.h
Normal file
@ -0,0 +1,34 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file GPS.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Include file of the GPS module.
|
||||
* As with all modules only the initialize function is exposed all other
|
||||
* interactions with the module take place through the event queue and
|
||||
* objects.
|
||||
* @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
|
||||
*/
|
||||
|
||||
#ifndef MK_SERIAL_H
|
||||
#define MK_SERIAL_H
|
||||
|
||||
int32_t MkSerialInitialize(void);
|
||||
|
||||
#endif // MK_SER_INPUT_H
|
Loading…
x
Reference in New Issue
Block a user