paparazzi-commits
[Top][All Lists]
Advanced

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

[paparazzi-commits] [5794] big I2C rework - LPC users please don't updat


From: antoine drouin
Subject: [paparazzi-commits] [5794] big I2C rework - LPC users please don't update for now
Date: Fri, 03 Sep 2010 01:56:45 +0000

Revision: 5794
          http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=5794
Author:   poine
Date:     2010-09-03 01:56:44 +0000 (Fri, 03 Sep 2010)
Log Message:
-----------
big I2C rework - LPC users please don't update for now

Modified Paths:
--------------
    paparazzi3/trunk/conf/airframes/Poine/booz2_a6.xml
    paparazzi3/trunk/conf/airframes/Poine/booz2_a7.xml
    paparazzi3/trunk/conf/autopilot/lisa_l_test_progs.makefile
    paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/actuators_mkk.makefile
    paparazzi3/trunk/sw/airborne/booz/actuators/booz_actuators_asctec.c
    paparazzi3/trunk/sw/airborne/booz/actuators/booz_actuators_mkk.c
    paparazzi3/trunk/sw/airborne/booz/actuators/booz_actuators_mkk.h
    paparazzi3/trunk/sw/airborne/i2c.c
    paparazzi3/trunk/sw/airborne/i2c.h
    paparazzi3/trunk/sw/airborne/stm32/i2c_hw.c
    paparazzi3/trunk/sw/airborne/stm32/i2c_hw.h

Added Paths:
-----------
    paparazzi3/trunk/sw/airborne/test/test_actuators.c
    paparazzi3/trunk/sw/airborne/test/test_esc_asctecv1_simple.c
    paparazzi3/trunk/sw/airborne/test/test_esc_mkk_simple.c

Removed Paths:
-------------
    
paparazzi3/trunk/sw/airborne/booz/arch/lpc21/actuators/booz_actuators_mkk_arch.c
    
paparazzi3/trunk/sw/airborne/booz/arch/lpc21/actuators/booz_actuators_mkk_arch.h
    
paparazzi3/trunk/sw/airborne/booz/arch/stm32/actuators/booz_actuators_mkk_arch.c
    
paparazzi3/trunk/sw/airborne/booz/arch/stm32/actuators/booz_actuators_mkk_arch.h
    paparazzi3/trunk/sw/airborne/lisa/test_mc2.c

Modified: paparazzi3/trunk/conf/airframes/Poine/booz2_a6.xml
===================================================================
--- paparazzi3/trunk/conf/airframes/Poine/booz2_a6.xml  2010-09-02 23:19:17 UTC 
(rev 5793)
+++ paparazzi3/trunk/conf/airframes/Poine/booz2_a6.xml  2010-09-03 01:56:44 UTC 
(rev 5794)
@@ -159,56 +159,53 @@
   </section>
 
 
- <section name="GUIDANCE_H" prefix="BOOZ2_GUIDANCE_H_">
-   <define name="PGAIN" value="-100"/>
-   <define name="DGAIN" value="-100"/>
-   <define name="IGAIN" value="-0"/>
- </section>
+  <section name="GUIDANCE_H" prefix="BOOZ2_GUIDANCE_H_">
+    <define name="PGAIN" value="-100"/>
+    <define name="DGAIN" value="-100"/>
+    <define name="IGAIN" value="-0"/>
+  </section>
 
- <section name="MISC">
-   <define name="BOOZ2_FACE_REINJ_1"  value="1024"/>
- </section>
+  <section name="MISC">
+    <define name="BOOZ2_FACE_REINJ_1"  value="1024"/>
+  </section>
 
 
- <makefile>
+  <firmware name="rotorcraft">
+    <target name="ap" board="lisa_l_1.0">
+<!--      <define name="BOOZ_START_DELAY" value="1"/> -->
+      <subsystem name="radio_control" type="spektrum"/>
+      <subsystem name="actuators"     type="mkk"/>
+    </target>
+    <target name="sim" board="pc">
+      <subsystem name="fdm"           type="nps"/>
+      <subsystem name="radio_control" type="ppm"/>
+      <subsystem name="actuators"     type="mkk"/>
+    </target>
 
+    <subsystem name="imu"           type="b2_v1.1"/>
+    <subsystem name="gps"           type="ublox"/>
+    <subsystem name="ahrs"          type="cmpl"/>
+  </firmware>
 
 
-USER =
-#HOST = 10.31.4.22
-HOST = overo
-#HOST = beth
-TARGET_DIR = ~
 
-SRC_FMS=fms
 
 
-ARCH=stm32
-ARCHI=stm32
-BOARD_CFG=\"boards/lisa_0.99.h\"
-FLASH_MODE = JTAG
+  <firmware name="lisa_l_test_progs">
+    <target name="test_telemetry"           board="lisa_l_1.0"/>
+    <target name="test_baro"                board="lisa_l_1.0"/>
+    <target name="test_imu_b2"              board="lisa_l_1.0"/>
+    <target name="test_imu_aspirin"         board="lisa_l_1.0"/>
+    <target name="test_rc_spektrum"         board="lisa_l_1.0"/>
+    <target name="test_rc_ppm"              board="lisa_l_1.0"/>
+    <target name="test_adc"                 board="lisa_l_1.0"/>
+    <target name="test_hmc5843"             board="lisa_l_1.0"/>
+    <target name="test_itg3200"             board="lisa_l_1.0"/>
+    <target name="test_adxl345"             board="lisa_l_1.0"/>
+    <target name="test_esc_mkk_simple"      board="lisa_l_1.0"/>
+    <target name="test_esc_asctecv1_simple" board="lisa_l_1.0"/>
+    <target name="test_actuators_mkk"       board="lisa_l_1.0"/>
+    <target name="test_actuators_asctecv1"  board="lisa_l_1.0"/>
+  </firmware>
 
-ap.CFLAGS += -DMODEM_BAUD=B57600
-ap.CFLAGS += 
-DRADIO_CONTROL_SPEKTRUM_MODEL_H=\"radio_control/booz_radio_control_spektrum_dx7se.h\"
-
-include $(PAPARAZZI_SRC)/conf/autopilot/booz2_common.makefile
-include $(CFG_BOOZ)/booz2_autopilot.makefile
-
-include $(CFG_BOOZ)/subsystems/booz2_radio_control_spektrum.makefile
-include $(CFG_BOOZ)/subsystems/booz2_actuators_mkk.makefile
-include $(CFG_BOOZ)/subsystems/booz2_imu_b2v1_1.makefile
-#include $(CFG_BOOZ)/subsystems/booz2_gps.makefile
-include $(CFG_BOOZ)/subsystems/booz2_ahrs_cmpl.makefile
-
-
-include $(PAPARAZZI_SRC)/conf/autopilot/lisa_test_progs.makefile
-
-#
-# 
-#
-
-include $(PAPARAZZI_SRC)/conf/autopilot/lisa_passthrough.makefile
-
- </makefile>
-
 </airframe>

Modified: paparazzi3/trunk/conf/airframes/Poine/booz2_a7.xml
===================================================================
--- paparazzi3/trunk/conf/airframes/Poine/booz2_a7.xml  2010-09-02 23:19:17 UTC 
(rev 5793)
+++ paparazzi3/trunk/conf/airframes/Poine/booz2_a7.xml  2010-09-03 01:56:44 UTC 
(rev 5794)
@@ -211,7 +211,11 @@
     <target name="test_adc"         board="lisa_l_1.0"/>
     <target name="test_hmc5843"     board="lisa_l_1.0"/>
     <target name="test_itg3200"     board="lisa_l_1.0"/>
-    <target name="test_adxl345"     board="lisa_l_1.0"/>
+    <target name="test_adxl345"             board="lisa_l_1.0"/>
+    <target name="test_esc_mkk_simple"      board="lisa_l_1.0"/>
+    <target name="test_esc_asctecv1_simple" board="lisa_l_1.0"/>
+    <target name="test_actuators_mkk"       board="lisa_l_1.0"/>
+    <target name="test_actuators_asctecv1"  board="lisa_l_1.0"/>
   </firmware>
 
   <firmware name="lisa_passthrough">
@@ -229,10 +233,5 @@
       <subsystem name="imu" type="b2_v1.1"/>
  </firmware>
 
- <makefile>
 
-#include $(PAPARAZZI_SRC)/conf/autopilot/lisa_test_progs.makefile
-
- </makefile>
-
 </airframe>

Modified: paparazzi3/trunk/conf/autopilot/lisa_l_test_progs.makefile
===================================================================
--- paparazzi3/trunk/conf/autopilot/lisa_l_test_progs.makefile  2010-09-02 
23:19:17 UTC (rev 5793)
+++ paparazzi3/trunk/conf/autopilot/lisa_l_test_progs.makefile  2010-09-03 
01:56:44 UTC (rev 5794)
@@ -414,3 +414,106 @@
 
 
 
+#
+# simple test of mikrokopter motor controllers
+#
+test_esc_mkk_simple.ARCHDIR = $(ARCHI)
+test_esc_mkk_simple.TARGET = test_esc_mkk_simple
+test_esc_mkk_simple.TARGETDIR = test_esc_mkk_simple
+test_esc_mkk_simple.CFLAGS = -I$(SRC_LISA) -I$(ARCHI) -DPERIPHERALS_AUTO_INIT
+test_esc_mkk_simple.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG)
+test_esc_mkk_simple.srcs = test/test_esc_mkk_simple.c      \
+                           $(SRC_ARCH)/stm32_exceptions.c   \
+                           $(SRC_ARCH)/stm32_vector_table.c
+test_esc_mkk_simple.CFLAGS += -DUSE_LED
+test_esc_mkk_simple.srcs += $(SRC_ARCH)/led_hw.c
+test_esc_mkk_simple.CFLAGS += -DUSE_SYS_TIME -DSYS_TIME_LED=1
+test_esc_mkk_simple.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(1./512.)'
+test_esc_mkk_simple.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c
+test_esc_mkk_simple.CFLAGS += -DUSE_I2C1
+test_esc_mkk_simple.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c
+
+
+#
+# simple test of asctec v1 motor controllers
+#
+test_esc_asctecv1_simple.ARCHDIR = $(ARCHI)
+test_esc_asctecv1_simple.TARGET = test_esc_asctecv1_simple
+test_esc_asctecv1_simple.TARGETDIR = test_esc_asctecv1_simple
+test_esc_asctecv1_simple.CFLAGS = -I$(SRC_LISA) -I$(ARCHI) 
-DPERIPHERALS_AUTO_INIT
+test_esc_asctecv1_simple.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG)
+test_esc_asctecv1_simple.srcs = test/test_esc_asctecv1_simple.c  \
+                                $(SRC_ARCH)/stm32_exceptions.c   \
+                                $(SRC_ARCH)/stm32_vector_table.c
+test_esc_asctecv1_simple.CFLAGS += -DUSE_LED
+test_esc_asctecv1_simple.srcs += $(SRC_ARCH)/led_hw.c
+test_esc_asctecv1_simple.CFLAGS += -DUSE_SYS_TIME -DSYS_TIME_LED=1
+test_esc_asctecv1_simple.CFLAGS += 
-DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(1./512.)'
+test_esc_asctecv1_simple.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c
+test_esc_asctecv1_simple.CFLAGS += -DUSE_I2C1
+test_esc_asctecv1_simple.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c
+
+
+#
+# test actuators mkk
+#
+test_actuators_mkk.ARCHDIR = $(ARCHI)
+test_actuators_mkk.TARGET = test_actuators_mkk
+test_actuators_mkk.TARGETDIR = test_actuators_mkk
+test_actuators_mkk.CFLAGS = -I$(SRC_LISA) -I$(ARCHI) -I$(SRC_BOOZ) 
-I$(SRC_BOOZ_ARCH) -DPERIPHERALS_AUTO_INIT
+test_actuators_mkk.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG)
+test_actuators_mkk.srcs = test/test_actuators.c \
+                          $(SRC_ARCH)/stm32_exceptions.c   \
+                          $(SRC_ARCH)/stm32_vector_table.c
+
+test_actuators_mkk.CFLAGS += -DUSE_LED
+test_actuators_mkk.srcs += $(SRC_ARCH)/led_hw.c
+
+test_actuators_mkk.CFLAGS += -DUSE_SYS_TIME -DSYS_TIME_LED=1
+test_actuators_mkk.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(1./512.)'
+test_actuators_mkk.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c
+
+test_actuators_mkk.CFLAGS += -DUSE_UART2 -DUART2_BAUD=B57600
+test_actuators_mkk.srcs += $(SRC_ARCH)/uart_hw.c
+
+test_actuators_mkk.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport 
-DDOWNLINK_DEVICE=Uart2 
+test_actuators_mkk.srcs += downlink.c pprz_transport.c
+
+test_actuators_mkk.srcs += $(SRC_BOOZ)/booz2_commands.c
+test_actuators_mkk.srcs += $(SRC_BOOZ)/actuators/booz_actuators_mkk.c
+test_actuators_mkk.CFLAGS += -DACTUATORS_MKK_DEVICE=i2c1
+test_actuators_mkk.srcs += $(SRC_BOOZ)/actuators/booz_supervision.c
+test_actuators_mkk.CFLAGS += -DUSE_I2C1
+test_actuators_mkk.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c
+
+#
+# test actuators asctecv1
+#
+test_actuators_asctecv1.ARCHDIR = $(ARCHI)
+test_actuators_asctecv1.TARGET = test_actuators_asctecv1
+test_actuators_asctecv1.TARGETDIR = test_actuators_asctecv1
+test_actuators_asctecv1.CFLAGS = -I$(SRC_LISA) -I$(ARCHI) -I$(SRC_BOOZ) 
-I$(SRC_BOOZ_ARCH) -DPERIPHERALS_AUTO_INIT
+test_actuators_asctecv1.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG)
+test_actuators_asctecv1.srcs = test/test_actuators.c            \
+                               $(SRC_ARCH)/stm32_exceptions.c   \
+                               $(SRC_ARCH)/stm32_vector_table.c
+
+test_actuators_asctecv1.CFLAGS += -DUSE_LED
+test_actuators_asctecv1.srcs += $(SRC_ARCH)/led_hw.c
+
+test_actuators_asctecv1.CFLAGS += -DUSE_SYS_TIME -DSYS_TIME_LED=1
+test_actuators_asctecv1.CFLAGS += 
-DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(1./512.)'
+test_actuators_asctecv1.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c
+
+test_actuators_asctecv1.CFLAGS += -DUSE_UART2 -DUART2_BAUD=B57600
+test_actuators_asctecv1.srcs += $(SRC_ARCH)/uart_hw.c
+
+test_actuators_asctecv1.CFLAGS += -DDOWNLINK 
-DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart2 
+test_actuators_asctecv1.srcs += downlink.c pprz_transport.c
+
+test_actuators_asctecv1.srcs += $(SRC_BOOZ)/booz2_commands.c
+test_actuators_asctecv1.CFLAGS += -DACTUATORS_ASCTEC_DEVICE=i2c1
+test_actuators_asctecv1.srcs += $(SRC_BOOZ)/actuators/booz_actuators_asctec.c
+test_actuators_asctecv1.CFLAGS += -DUSE_I2C1
+test_actuators_asctecv1.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c
+

Modified: 
paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/actuators_mkk.makefile
===================================================================
--- 
paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/actuators_mkk.makefile    
    2010-09-02 23:19:17 UTC (rev 5793)
+++ 
paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/actuators_mkk.makefile    
    2010-09-03 01:56:44 UTC (rev 5794)
@@ -28,7 +28,6 @@
 #
 ap.srcs += $(SRC_BOOZ)/actuators/booz_supervision.c
 ap.srcs += $(SRC_BOOZ)/actuators/booz_actuators_mkk.c
-ap.srcs += $(SRC_BOOZ_ARCH)/actuators/booz_actuators_mkk_arch.c
 ap.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c
 
 ifeq ($(ARCHI), arm7)
@@ -36,13 +35,12 @@
 ap.CFLAGS += -DI2C0_STOP_HANDLER=ActuatorsMkkI2cHandler
 ap.CFLAGS += -DI2C0_STOP_HANDLER_HEADER=\"actuators/booz_actuators_mkk.h\"
 else ifeq ($(ARCHI), stm32) 
-ap.CFLAGS += -DACTUATORS_MKK_DEVICE=i2c1  -DUSE_TIM2_IRQ
+ap.CFLAGS += -DACTUATORS_MKK_DEVICE=i2c1
 ap.CFLAGS += -DUSE_I2C1
 endif
 
 # Simulator
 sim.srcs += $(SRC_BOOZ)/actuators/booz_supervision.c
 sim.srcs += $(SRC_BOOZ)/actuators/booz_actuators_mkk.c
-sim.srcs += $(SRC_BOOZ_SIM)/actuators/booz_actuators_mkk_arch.c
 sim.CFLAGS += -DUSE_I2C0 -DI2C0_SCLL=150 -DI2C0_SCLH=150 -DI2C0_VIC_SLOT=10
 sim.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c

Modified: paparazzi3/trunk/sw/airborne/booz/actuators/booz_actuators_asctec.c
===================================================================
--- paparazzi3/trunk/sw/airborne/booz/actuators/booz_actuators_asctec.c 
2010-09-02 23:19:17 UTC (rev 5793)
+++ paparazzi3/trunk/sw/airborne/booz/actuators/booz_actuators_asctec.c 
2010-09-03 01:56:44 UTC (rev 5794)
@@ -1,33 +1,15 @@
-#include "booz_actuators.h"
-#include "actuators/booz_actuators_asctec.h"
+#include "booz/booz_actuators.h"
+#include "booz/actuators/booz_actuators_asctec.h"
 
 #ifdef ACTUATORS_ASCTEC_V2_PROTOCOL
-#include "actuators/booz_supervision.h"
+#include "booz/actuators/booz_supervision.h"
 #endif
 
-#include "booz2_commands.h"
+#include "booz/booz2_commands.h"
 #include "i2c.h"
 #include "sys_time.h"
 
 
-#ifndef ACTUATORS_ASCTEC_DEVICE
-#define ACTUATORS_ASCTEC_DEVICE i2c0
-#endif
-
-/*
- * Macros to generate i2cx_buf and i2cx_transmit from
- * ACTUATORS_ASCTEC_DEVICE
- *
- */
-#define __Device(dev, _z) dev##_##_z 
-#define  _Device(dev, _z) __Device(dev, _z)
-#define  Device( _z) _Device(ACTUATORS_ASCTEC_DEVICE, _z)
-
-#define   DeviceBuf                    Device(buf)
-#define   DeviceTransmit(_x, _y, _z)   Device(transmit(_x, _y, _z))
-
-
-
 struct ActuatorsAsctec actuators_asctec; 
 
 uint32_t actuators_delay_time;
@@ -38,6 +20,13 @@
   actuators_asctec.cur_addr = FRONT;
   actuators_asctec.new_addr = FRONT;
   actuators_asctec.i2c_trans.status = I2CTransSuccess;
+  actuators_asctec.i2c_trans.type = I2CTransTx;
+  actuators_asctec.i2c_trans.slave_addr = 0x02;
+#ifdef ACTUATORS_ASCTEC_V2_PROTOCOL
+  actuators_asctec.i2c_trans.len_w = 5;
+#else
+  actuators_asctec.i2c_trans.len_w = 4;
+#endif
   actuators_asctec.nb_err = 0;
 
 #if defined BOOZ_START_DELAY && ! defined SITL
@@ -117,9 +106,7 @@
   }
   actuators_asctec.cmd = NONE;
 
-  i2c_submit(&i2c1,&actuators_asctec.i2c_trans);
-  //  actuators_asctec.i2c_done = FALSE;
-  //  DeviceTransmit(0x02, 4, &actuators_asctec.i2c_done);
+  i2c_submit(&ACTUATORS_ASCTEC_DEVICE, &actuators_asctec.i2c_trans);
 
 }
 #else /* ! ACTUATORS_ASCTEC_V2_PROTOCOL */
@@ -141,12 +128,7 @@
                                              actuators_asctec.i2c_trans.buf[2] 
+ actuators_asctec.i2c_trans.buf[3];
 #endif
 
-  i2c_submit(&i2c1,&actuators_asctec.i2c_trans);
-
-  //  if (actuators_asctec.i2c_done) {
-  //actuators_asctec.i2c_done = FALSE;
-  //  DeviceTransmit(0x02, 5, &actuators_asctec.i2c_done);
-  //  }
+  i2c_submit(&ACTUATORS_ASCTEC_DEVICE, &actuators_asctec.i2c_trans);
   
 }
 #endif /* ACTUATORS_ASCTEC_V2_PROTOCOL */

Modified: paparazzi3/trunk/sw/airborne/booz/actuators/booz_actuators_mkk.c
===================================================================
--- paparazzi3/trunk/sw/airborne/booz/actuators/booz_actuators_mkk.c    
2010-09-02 23:19:17 UTC (rev 5793)
+++ paparazzi3/trunk/sw/airborne/booz/actuators/booz_actuators_mkk.c    
2010-09-03 01:56:44 UTC (rev 5794)
@@ -21,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include "booz_actuators.h"
-#include "actuators/booz_actuators_mkk.h"
+#include "booz/booz_actuators.h"
+#include "booz/actuators/booz_actuators_mkk.h"
 
 #include "booz/booz2_commands.h"
 #include "i2c.h"
@@ -31,7 +31,6 @@
 
 struct ActuatorsMkk actuators_mkk;
 
-const uint8_t actuators_addr[ACTUATORS_MKK_NB] = ACTUATORS_MKK_ADDR;
 
 uint32_t actuators_delay_time;
 bool_t   actuators_delay_done;
@@ -39,10 +38,14 @@
 void actuators_init(void) {
 
   supervision_init();
-  actuators_mkk.status = IDLE;
-  actuators_mkk.i2c_done = TRUE;
-  actuators_mkk.idx = 0;
-
+  const uint8_t actuators_addr[ACTUATORS_MKK_NB] = ACTUATORS_MKK_ADDR;
+  for (uint8_t i=0; i<ACTUATORS_MKK_NB; i++) {
+    actuators_mkk.trans[i].type = I2CTransTx;
+    actuators_mkk.trans[i].len_w = 1;
+    actuators_mkk.trans[i].slave_addr = actuators_addr[i];
+    actuators_mkk.trans[i].status = I2CTransSuccess;
+  }
+  
 #if defined BOOZ_START_DELAY && ! defined SITL
   actuators_delay_done = FALSE;
   SysTimeTimerStart(actuators_delay_time);
@@ -50,9 +53,7 @@
   actuators_delay_done = TRUE;
   actuators_delay_time = 0;
 #endif
-
-  booz_actuators_mkk_arch_init();
-
+  
 }
 
 
@@ -65,15 +66,12 @@
 #endif
 
   supervision_run(motors_on, FALSE, booz2_commands);
-  actuators_mkk.status = BUSY;
-  actuators_mkk.i2c_done = FALSE;
-  actuators_mkk.idx = 0;
-  BoozActuatorsMkkArchSend();
+  for (uint8_t i=0; i<ACTUATORS_MKK_NB; i++) {
 #ifdef KILL_MOTORS
-  DeviceBuf[0] = 0;
+    actuators_mkk.trans[i].buf[0] = 0;
 #else
-  DeviceBuf[0] = supervision.commands[actuators_mkk.idx];
+    actuators_mkk.trans[i].buf[0] = supervision.commands[i];
 #endif
-  DeviceTransmit(actuators_addr[actuators_mkk.idx], 1, 
&actuators_mkk.i2c_done);
-
+    i2c_submit(&ACTUATORS_MKK_DEVICE, &actuators_mkk.trans[i]);
+  }
 }

Modified: paparazzi3/trunk/sw/airborne/booz/actuators/booz_actuators_mkk.h
===================================================================
--- paparazzi3/trunk/sw/airborne/booz/actuators/booz_actuators_mkk.h    
2010-09-02 23:19:17 UTC (rev 5793)
+++ paparazzi3/trunk/sw/airborne/booz/actuators/booz_actuators_mkk.h    
2010-09-03 01:56:44 UTC (rev 5794)
@@ -25,58 +25,20 @@
 #define BOOZ_ACTUATORS_MKK_H
 
 #include "std.h"
+#include "i2c.h"
 
-#ifndef ACTUATORS_MKK_DEVICE
-#define ACTUATORS_MKK_DEVICE i2c0
-#endif
+#include "airframe.h"
 
-#define __Device(dev, _z) dev##_##_z 
-#define  _Device(dev, _z) __Device(dev, _z)
-#define  Device( _z) _Device(ACTUATORS_MKK_DEVICE, _z)
 
-#define   DeviceBuf                    Device(buf)
-#define   DeviceTransmit(_x, _y, _z)   Device(transmit(_x, _y, _z))
-
-enum actuators_mkk_status {IDLE, BUSY};
-
 struct ActuatorsMkk {
-  volatile enum actuators_mkk_status status;
-  volatile bool_t  i2c_done;
-  volatile uint8_t idx;
+  struct i2c_transaction trans[ACTUATORS_MKK_NB];
 };
 
 extern struct ActuatorsMkk actuators_mkk; 
 
-#include "actuators/booz_actuators_mkk_arch.h"
-/* must be defined by underlying achitecture */
-extern void booz_actuators_mkk_arch_init(void);
 
 
-#include "airframe.h"
 #include "actuators/booz_supervision.h"
-extern const uint8_t actuators_addr[];
 
 
-#ifdef KILL_MOTORS
-#define ActuatorsMkkI2cHandler() {                                     \
-    actuators_mkk.idx++;                                               \
-    if (actuators_mkk.idx<ACTUATORS_MKK_NB) {                          \
-      DeviceBuf[0] = 0;                                                        
\
-      DeviceTransmit(actuators_addr[actuators_mkk.idx], 1, 
&actuators_mkk.i2c_done); \
-    }                                                                  \
-    else                                                               \
-      actuators_mkk.status = IDLE;                                     \
-  }
-#else /* KILL_MOTORS */
-#define ActuatorsMkkI2cHandler() {                                     \
-    actuators_mkk.idx++;                                               \
-    if (actuators_mkk.idx<ACTUATORS_MKK_NB) {                          \
-      DeviceBuf[0] = supervision.commands[actuators_mkk.idx];          \
-      DeviceTransmit(actuators_addr[actuators_mkk.idx], 1, 
&actuators_mkk.i2c_done); \
-    }                                                                  \
-    else                                                               \
-      actuators_mkk.status = IDLE;                                     \
-  }
-#endif /* KILL_MOTORS */
-
 #endif /* BOOZ_ACTUATORS_MKK_H */

Deleted: 
paparazzi3/trunk/sw/airborne/booz/arch/lpc21/actuators/booz_actuators_mkk_arch.c
===================================================================
--- 
paparazzi3/trunk/sw/airborne/booz/arch/lpc21/actuators/booz_actuators_mkk_arch.c
    2010-09-02 23:19:17 UTC (rev 5793)
+++ 
paparazzi3/trunk/sw/airborne/booz/arch/lpc21/actuators/booz_actuators_mkk_arch.c
    2010-09-03 01:56:44 UTC (rev 5794)
@@ -1,3 +0,0 @@
-#include "actuators/booz_actuators_mkk.h"
-
-void booz_actuators_mkk_arch_init(void) {}

Deleted: 
paparazzi3/trunk/sw/airborne/booz/arch/lpc21/actuators/booz_actuators_mkk_arch.h
===================================================================
--- 
paparazzi3/trunk/sw/airborne/booz/arch/lpc21/actuators/booz_actuators_mkk_arch.h
    2010-09-02 23:19:17 UTC (rev 5793)
+++ 
paparazzi3/trunk/sw/airborne/booz/arch/lpc21/actuators/booz_actuators_mkk_arch.h
    2010-09-03 01:56:44 UTC (rev 5794)
@@ -1,29 +0,0 @@
-/*
- * $Id$
- *  
- * Copyright (C) 2009 Antoine Drouin <address@hidden>
- *
- * 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. 
- */
-
-#ifndef BOOZ_ACTUATORS_MKK_ARCH_H
-#define BOOZ_ACTUATORS_MKK_ARCH_H
-
-#define BoozActuatorsMkkArchSend() {}
-
-#endif /* BOOZ_ACTUATORS_MKK_ARCH_H */

Deleted: 
paparazzi3/trunk/sw/airborne/booz/arch/stm32/actuators/booz_actuators_mkk_arch.c
===================================================================
--- 
paparazzi3/trunk/sw/airborne/booz/arch/stm32/actuators/booz_actuators_mkk_arch.c
    2010-09-02 23:19:17 UTC (rev 5793)
+++ 
paparazzi3/trunk/sw/airborne/booz/arch/stm32/actuators/booz_actuators_mkk_arch.c
    2010-09-03 01:56:44 UTC (rev 5794)
@@ -1,63 +0,0 @@
-#include "actuators/booz_actuators_mkk.h"
-
-#include "i2c.h"
-
-#include <stm32/rcc.h>
-#include <stm32/misc.h>
-
-void tim2_irq_handler(void);
-
-/* ---------------------------------------------------------------
-    TIM2 Configuration: Output Compare Timing Mode:
-    TIM2CLK = 36 MHz, Prescaler = 4, TIM2 counter clock = 7.2 MHz
-*/
-
-void booz_actuators_mkk_arch_init(void) {                      
-
-  /* TIM2 clock enable */
-  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
-
-  /* Time base configuration */                        
-  TIM_TimeBaseInitTypeDef  TIM_TimeBaseStructure;
-  TIM_TimeBaseStructure.TIM_Period = 3072;             
-  //  TIM_TimeBaseStructure.TIM_Period = 2048;         
-  TIM_TimeBaseStructure.TIM_Prescaler = 0;             
-  TIM_TimeBaseStructure.TIM_ClockDivision = 0; 
-  TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
-  TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure);      
-  /* Prescaler configuration */
-  TIM_PrescalerConfig(TIM2, 4, TIM_PSCReloadMode_Immediate);
-
-  /* Enable the TIM2 global Interrupt */               
-  NVIC_InitTypeDef NVIC_InitStructure;         
-  NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn;      
-  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
-  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;   
-  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;      
-  NVIC_Init(&NVIC_InitStructure);                      
-  
-  //  DEBUG5_INIT();
-
-  TIM_Cmd(TIM2, ENABLE);                                                       
                        
-
-}
-
-void tim2_irq_handler(void) {
-  //  DEBUG5_T();
-
-  /* Clear TIM2 update interrupt */
-  TIM_ClearITPendingBit(TIM2, TIM_IT_Update);
-  actuators_mkk.idx++;                                                 
-  if (actuators_mkk.idx<ACTUATORS_MKK_NB) {
-#ifdef KILL_MOTORS
-    DeviceBuf[0] = 0;
-#else
-    DeviceBuf[0] = supervision.commands[actuators_mkk.idx];
-#endif                                         
-    DeviceTransmit(actuators_addr[actuators_mkk.idx], 1, 
&actuators_mkk.i2c_done);
-  }                                                            
-  else {
-    actuators_mkk.status = IDLE;
-    TIM_ITConfig(TIM2, TIM_IT_Update, DISABLE);
-  }
-}

Deleted: 
paparazzi3/trunk/sw/airborne/booz/arch/stm32/actuators/booz_actuators_mkk_arch.h
===================================================================
--- 
paparazzi3/trunk/sw/airborne/booz/arch/stm32/actuators/booz_actuators_mkk_arch.h
    2010-09-02 23:19:17 UTC (rev 5793)
+++ 
paparazzi3/trunk/sw/airborne/booz/arch/stm32/actuators/booz_actuators_mkk_arch.h
    2010-09-03 01:56:44 UTC (rev 5794)
@@ -1,40 +0,0 @@
-/*
- * $Id$
- *  
- * Copyright (C) 2009 Antoine Drouin <address@hidden>
- *
- * 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. 
- */
-
-#ifndef BOOZ_ACTUATORS_MKK_ARCH_H
-#define BOOZ_ACTUATORS_MKK_ARCH_H
-
-#include <stm32/tim.h>
-#include <stm32/gpio.h>
-
-
-
-
-#define BoozActuatorsMkkArchSend() {           \
-    /*DEBUG5_T();*/                            \
-    TIM_SetCounter(TIM2, 0);                   \
-    TIM_ClearITPendingBit(TIM2, TIM_IT_Update); \
-    TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE); \
-  }
-
-#endif /* BOOZ_ACTUATORS_MKK_ARCH_H */

Modified: paparazzi3/trunk/sw/airborne/i2c.c
===================================================================
--- paparazzi3/trunk/sw/airborne/i2c.c  2010-09-02 23:19:17 UTC (rev 5793)
+++ paparazzi3/trunk/sw/airborne/i2c.c  2010-09-03 01:56:44 UTC (rev 5794)
@@ -74,8 +74,8 @@
 struct i2c_periph i2c1;
 
 void i2c1_init(void) {
-  i2c_init(&i2c2);
-  i2c2_hw_init();
+  i2c_init(&i2c1);
+  i2c1_hw_init();
 }
 
 #endif /* USE_I2C1 */

Modified: paparazzi3/trunk/sw/airborne/i2c.h
===================================================================
--- paparazzi3/trunk/sw/airborne/i2c.h  2010-09-02 23:19:17 UTC (rev 5793)
+++ paparazzi3/trunk/sw/airborne/i2c.h  2010-09-03 01:56:44 UTC (rev 5794)
@@ -78,6 +78,27 @@
 };
 
 
+#include <string.h>
+#define I2C_ZERO_EVENTS(_err) {                                            \
+    _err.irq_cnt = 0;                                              \
+    memset((void*)_err.event_chain, 0, sizeof(_err.event_chain));   \
+    memset((void*)_err.status_chain, 0, sizeof(_err.status_chain)); \
+  }
+
+#define ZEROS_ERR_COUNTER(_i2c_err) {                  \
+    _i2c_err.ack_fail_cnt = 0;                         \
+    _i2c_err.miss_start_stop_cnt = 0;                  \
+    _i2c_err.arb_lost_cnt = 0;                         \
+    _i2c_err.over_under_cnt = 0;                       \
+    _i2c_err.pec_recep_cnt = 0;                                \
+    _i2c_err.timeout_tlow_cnt = 0;                     \
+    _i2c_err.smbus_alert_cnt = 0;                      \
+    _i2c_err.unexpected_event_cnt = 0;                 \
+    _i2c_err.last_unexpected_event = 0;                        \
+    _i2c_err.er_irq_cnt = 0;                           \
+  }
+
+
 #ifdef USE_I2C0
 
 extern void i2c0_init(void);

Deleted: paparazzi3/trunk/sw/airborne/lisa/test_mc2.c
===================================================================
--- paparazzi3/trunk/sw/airborne/lisa/test_mc2.c        2010-09-02 23:19:17 UTC 
(rev 5793)
+++ paparazzi3/trunk/sw/airborne/lisa/test_mc2.c        2010-09-03 01:56:44 UTC 
(rev 5794)
@@ -1,67 +0,0 @@
-/*
- * $Id$
- *  
- * Copyright (C) 2009 Antoine Drouin <address@hidden>
- *
- * 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 "init_hw.h"
-#include "sys_time.h"
-#include "led.h"
-
-static inline void main_init( void );
-static inline void main_periodic_task( void );
-static inline void main_event_task( void );
-
-static uint8_t i2c_done;
-
-int main(void) {
-  main_init();
-
-  while(1) {
-    if (sys_time_periodic())
-      main_periodic_task();
-    main_event_task();
-  }
-
-  return 0;
-}
-
-static inline void main_init( void ) {
-  hw_init();
-  sys_time_init();
-}
-
-
-
-static inline void main_periodic_task( void ) {
-  
-  i2c1_buf[0] = 0x04;
-  i2c1_transmit(0x58, 1, &i2c_done);
-
-  LED_PERIODIC();
-
-}
-
-
-
-static inline void main_event_task( void ) {
-
-}

Modified: paparazzi3/trunk/sw/airborne/stm32/i2c_hw.c
===================================================================
--- paparazzi3/trunk/sw/airborne/stm32/i2c_hw.c 2010-09-02 23:19:17 UTC (rev 
5793)
+++ paparazzi3/trunk/sw/airborne/stm32/i2c_hw.c 2010-09-03 01:56:44 UTC (rev 
5794)
@@ -5,18 +5,6 @@
 #include <stm32/flash.h>
 #include <stm32/misc.h>
 
-#define ZEROS_ERR_COUNTER(_i2c_err) {                  \
-    _i2c_err.ack_fail_cnt = 0;                         \
-    _i2c_err.miss_start_stop_cnt = 0;                  \
-    _i2c_err.arb_lost_cnt = 0;                         \
-    _i2c_err.over_under_cnt = 0;                       \
-    _i2c_err.pec_recep_cnt = 0;                                \
-    _i2c_err.timeout_tlow_cnt = 0;                     \
-    _i2c_err.smbus_alert_cnt = 0;                      \
-    _i2c_err.unexpected_event_cnt = 0;                 \
-    _i2c_err.last_unexpected_event = 0;                        \
-    _i2c_err.er_irq_cnt = 0;                           \
-  }
 
 static void start_transaction(struct i2c_periph* p);
 
@@ -52,8 +40,8 @@
   }
 
 #define I2C1_ABORT_AND_RESET() {                                       \
-    struct i2c_transaction* trans = i2c1.trans[i2c1.trans_extract_idx];        
\
-    trans->status = I2CTransFailed;                                    \
+    struct i2c_transaction* trans2 = i2c1.trans[i2c1.trans_extract_idx]; \
+    trans2->status = I2CTransFailed;                                   \
     i2c1.status = I2CFailed;                                           \
     I2C_ITConfig(I2C1, I2C_IT_EVT | I2C_IT_BUF | I2C_IT_ERR, DISABLE); \
     I2C_Cmd(I2C1, DISABLE);                                            \
@@ -130,7 +118,7 @@
 void i2c1_ev_irq_handler(void) {
 
   uint32_t event = I2C_GetLastEvent(I2C1);
-  struct i2c_transaction* trans = i2c2.trans[i2c2.trans_extract_idx];
+  struct i2c_transaction* trans = i2c1.trans[i2c1.trans_extract_idx];
   switch (event) {
     /* EV5 */
   case I2C_EVENT_MASTER_MODE_SELECT:        
@@ -321,7 +309,7 @@
   I2C_ITConfig(I2C2, I2C_IT_ERR, ENABLE);
 
   //  DEBUG_SERVO1_INIT();
-  DEBUG_SERVO2_INIT();
+  //  DEBUG_SERVO2_INIT();
 
 }
 
@@ -590,14 +578,14 @@
 }
 
 void i2c2_ev_irq_handler(void) {
-  DEBUG_S4_ON();
+  //  DEBUG_S4_ON();
   uint32_t event = I2C_GetLastEvent(I2C2);
   struct i2c_transaction* trans = i2c2.trans[i2c2.trans_extract_idx];
   //#if 0
   //  if (i2c2_errors.irq_cnt < 16) {
-  i2c2_errors.event_chain[i2c2_errors.irq_cnt] = event;
-  i2c2_errors.status_chain[i2c2_errors.irq_cnt] = i2c2.status;
-  i2c2_errors.irq_cnt++;
+  //  i2c2_errors.event_chain[i2c2_errors.irq_cnt] = event;
+  //  i2c2_errors.status_chain[i2c2_errors.irq_cnt] = i2c2.status;
+  //  i2c2_errors.irq_cnt++;
   //  } else { while (1);}
   //#endif
   switch (i2c2.status) {
@@ -646,7 +634,7 @@
     OUT_OF_SYNC_STATE_MACHINE(i2c2.status, event);
     break;
   }
-  DEBUG_S4_OFF();
+  //  DEBUG_S4_OFF();
 }
 
 
@@ -725,7 +713,7 @@
 static void start_transaction(struct i2c_periph* p) {
   p->idx_buf = 0;
   p->status = I2CStartRequested;
-  I2C_ZERO_EVENTS();
+  //  I2C_ZERO_EVENTS();
   I2C_ITConfig(p->reg_addr, I2C_IT_EVT, ENABLE);
   I2C_GenerateSTART(p->reg_addr, ENABLE);
 }

Modified: paparazzi3/trunk/sw/airborne/stm32/i2c_hw.h
===================================================================
--- paparazzi3/trunk/sw/airborne/stm32/i2c_hw.h 2010-09-02 23:19:17 UTC (rev 
5793)
+++ paparazzi3/trunk/sw/airborne/stm32/i2c_hw.h 2010-09-03 01:56:44 UTC (rev 
5794)
@@ -52,12 +52,6 @@
 extern void i2c2_ev_irq_handler(void);
 extern void i2c2_er_irq_handler(void);
 
-#include <string.h>
-#define I2C_ZERO_EVENTS() {                                            \
-    i2c2_errors.irq_cnt = 0;                                           \
-    memset((void*)i2c2_errors.event_chain, 0, 
sizeof(i2c2_errors.event_chain)); \
-    memset((void*)i2c2_errors.status_chain, 0, 
sizeof(i2c2_errors.status_chain)); \
-  }
 
 #endif /* USE_I2C2 */
 

Added: paparazzi3/trunk/sw/airborne/test/test_actuators.c
===================================================================
--- paparazzi3/trunk/sw/airborne/test/test_actuators.c                          
(rev 0)
+++ paparazzi3/trunk/sw/airborne/test/test_actuators.c  2010-09-03 01:56:44 UTC 
(rev 5794)
@@ -0,0 +1,74 @@
+/*
+ * $Id$
+ *  
+ * Copyright (C) 2009 Antoine Drouin <address@hidden>
+ *
+ * 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 "init_hw.h"
+#include "sys_time.h"
+#include "led.h"
+
+#include "i2c.h"
+#include "booz/booz2_commands.h"
+#include "booz/booz_actuators.h"
+
+static inline void main_init( void );
+static inline void main_periodic_task( void );
+static inline void main_event_task( void );
+
+int main(void) {
+  main_init();
+
+  while(1) {
+    if (sys_time_periodic())
+      main_periodic_task();
+    main_event_task();
+  }
+
+  return 0;
+}
+
+static inline void main_init( void ) {
+  hw_init();
+  sys_time_init();
+  actuators_init();
+}
+
+
+
+static inline void main_periodic_task( void ) {
+  
+  booz2_commands[COMMAND_ROLL]=0;
+  booz2_commands[COMMAND_PITCH]=0;
+  booz2_commands[COMMAND_YAW]=0;
+  booz2_commands[COMMAND_THRUST]=1;
+
+  actuators_set(TRUE);
+
+  LED_PERIODIC();
+
+}
+
+
+
+static inline void main_event_task( void ) {
+
+}

Added: paparazzi3/trunk/sw/airborne/test/test_esc_asctecv1_simple.c
===================================================================
--- paparazzi3/trunk/sw/airborne/test/test_esc_asctecv1_simple.c                
                (rev 0)
+++ paparazzi3/trunk/sw/airborne/test/test_esc_asctecv1_simple.c        
2010-09-03 01:56:44 UTC (rev 5794)
@@ -0,0 +1,75 @@
+/*
+ * $Id$
+ *  
+ * Copyright (C) 2009 Antoine Drouin <address@hidden>
+ *
+ * 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 "init_hw.h"
+#include "sys_time.h"
+#include "led.h"
+
+#include "i2c.h"
+
+static inline void main_init( void );
+static inline void main_periodic_task( void );
+static inline void main_event_task( void );
+
+static struct i2c_transaction trans;
+
+int main(void) {
+  main_init();
+
+  while(1) {
+    if (sys_time_periodic())
+      main_periodic_task();
+    main_event_task();
+  }
+
+  return 0;
+}
+
+static inline void main_init( void ) {
+  hw_init();
+  sys_time_init();
+}
+
+
+
+static inline void main_periodic_task( void ) {
+  
+  trans.type = I2CTransTx;
+  trans.slave_addr = 0x02;
+  trans.len_w = 4;
+  trans.buf[0] = 100;
+  trans.buf[1] = 100;
+  trans.buf[2] = 100;
+  trans.buf[3] = 1;
+  i2c_submit(&i2c1,&trans);
+
+  LED_PERIODIC();
+
+}
+
+
+
+static inline void main_event_task( void ) {
+
+}

Copied: paparazzi3/trunk/sw/airborne/test/test_esc_mkk_simple.c (from rev 5787, 
paparazzi3/trunk/sw/airborne/lisa/test_mc2.c)
===================================================================
--- paparazzi3/trunk/sw/airborne/test/test_esc_mkk_simple.c                     
        (rev 0)
+++ paparazzi3/trunk/sw/airborne/test/test_esc_mkk_simple.c     2010-09-03 
01:56:44 UTC (rev 5794)
@@ -0,0 +1,72 @@
+/*
+ * $Id$
+ *  
+ * Copyright (C) 2009 Antoine Drouin <address@hidden>
+ *
+ * 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 "init_hw.h"
+#include "sys_time.h"
+#include "led.h"
+
+#include "i2c.h"
+
+static inline void main_init( void );
+static inline void main_periodic_task( void );
+static inline void main_event_task( void );
+
+static struct i2c_transaction trans;
+
+int main(void) {
+  main_init();
+
+  while(1) {
+    if (sys_time_periodic())
+      main_periodic_task();
+    main_event_task();
+  }
+
+  return 0;
+}
+
+static inline void main_init( void ) {
+  hw_init();
+  sys_time_init();
+}
+
+
+
+static inline void main_periodic_task( void ) {
+  
+  trans.type = I2CTransTx;
+  trans.buf[0] = 0x04;
+  trans.len_w = 1;
+  trans.slave_addr = 0x58;
+  i2c_submit(&i2c1,&trans);
+
+  LED_PERIODIC();
+
+}
+
+
+
+static inline void main_event_task( void ) {
+
+}




reply via email to

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