[modules] start cleaning modules (#896)

This commit is contained in:
Gautier Hattenberger
2015-05-29 17:06:03 +02:00
parent 2b73d7f83d
commit c50e6f23ee
27 changed files with 117 additions and 160 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
<airframe name="FireStorm"> <airframe name="FireStorm">
<modules> <modules>
<load name="poles.xml"/> <load name="nav_poles.xml"/>
</modules> </modules>
<firmware name="fixedwing"> <firmware name="fixedwing">
+1 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE module SYSTEM "module.dtd"> <!DOCTYPE module SYSTEM "module.dtd">
<module name="MPPT"> <module name="MPPT" dir="energy">
<doc> <doc>
<description> <description>
Maximum Power Point Tracker Maximum Power Point Tracker
+1 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE module SYSTEM "module.dtd"> <!DOCTYPE module SYSTEM "module.dtd">
<module name="bat_checker"> <module name="bat_checker" dir="energy">
<doc> <doc>
<description>Battery checker module</description> <description>Battery checker module</description>
<define name="BAT_CHECKER_DELAY" value="delay" description="number of seconds the battery voltage has to below LOW_BAT_LEVEL before warning signal is activated"/> <define name="BAT_CHECKER_DELAY" value="delay" description="number of seconds the battery voltage has to below LOW_BAT_LEVEL before warning signal is activated"/>
-34
View File
@@ -1,34 +0,0 @@
<!DOCTYPE module SYSTEM "module.dtd">
<module name="deploy_sonar_buoy">
<doc>
<description>
Toggle two gpio pins (Lisa).
The application in this was written for drops two sonar buoys.
</description>
</doc>
<settings>
<dl_settings>
<dl_settings NAME="Sonar Buoys">
<dl_setting var="buoy_1" min="0" step="1" max="1" module="deploy_sonar_buoy/deploy_sonar_buoy" values="Secure|Deployed">
<strip_button name="Secure" value="1"/>
<strip_button name="Deployed" value="0"/>
</dl_setting>
<dl_setting var="buoy_2" min="0" step="1" max="1" module="deploy_sonar_buoy/deploy_sonar_buoy" values="Secure|Deployed">
<strip_button name="Secure" value="1"/>
<strip_button name="Deployed" value="0"/>
</dl_setting>
</dl_settings>
</dl_settings>
</settings>
<header>
<file name="deploy_sonar_buoy.h"/>
</header>
<init fun="deploy_sonar_buoy_init()"/>
<periodic fun="deploy_sonar_buoy_periodic()" freq="10."/>
<makefile>
<file name="deploy_sonar_buoy.c"/>
</makefile>
</module>
+1 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE module SYSTEM "module.dtd"> <!DOCTYPE module SYSTEM "module.dtd">
<module name="gain_scheduling"> <module name="gain_scheduling" dir="ctrl">
<doc> <doc>
<description> <description>
Gain set interpolation. Gain set interpolation.
+1 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE module SYSTEM "module.dtd"> <!DOCTYPE module SYSTEM "module.dtd">
<module name="gps_i2c"> <module name="gps_i2c" dir="gps">
<doc> <doc>
<description> <description>
U-blox GPS (I2C) U-blox GPS (I2C)
+1 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE module SYSTEM "module.dtd"> <!DOCTYPE module SYSTEM "module.dtd">
<module name="led_safety_status"> <module name="led_safety_status" dir="light">
<doc> <doc>
<description> <description>
LED safety indicator. LED safety indicator.
@@ -1,15 +1,15 @@
<!DOCTYPE module SYSTEM "module.dtd"> <!DOCTYPE module SYSTEM "module.dtd">
<module name="poles"> <module name="poles" dir="nav">
<doc> <doc>
<description>Navigate around two poles</description> <description>Navigate around two poles</description>
</doc> </doc>
<settings> <settings>
<dl_settings> <dl_settings>
<dl_settings NAME="Poles"> <dl_settings NAME="Poles">
<dl_setting MAX="40" MIN="1" STEP="1" VAR="nav_poles_count" module="modules/poles/nav_poles"/> <dl_setting MAX="40" MIN="1" STEP="1" VAR="nav_poles_count" module="modules/nav/nav_poles"/>
<dl_setting MAX="180" MIN="0" STEP="1" VAR="nav_poles_time"/> <dl_setting MAX="180" MIN="0" STEP="1" VAR="nav_poles_time"/>
<dl_setting MAX="1" MIN="-1" STEP="2" VAR="nav_poles_land" module="modules/poles/nav_poles" handler="SetLandDir"/> <dl_setting MAX="1" MIN="-1" STEP="2" VAR="nav_poles_land" module="modules/nav/nav_poles" handler="SetLandDir"/>
</dl_settings> </dl_settings>
</dl_settings> </dl_settings>
</settings> </settings>
+1 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE module SYSTEM "module.dtd"> <!DOCTYPE module SYSTEM "module.dtd">
<module name="max7456" dir="max7456"> <module name="max7456" dir="display">
<doc> <doc>
<description>MAX7456 driver (SPI)</description> <description>MAX7456 driver (SPI)</description>
</doc> </doc>
@@ -19,11 +19,11 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
/** @file gain_scheduling.c /** @file modules/ctrl/gain_scheduling.c
* Module that interpolates gainsets in flight based on a scheduling variable * Module that interpolates gainsets in flight based on a scheduling variable
*/ */
#include "gain_scheduling.h" #include "modules/ctrl/gain_scheduling.h"
//Include for scheduling on transition_status //Include for scheduling on transition_status
#include "firmwares/rotorcraft/guidance/guidance_h.h" #include "firmwares/rotorcraft/guidance/guidance_h.h"
@@ -131,4 +131,4 @@ void gain_scheduling_periodic(void)
void set_gainset(int gainset) void set_gainset(int gainset)
{ {
stabilization_gains = gainlibrary[gainset]; stabilization_gains = gainlibrary[gainset];
} }
@@ -20,7 +20,7 @@
*/ */
/** /**
* @file gain_scheduling.h * @file modules/ctrl/gain_scheduling.h
* *
* Module that interpolates between gain sets, depending on the scheduling variable. * Module that interpolates between gain sets, depending on the scheduling variable.
*/ */
@@ -1,68 +0,0 @@
/*
* Copyright (C) 2010 Eric Parsonage
*
* 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 <stm32/gpio.h>
#include <stm32/rcc.h>
#include "deploy_sonar_buoy.h"
#include "generated/airframe.h"
/* simple module to toggle two gpio pins on Lisa.
* The application in this was written for drops
* two sonar buoys. TODO extend to a generalised
* GPIO module
*/
bool_t buoy_1;
bool_t buoy_2;
/* initialises GPIO pins */
void deploy_sonar_buoy_init(void)
{
/* initialise peripheral clock for port C */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC, &GPIO_InitStructure);
/* set port C pin 5 to be low */
GPIO_WriteBit(GPIOC, GPIO_Pin_5 , Bit_RESET);
/* initialise peripheral clock for port B */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* set port B pin 0 to be low */
GPIO_WriteBit(GPIOB, GPIO_Pin_0 , Bit_RESET);
/* set the variables of interest to be FALSE */
buoy_1 = FALSE;
buoy_2 = FALSE;
deploy_sonar_buoy_periodic();
}
/* sets GPIO pins */
void deploy_sonar_buoy_periodic(void)
{
GPIO_WriteBit(GPIOC, GPIO_Pin_5 , buoy_1 ? Bit_SET : Bit_RESET);
GPIO_WriteBit(GPIOB, GPIO_Pin_0 , buoy_2 ? Bit_SET : Bit_RESET);
}
@@ -20,7 +20,7 @@
*/ */
/** /**
* @file modules/max7456/max7456.c * @file modules/display/max7456.c
* Maxim MAX7456 single-channel monochrome on-screen display driver. * Maxim MAX7456 single-channel monochrome on-screen display driver.
* *
*/ */
@@ -46,8 +46,8 @@
#endif #endif
// Peripherials // Peripherials
#include "max7456.h" #include "modules/display/max7456.h"
#include "max7456_regs.h" #include "modules/display/max7456_regs.h"
#define OSD_STRING_SIZE 31 #define OSD_STRING_SIZE 31
#define osd_sprintf _osd_sprintf #define osd_sprintf _osd_sprintf
@@ -20,6 +20,12 @@
* *
*/ */
/**
* @file modules/display/max7456.h
* Maxim MAX7456 single-channel monochrome on-screen display driver.
*
*/
#ifndef MAX7456_H #ifndef MAX7456_H
#define MAX7456_H #define MAX7456_H
@@ -1,3 +1,32 @@
/*
* Copyright (C) 2013 Chris
*
* 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 modules/display/max7456_regs.h
* Maxim MAX7456 single-channel monochrome on-screen display driver.
*
* Registers definition
*/
#ifndef MAX7456_REGS_H #ifndef MAX7456_REGS_H
#define MAX7456_REGS_H #define MAX7456_REGS_H
@@ -21,13 +21,13 @@
*/ */
/** /**
* @file modules/MPPT/MPPT.c * @file modules/energy/MPPT.c
* @brief Solar cells MPTT monitoring * @brief Solar cells MPTT monitoring
* *
*/ */
#include <stdbool.h> #include <stdbool.h>
#include "MPPT.h" #include "modules/energy/MPPT.h"
#include "firmwares/fixedwing/main_fbw.h" #include "firmwares/fixedwing/main_fbw.h"
#include "mcu_periph/i2c.h" #include "mcu_periph/i2c.h"
@@ -21,7 +21,7 @@
*/ */
/** /**
* @file modules/MPPT/MPPT.h * @file modules/energy/MPPT.h
* @brief Solar cells MPTT monitoring * @brief Solar cells MPTT monitoring
* *
*/ */
@@ -20,14 +20,14 @@
*/ */
/** /**
* @file modules/bat_checker/bat_checker.c * @file modules/energy/bat_checker.c
* *
* Activate a buzzer/LED periodically or periodically to warn of low/critical battery level. * Activate a buzzer/LED periodically or periodically to warn of low/critical battery level.
* At LOW_BAT_LEVEL the buzzer will be activated periodically. * At LOW_BAT_LEVEL the buzzer will be activated periodically.
* At CRITIC_BAT_LEVEL the buzzer will be activated permanently. * At CRITIC_BAT_LEVEL the buzzer will be activated permanently.
*/ */
#include "bat_checker.h" #include "modules/energy/bat_checker.h"
#include "generated/airframe.h" #include "generated/airframe.h"
#include "generated/modules.h" #include "generated/modules.h"
#include "subsystems/electrical.h" #include "subsystems/electrical.h"
@@ -20,7 +20,7 @@
*/ */
/** /**
* @file modules/bat_checker/bat_checker.c * @file modules/energy/bat_checker.c
* *
* Activate a buzzer/LED periodically or periodically to warn of low/critical battery level. * Activate a buzzer/LED periodically or periodically to warn of low/critical battery level.
* At LOW_BAT_LEVEL the buzzer will be activated periodically. * At LOW_BAT_LEVEL the buzzer will be activated periodically.
@@ -21,7 +21,7 @@
*/ */
#include "MPPT.h" #include "modules/energy/MPPT.h"
#include "messages.h" #include "messages.h"
#include "subsystems/datalink/downlink.h" #include "subsystems/datalink/downlink.h"
@@ -20,7 +20,7 @@
* *
*/ */
#include "gps_i2c.h" #include "modules/gps/gps_i2c.h"
#include "mcu_periph/i2c.h" #include "mcu_periph/i2c.h"
#include "subsystems/gps.h" #include "subsystems/gps.h"
@@ -19,6 +19,13 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
/**
* @file modules/light/led_safety_status.c
*
* Simple module to blink LEDs when battery voltage drops below a certain
* level, radio control is lost or when takeoff safety conditions are not met.
*/
#include "led.h" #include "led.h"
#include "generated/airframe.h" #include "generated/airframe.h"
#include "subsystems/electrical.h" #include "subsystems/electrical.h"
@@ -27,7 +34,7 @@
#include "subsystems/ahrs/ahrs_aligner.h" #include "subsystems/ahrs/ahrs_aligner.h"
#include "autopilot_rc_helpers.h" #include "autopilot_rc_helpers.h"
#include "led_safety_status.h" #include "modules/light/led_safety_status.h"
#ifndef SAFETY_WARNING_LED #ifndef SAFETY_WARNING_LED
#error You must define SAFETY_WARNING_LED to use this module! #error You must define SAFETY_WARNING_LED to use this module!
@@ -1,4 +1,3 @@
/* /*
* Copyright (C) 2012 Pranay Sinha <psinha@transition-robotics.com> * Copyright (C) 2012 Pranay Sinha <psinha@transition-robotics.com>
* *
@@ -21,7 +20,7 @@
*/ */
/** /**
* @file led_safety_status.h * @file modules/light/led_safety_status.h
* *
* Simple module to blink LEDs when battery voltage drops below a certain * Simple module to blink LEDs when battery voltage drops below a certain
* level, radio control is lost or when takeoff safety conditions are not met. * level, radio control is lost or when takeoff safety conditions are not met.
@@ -1,4 +1,29 @@
#include "modules/poles/nav_poles.h" /*
* Copyright (C) 2009-2015 ENAC
*
* 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, see
* <http://www.gnu.org/licenses/>.
*/
/**
* @file modules/nav/nav_poles.c
*
*/
#include "modules/nav/nav_poles.h"
#include "subsystems/navigation/common_nav.h" #include "subsystems/navigation/common_nav.h"
uint8_t nav_poles_count = 0; uint8_t nav_poles_count = 0;
@@ -29,3 +54,4 @@ bool nav_poles_init(uint8_t wp1, uint8_t wp2,
return false; return false;
} }
@@ -1,6 +1,5 @@
/* /*
* Copyright (C) 2010 Eric Parsonage * Copyright (C) 2009-2015 ENAC
* *
* This file is part of paparazzi. * This file is part of paparazzi.
* *
@@ -15,20 +14,30 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, write to * along with paparazzi; see the file COPYING. If not, see
* the Free Software Foundation, 59 Temple Place - Suite 330, * <http://www.gnu.org/licenses/>.
* Boston, MA 02111-1307, USA.
*/ */
/**
* @file modules/nav/nav_poles.h
*
*/
#ifndef DEPLOY_SONAR_BUOY_H #ifndef NAV_POLES_H
#define DEPLOY_SONAR_BUOY_H #define NAV_POLES_H
#include <stdbool.h>
#include "std.h" #include "std.h"
extern bool_t buoy_1; extern uint8_t nav_poles_count;
extern bool_t buoy_2; extern float nav_poles_time;
extern void deploy_sonar_buoy_init(void); extern int8_t nav_poles_land;
extern void deploy_sonar_buoy_periodic(void);
bool nav_poles_init(uint8_t wp1, uint8_t wp2,
uint8_t wp1c, uint8_t wp2c,
float radius);
#define nav_poles_SetLandDir(_d) { if (_d < 0) _d = -1; else _d = 1; }
#endif
#endif /* DEPLOY_SONAR_BUOY_H */
-17
View File
@@ -1,17 +0,0 @@
#ifndef NAV_POLS_H
#define NAV_POLS_H
#include <stdbool.h>
#include "std.h"
extern uint8_t nav_poles_count;
extern float nav_poles_time;
extern int8_t nav_poles_land;
bool nav_poles_init(uint8_t wp1, uint8_t wp2,
uint8_t wp1c, uint8_t wp2c,
float radius);
#define nav_poles_SetLandDir(_d) { if (_d < 0) _d = -1; else _d = 1; }
#endif