From 448b06fe14c11535d10f3683a28ef4cf11d3bd6f Mon Sep 17 00:00:00 2001 From: Ewoud Smeur Date: Fri, 26 Oct 2012 13:24:02 -0700 Subject: [PATCH] Added the doxygen comments, changed name of the module and fixed the define check --- conf/airframes/esden/hexy_ll11a2pwm.xml | 2 +- conf/airframes/esden/quady_lm2a2pwm.xml | 4 +-- conf/modules/led_safety_status.xml | 15 +++++++++++ conf/modules/safety_warnings.xml | 12 --------- .../led_safety_status.c} | 23 +++++++--------- .../led_safety_status.h} | 26 +++++++++++++++---- 6 files changed, 48 insertions(+), 34 deletions(-) create mode 100644 conf/modules/led_safety_status.xml delete mode 100644 conf/modules/safety_warnings.xml rename sw/airborne/modules/{safety_warnings/safety_warnings.c => led_safety_status/led_safety_status.c} (86%) rename sw/airborne/modules/{safety_warnings/safety_warnings.h => led_safety_status/led_safety_status.h} (60%) diff --git a/conf/airframes/esden/hexy_ll11a2pwm.xml b/conf/airframes/esden/hexy_ll11a2pwm.xml index 0dd3e96f724..6ae1d2b368e 100644 --- a/conf/airframes/esden/hexy_ll11a2pwm.xml +++ b/conf/airframes/esden/hexy_ll11a2pwm.xml @@ -212,7 +212,7 @@ - + diff --git a/conf/airframes/esden/quady_lm2a2pwm.xml b/conf/airframes/esden/quady_lm2a2pwm.xml index d629cd876f4..1bf2b1d5ede 100644 --- a/conf/airframes/esden/quady_lm2a2pwm.xml +++ b/conf/airframes/esden/quady_lm2a2pwm.xml @@ -170,8 +170,8 @@ - - + + diff --git a/conf/modules/led_safety_status.xml b/conf/modules/led_safety_status.xml new file mode 100644 index 00000000000..6f416755bce --- /dev/null +++ b/conf/modules/led_safety_status.xml @@ -0,0 +1,15 @@ + + + + + LED module that blinks in different patterns in different safety situations + +
+ +
+ + + + + +
diff --git a/conf/modules/safety_warnings.xml b/conf/modules/safety_warnings.xml deleted file mode 100644 index 6f0cd70ae14..00000000000 --- a/conf/modules/safety_warnings.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - -
- -
- - - - - -
diff --git a/sw/airborne/modules/safety_warnings/safety_warnings.c b/sw/airborne/modules/led_safety_status/led_safety_status.c similarity index 86% rename from sw/airborne/modules/safety_warnings/safety_warnings.c rename to sw/airborne/modules/led_safety_status/led_safety_status.c index 371628a6cf9..3e7f65ea814 100644 --- a/sw/airborne/modules/safety_warnings/safety_warnings.c +++ b/sw/airborne/modules/led_safety_status/led_safety_status.c @@ -20,6 +20,7 @@ * the Free Software Foundation, 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ + #include "led.h" #include "generated/airframe.h" #include "subsystems/electrical.h" @@ -28,24 +29,18 @@ #include "subsystems/ahrs/ahrs_aligner.h" #include "autopilot_rc_helpers.h" -#include "safety_warnings.h" +#include "led_safety_status.h" -/* - * simple module to blink LEDs when battery voltage drops below a certain - * level, as well as when AHRS is not aligned or when takeoff safety conditions - * are not met. - */ +#ifndef SAFETY_WARNING_LED +#error You must define SAFETY_WARNING_LED to use this module! +#else -/* initialises periodic loop; place more init functions here if expanding driver */ -void safety_warnings_init(void) { +void led_safety_status_init(void) { LED_ON(SAFETY_WARNING_LED); - safety_warnings_periodic(); + led_safety_status_periodic(); } - -void safety_warnings_periodic(void) { - -#ifdef SAFETY_WARNING_LED +void led_safety_status_periodic(void) { if (radio_control.status == RC_LOST || radio_control.status == RC_REALLY_LOST){ RunXTimesEvery(0, 60, 5, 7, {LED_TOGGLE(SAFETY_WARNING_LED);}); RunXTimesEvery(130, 130, 10, 6, {LED_TOGGLE(SAFETY_WARNING_LED);}); @@ -81,5 +76,5 @@ void safety_warnings_periodic(void) { else { LED_ON(SAFETY_WARNING_LED); } -#endif } +#endif diff --git a/sw/airborne/modules/safety_warnings/safety_warnings.h b/sw/airborne/modules/led_safety_status/led_safety_status.h similarity index 60% rename from sw/airborne/modules/safety_warnings/safety_warnings.h rename to sw/airborne/modules/led_safety_status/led_safety_status.h index feebe0a8518..9be6bec656e 100644 --- a/sw/airborne/modules/safety_warnings/safety_warnings.h +++ b/sw/airborne/modules/led_safety_status/led_safety_status.h @@ -21,13 +21,29 @@ * the Free Software Foundation, 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ -#ifndef SAFETY_WARNINGS_H -#define SAFETY_WARNINGS_H + +/** + * @file led_safety_status.h + * + * 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. + */ + +#ifndef LED_SAFETY_STATUS_H +#define LED_SAFETY_STATUS_H #include "std.h" -extern void safety_warnings_init(void); -extern void safety_warnings_periodic(void); +/** + * Initialises periodic loop; place more init functions here if expanding driver + */ +extern void led_safety_status_init(void); + +/** + * Periodic function that makes the leds blink in the right pattern for + * each situation. + */ +extern void led_safety_status_periodic(void); -#endif /* SAFETY_WARNINGS_H */ +#endif /* LED_SAFETY_STATUS_H */