From cdf6ec69d4cae3d752eafb59e0828c15c140d32a Mon Sep 17 00:00:00 2001 From: Antoine Drouin Date: Mon, 28 May 2007 17:24:50 +0000 Subject: [PATCH] *** empty log message *** --- conf/airframes/demo.xml | 29 +++++++++++++++++++++++++ sw/airborne/main_demo6.c | 34 +++++++++++++++++++++++++++++ sw/airborne/usb_serial.h | 46 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 sw/airborne/main_demo6.c create mode 100644 sw/airborne/usb_serial.h diff --git a/conf/airframes/demo.xml b/conf/airframes/demo.xml index eac3967716..265f4c4ca9 100644 --- a/conf/airframes/demo.xml +++ b/conf/airframes/demo.xml @@ -109,6 +109,35 @@ demo5.srcs += downlink.c pprz_transport.c demo5.CFLAGS += -DDATALINK=PPRZ -DPPRZ_UART=Uart0 +# +# Serial link over USB +# +demo6.ARCHDIR = $(ARCHI) +demo6.ARCH = arm7tdmi +demo6.TARGET = demo6 +demo6.TARGETDIR = demo6 + +demo6.CFLAGS += -DCONFIG=\"conf_demo.h\" +demo6.srcs = main_demo6.c + +demo6.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(10e-2)' +demo6.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c + +demo6.CFLAGS += -DLED + +demo6.srcs += $(SRC_ARCH)/armVIC.c + +demo6.CFLAGS += -DUSE_USB_SERIAL -DUSB_SERIAL_BAUD=B38400 +#demo6.srcs += $(SRC_ARCH)/uart_hw.c + +demo6.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=UsbS +demo6.srcs += downlink.c pprz_transport.c + +//demo6.CFLAGS += -DDATALINK=PPRZ -DPPRZ_UART=Uart0 + + + + diff --git a/sw/airborne/main_demo6.c b/sw/airborne/main_demo6.c new file mode 100644 index 0000000000..9c90f672b7 --- /dev/null +++ b/sw/airborne/main_demo6.c @@ -0,0 +1,34 @@ +#include "std.h" +#include "init_hw.h" +#include "sys_time.h" +#include "led.h" +#include "interrupt_hw.h" +#include "usb_serial.h" + +#include "messages.h" +#include "downlink.h" + +static inline void main_init( void ); +static inline void main_periodic_task( void ); + +int main( void ) { + main_init(); + while(1) { + if (sys_time_periodic()) + main_periodic_task(); + } + return 0; +} + +static inline void main_init( void ) { + hw_init(); + sys_time_init(); + led_init(); + usb_serial_init(); + int_enable(); +} + +static inline void main_periodic_task( void ) { + LED_TOGGLE(1); + DOWNLINK_SEND_TAKEOFF(&cpu_time_sec); +} diff --git a/sw/airborne/usb_serial.h b/sw/airborne/usb_serial.h new file mode 100644 index 0000000000..ee5b20b49f --- /dev/null +++ b/sw/airborne/usb_serial.h @@ -0,0 +1,46 @@ +/* + * Paparazzi $Id$ + * + * Copyright (C) 2006 Pascal Brisset, Antoine Drouin, Michel Gorraz + * + * 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, write to + * the Free Software Foundation, 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +/** \file uart.h + * \brief arch independant UART (Universal Asynchronous Receiver/Transmitter) API + * + */ + +#ifndef USB_S_H +#define USB_S_H + +#include +#include "std.h" +//#include "usb_serial_hw.h" + +void usb_serial_init( void ); +void usb_serial_transmit( unsigned char data ); +bool_t usb_serial_check_free_space( uint8_t len); + +#define UsbSInit() usb_serial_init() +#define UsbSCheckFreeSpace(_x) usb_serial_check_free_space(_x) +#define UsbSTransmit(_x) usb_serial_transmit(_x) +#define UsbSSendMessage() {} + +#endif /* USB_S_H */