paparazzi-commits
[Top][All Lists]
Advanced

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

[paparazzi-commits] [4862] this is for martina


From: antoine drouin
Subject: [paparazzi-commits] [4862] this is for martina
Date: Thu, 22 Apr 2010 14:40:38 +0000

Revision: 4862
          http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=4862
Author:   poine
Date:     2010-04-22 14:40:37 +0000 (Thu, 22 Apr 2010)
Log Message:
-----------
this is for martina

Added Paths:
-----------
    paparazzi3/trunk/conf/airframes/poine/
    paparazzi3/trunk/conf/airframes/poine/beth.xml
    paparazzi3/trunk/sw/airborne/beth/
    paparazzi3/trunk/sw/airborne/beth/bench_sensors.c
    paparazzi3/trunk/sw/airborne/beth/bench_sensors.h
    paparazzi3/trunk/sw/airborne/beth/main_beth.c

Added: paparazzi3/trunk/conf/airframes/poine/beth.xml
===================================================================
--- paparazzi3/trunk/conf/airframes/poine/beth.xml                              
(rev 0)
+++ paparazzi3/trunk/conf/airframes/poine/beth.xml      2010-04-22 14:40:37 UTC 
(rev 4862)
@@ -0,0 +1,44 @@
+<airframe name="BETH">
+
+
+  <makefile>
+
+ARCH=lpc21
+ARCHI=arm7
+
+BOARD_CFG = \"boards/olimex_lpc_h2148.h\"
+FLASH_MODE = IAP
+
+#
+# main
+#
+main.ARCHDIR = $(ARCHI)
+main.ARCH = arm7tdmi
+main.TARGET = main
+main.TARGETDIR = main
+
+main.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) $(BOOZ_CFLAGS)
+main.CFLAGS += -DPERIPHERALS_AUTO_INIT
+main.srcs   += beth/main_beth.c
+main.CFLAGS += -DUSE_LED
+main.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./512.))' -DTIME_LED=1
+main.srcs   += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c
+main.CFLAGS += -DUSE_USB_SERIAL
+main.srcs += $(SRC_ARCH)/usb_ser_hw.c
+main.srcs += $(SRC_ARCH)/lpcusb/usbhw_lpc.c $(SRC_ARCH)/lpcusb/usbinit.c
+main.srcs += $(SRC_ARCH)/lpcusb/usbcontrol.c $(SRC_ARCH)/lpcusb/usbstdreq.c
+main.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport 
-DDOWNLINK_DEVICE=UsbS
+main.srcs += downlink.c pprz_transport.c
+main.srcs += beth/bench_sensors.c
+
+main.CFLAGS += -DUSE_I2C1  -DI2C1_SCLL=150 -DI2C1_SCLH=150 -DI2C1_VIC_SLOT=11 
-DI2C1_BUF_LEN=16
+main.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c
+
+
+
+
+
+
+  </makefile>
+
+</airframe>

Added: paparazzi3/trunk/sw/airborne/beth/bench_sensors.c
===================================================================
--- paparazzi3/trunk/sw/airborne/beth/bench_sensors.c                           
(rev 0)
+++ paparazzi3/trunk/sw/airborne/beth/bench_sensors.c   2010-04-22 14:40:37 UTC 
(rev 4862)
@@ -0,0 +1,22 @@
+#include "bench_sensors.h"
+
+#include "i2c.h"
+
+bool_t   bench_sensors_available;
+uint16_t bench_sensors_angle_1;
+uint16_t bench_sensors_angle_2;
+uint16_t bench_sensors_angle_3;
+uint16_t bench_sensors_current;
+
+void bench_sensors_init(void) {
+  bench_sensors_available = FALSE;
+}
+
+
+void read_bench_sensors(void) {
+
+  const uint8_t bench_addr = 0x52;
+
+  i2c1_receive(bench_addr, 4, &bench_sensors_available);
+  
+}

Added: paparazzi3/trunk/sw/airborne/beth/bench_sensors.h
===================================================================
--- paparazzi3/trunk/sw/airborne/beth/bench_sensors.h                           
(rev 0)
+++ paparazzi3/trunk/sw/airborne/beth/bench_sensors.h   2010-04-22 14:40:37 UTC 
(rev 4862)
@@ -0,0 +1,27 @@
+#ifndef BENCH_SENSORS_H
+#define BENCH_SENSORS_H
+
+#include "std.h"
+
+extern void bench_sensors_init(void);
+extern void read_bench_sensors(void);
+extern bool_t   bench_sensors_available;
+extern uint16_t bench_sensors_angle_1;
+extern uint16_t bench_sensors_angle_2;
+extern uint16_t bench_sensors_angle_3;
+extern uint16_t bench_sensors_current;
+
+#define BenchSensorsEvent( _handler) {         \
+    if (bench_sensors_available) {             \
+      bench_sensors_angle_1 = i2c1_buf[0];     \
+      bench_sensors_angle_2 = i2c1_buf[1];     \
+      bench_sensors_angle_3 = i2c1_buf[2];     \
+      bench_sensors_current = i2c1_buf[3];     \
+      _handler();                              \
+      bench_sensors_available = FALSE;         \
+    }                                          \
+  }
+
+
+
+#endif /* BENCH_SENSORS_H  */

Added: paparazzi3/trunk/sw/airborne/beth/main_beth.c
===================================================================
--- paparazzi3/trunk/sw/airborne/beth/main_beth.c                               
(rev 0)
+++ paparazzi3/trunk/sw/airborne/beth/main_beth.c       2010-04-22 14:40:37 UTC 
(rev 4862)
@@ -0,0 +1,55 @@
+#include "std.h"
+#include "init_hw.h"
+#include "sys_time.h"
+#include "interrupt_hw.h"
+
+#include "downlink.h"
+
+#include "beth/bench_sensors.h"
+
+static inline void main_init( void );
+static inline void main_periodic_task( void );
+static inline void main_event_task( void );
+
+static inline void main_on_bench_sensors( 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();
+  int_enable();
+}
+
+static inline void main_periodic_task( void ) {
+
+  RunOnceEvery(512, { DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);});
+
+  read_bench_sensors();
+
+}
+
+
+static inline void main_event_task( void ) {
+
+  BenchSensorsEvent(main_on_bench_sensors);
+
+}
+
+
+static inline void main_on_bench_sensors( void ) {
+  
+  DOWNLINK_SEND_ADC_GENERIC(DefaultChannel, &bench_sensors_angle_1,
+                           &bench_sensors_angle_2);
+  
+}
+
+





reply via email to

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