booz_drop is now a module

This commit is contained in:
Gautier Hattenberger
2010-03-02 09:13:17 +00:00
parent c14bf86b83
commit 74e9f9ae1f
6 changed files with 95 additions and 45 deletions
+15
View File
@@ -0,0 +1,15 @@
<!DOCTYPE module SYSTEM "module.dtd">
<module name="drop">
<!-- depend require="booz_pwm" -->
<header>
<file name="booz_drop.h"/>
</header>
<init fun="booz_drop_init()"/>
<periodic fun="booz_drop_periodic()" freq="10."/>
<makefile>
<flag name="USE_DROP"/>
<file name="booz_drop.c"/>
</makefile>
</module>
-12
View File
@@ -57,10 +57,6 @@
#include "booz2_cam.h"
#endif
#ifdef USE_DROP
#include "booz_drop.h"
#endif
#if defined USE_CAM || USE_DROP
#include "booz2_pwm_hw.h"
#endif
@@ -139,10 +135,6 @@ STATIC_INLINE void booz2_main_init( void ) {
booz2_cam_init();
#endif
#ifdef USE_DROP
booz_drop_init();
#endif
#ifdef BOOZ2_SONAR
booz2_sonar_init();
#endif
@@ -212,10 +204,6 @@ STATIC_INLINE void booz2_main_periodic( void ) {
RunOnceEvery(50,booz2_cam_periodic());
#endif
#ifdef USE_DROP
RunOnceEvery(50,booz_drop_periodic());
#endif
#ifdef BOOZ2_SONAR
booz2_analog_periodic();
#endif
-22
View File
@@ -1,22 +0,0 @@
#include "booz_drop.h"
#include "booz2_pwm_hw.h"
bool_t booz_drop_ball;
int16_t booz_drop_servo;
#define DROP_SERVO_OPEN 1700
#define DROP_SERVO_CLOSED 900
void booz_drop_init(void) {
booz_drop_ball = FALSE;
booz_drop_periodic();
}
void booz_drop_periodic(void) {
if (booz_drop_ball == TRUE)
booz_drop_servo = DROP_SERVO_OPEN;
else
booz_drop_servo = DROP_SERVO_CLOSED;
Booz2SetPwmValue(booz_drop_servo);
}
-11
View File
@@ -1,11 +0,0 @@
#ifndef BOOZ_DROP_H
#define BOOZ_DROP_H
#include "std.h"
extern bool_t booz_drop_ball;
extern void booz_drop_init(void);
extern void booz_drop_periodic(void);
#endif /* BOOZ_DROP_H */
+45
View File
@@ -0,0 +1,45 @@
/*
* $Id: $
*
* Copyright (C) 2009 Flixr
*
* 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 "booz_drop.h"
#include "booz2_pwm_hw.h"
bool_t booz_drop_ball;
int16_t booz_drop_servo;
#define DROP_SERVO_OPEN 1700
#define DROP_SERVO_CLOSED 900
void booz_drop_init(void) {
booz_drop_ball = FALSE;
booz_drop_periodic();
}
void booz_drop_periodic(void) {
if (booz_drop_ball == TRUE)
booz_drop_servo = DROP_SERVO_OPEN;
else
booz_drop_servo = DROP_SERVO_CLOSED;
Booz2SetPwmValue(booz_drop_servo);
}
+35
View File
@@ -0,0 +1,35 @@
/*
* $Id: $
*
* Copyright (C) 2009 Flixr
*
* 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_DROP_H
#define BOOZ_DROP_H
#include "std.h"
extern bool_t booz_drop_ball;
extern void booz_drop_init(void);
extern void booz_drop_periodic(void);
#endif /* BOOZ_DROP_H */