Skip to content

Commit

Permalink
Added the doxygen comments, changed name of the module and fixed the …
Browse files Browse the repository at this point in the history
…define check
  • Loading branch information
EwoudSmeur committed Oct 26, 2012
1 parent 4e56764 commit 448b06f
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 34 deletions.
2 changes: 1 addition & 1 deletion conf/airframes/esden/hexy_ll11a2pwm.xml
Expand Up @@ -212,7 +212,7 @@
<modules main_freq="512">
<!--load name="vehicle_interface_overo_link.xml"/-->
<load name="gps_ubx_ucenter.xml"/>
<load name="safety_warnings.xml"/>
<load name="led_safety_status.xml"/>
</modules>

<firmware name="rotorcraft">
Expand Down
4 changes: 2 additions & 2 deletions conf/airframes/esden/quady_lm2a2pwm.xml
Expand Up @@ -170,8 +170,8 @@
<!--load name="vehicle_interface_overo_link.xml"/-->
<load name="gps_ubx_ucenter.xml"/>

<load name="safety_warnings.xml">
<define name="SAFETY_WARNING_LED" value="5"/>
<load name="led_safety_status.xml">
<define name="SAFETY_WARNING_LED" value="5"/>
</load>
</modules>

Expand Down
15 changes: 15 additions & 0 deletions conf/modules/led_safety_status.xml
@@ -0,0 +1,15 @@
<!DOCTYPE module SYSTEM "module.dtd">

<module name="led_safety_status">
<doc>
<description> LED module that blinks in different patterns in different safety situations </description>
</doc>
<header>
<file name="led_safety_status.h"/>
</header>
<init fun="led_safety_status_init()"/>
<periodic fun="led_safety_status_periodic()" freq="100"/>
<makefile>
<file name="led_safety_status.c"/>
</makefile>
</module>
12 changes: 0 additions & 12 deletions conf/modules/safety_warnings.xml

This file was deleted.

Expand Up @@ -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"
Expand All @@ -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);});
Expand Down Expand Up @@ -81,5 +76,5 @@ void safety_warnings_periodic(void) {
else {
LED_ON(SAFETY_WARNING_LED);
}
#endif
}
#endif
Expand Up @@ -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 */

0 comments on commit 448b06f

Please sign in to comment.