paparazzi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paparazzi-commits] [5755] beginnings of uart com.


From: Paul Cox
Subject: [paparazzi-commits] [5755] beginnings of uart com.
Date: Tue, 31 Aug 2010 08:04:28 +0000

Revision: 5755
          http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=5755
Author:   paulcox
Date:     2010-08-31 08:04:28 +0000 (Tue, 31 Aug 2010)
Log Message:
-----------
beginnings of uart com. 

Modified Paths:
--------------
    paparazzi3/trunk/conf/airframes/Poine/beth.xml

Added Paths:
-----------
    paparazzi3/trunk/sw/airborne/beth/overo_test_uart.c

Modified: paparazzi3/trunk/conf/airframes/Poine/beth.xml
===================================================================
--- paparazzi3/trunk/conf/airframes/Poine/beth.xml      2010-08-31 07:41:18 UTC 
(rev 5754)
+++ paparazzi3/trunk/conf/airframes/Poine/beth.xml      2010-08-31 08:04:28 UTC 
(rev 5755)
@@ -241,7 +241,32 @@
 main_overo.CFLAGS  += -DCONTROLLER_H=\"overo_controller.h\"
 main_overo.srcs    += $(SRC_BETH)/overo_controller.c
 
+#
+# overo uart test
+#
 
+USER =
+HOST = 192.168.0.16
+TARGET_DIR = ~
+SRC_FMS=fms
+
+overo_test_uart.ARCHDIR = omap
+overo_test_uart.CFLAGS = -I. -I$(SRC_FMS)
+overo_test_uart.srcs  = $(SRC_BETH)/overo_test_uart.c
+
+overo_test_uart.CFLAGS  += -DFMS_PERIODIC_FREQ=2
+overo_test_uart.srcs    += $(SRC_FMS)/fms_periodic.c
+overo_test_uart.srcs    += $(SRC_FMS)/fms_serial_port.c
+overo_test_uart.CFLAGS  += -DUBX -DGPS -DGPS_LINK=ttyUSB0
+overo_test_uart.srcs    += $(SRC_BETH)/gps_ubx.c
+overo_test_uart.LDFLAGS += -lrt
+overo_test_uart.CFLAGS  += -DDOWNLINK -DDOWNLINK_TRANSPORT=UdpTransport
+overo_test_uart.srcs    += $(SRC_FMS)/udp_transport2.c downlink.c
+overo_test_uart.srcs    += $(SRC_FMS)/fms_network.c
+overo_test_uart.LDFLAGS += -levent -lm
+overo_test_uart.srcs    += $(SRC_BETH)/overo_gcs_com.c
+
+
 #
 # Overo twisting
 #

Added: paparazzi3/trunk/sw/airborne/beth/overo_test_uart.c
===================================================================
--- paparazzi3/trunk/sw/airborne/beth/overo_test_uart.c                         
(rev 0)
+++ paparazzi3/trunk/sw/airborne/beth/overo_test_uart.c 2010-08-31 08:04:28 UTC 
(rev 5755)
@@ -0,0 +1,118 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2010 The Paparazzi Team
+ *
+ * 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.
+ *
+ */
+
+#include <stdint.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+
+#include <event.h>
+
+#include "messages2.h"
+#include "airframe.h"
+
+#include "fms_periodic.h"
+#include "fms_debug.h"
+#include "fms_serial_port.h"
+
+#include "overo_gcs_com.h"
+
+struct OveroController {
+  int armed;
+} controller;
+
+static void main_periodic(int);
+static void main_exit(int sig);
+static void main_talk_with_tiny(void);
+
+static uint32_t foo = 0;
+struct FmsSerialPort* fmssp;
+int spfd;
+
+int main(int argc, char *argv[]) {
+  
+  (void) signal(SIGINT, main_exit);
+
+  fmssp = serial_port_new();
+  //speed_t speed;
+
+  if (serial_port_open_raw(fmssp,"/dev/ttyUSB0",B9600)){
+    printf("error opening USB serial port!");
+    return -1;
+  } 
+
+  spfd = (int)fmssp->fd;  
+
+  /* Initalize the event library */
+  event_init();
+
+  gcs_com_init();
+
+  if (fms_periodic_init(main_periodic)) {
+    TRACE(TRACE_ERROR, "%s", "failed to start periodic generator\n");
+    return -1; 
+  }
+  
+  event_dispatch();
+  //should never occur!
+  printf("goodbye! (%d)\n",foo);
+
+  return 0;
+}
+
+static void main_periodic(int my_sig_num) {
+
+  RunOnceEvery(20, {DOWNLINK_SEND_ALIVE(gcs_com.udp_transport, 16, MD5SUM);  
printf("\n");});
+ 
+  main_talk_with_tiny();
+
+  RunOnceEvery(2, gcs_com_periodic());
+
+}
+
+static void main_exit(int sig) {
+  printf("Initiating shutdown...\n");
+
+  printf("Application Exiting...\n");
+  exit(EXIT_SUCCESS);
+}
+
+static void main_talk_with_tiny() {
+  unsigned char c='D';
+  write(spfd,&c,1);
+  if (read(spfd,&c,1)>0) write(STDOUT_FILENO,&c,1);
+  //fprintf(spfd,"testing\n");
+  printf(".");
+  foo++;
+}
+
+int ttyUSB0Transmit(){
+
+}
+int ttyUSB0SendMessage(){
+
+}
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]