[imav2015] Drop module for ARDrone

This commit is contained in:
Freek van Tienen
2015-09-10 15:12:17 +02:00
committed by Christophe De Wagter
parent 5b2d965b04
commit a96e29c044
3 changed files with 101 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
<!DOCTYPE module SYSTEM "module.dtd">
<module name="uart_drop" dir="com">
<doc>
<description>Module for dropping balls using UART</description>
</doc>
<header>
<file name="uart_drop.h"/>
</header>
<makefile>
<file name="uart_drop.c"/>
<raw>
UART_DROP_PORT ?= UART1
UART_DROP_BAUD ?= B115200
UART_DROP_PORT_LOWER = $(shell echo $(UART_DROP_PORT) | tr A-Z a-z)
ap.CFLAGS += -DUART_DROP_PORT=$(UART_DROP_PORT_LOWER) -DUSE_$(UART_DROP_PORT) -D$(UART_DROP_PORT)_BAUD=$(UART_DROP_BAUD)
</raw>
</makefile>
</module>
+47
View File
@@ -0,0 +1,47 @@
/*
* Copyright (C) Freek van Tienen
*
* This file is part of paparazzi
*
* paparazzi 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 2, or (at your option)
* any later version.
*
* paparazzi 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 paparazzi; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*/
/**
* @file "modules/com/uart_drop.c"
* @author Freek van Tienen
* Module for dropping balls using UART
*/
#include "modules/com/uart_drop.h"
#include "mcu_periph/uart.h"
static uint8_t drop_string[] = "<Drop_Paintball_Now";
#define DROP_STRINGLEN 19
void drop_ball(uint8_t number) {
for(uint8_t i = 0; i < DROP_STRINGLEN; i++)
uart_put_byte(&UART_DROP_PORT, drop_string[i]);
uint8_t last = '>';
if(number == 1) {
last = '1';
} else if(number == 2) {
last = '2';
} else if(number == 3) {
last = '3';
} else if(number == 4) {
last = '4';
}
uart_put_byte(&UART_DROP_PORT, last);
}
+34
View File
@@ -0,0 +1,34 @@
/*
* Copyright (C) Freek van Tienen
*
* This file is part of paparazzi
*
* paparazzi 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 2, or (at your option)
* any later version.
*
* paparazzi 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 paparazzi; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*/
/**
* @file "modules/com/uart_drop.h"
* @author Freek van Tienen
* Module for dropping balls using UART
*/
#include "std.h"
#ifndef UART_DROP_H
#define UART_DROP_H
extern void drop_ball(uint8_t number);
#endif