APM:Libraries
libraries
AP_Notify
ExternalLED.h
Go to the documentation of this file.
1
/*
2
This program is free software: you can redistribute it and/or modify
3
it under the terms of the GNU General Public License as published by
4
the Free Software Foundation, either version 3 of the License, or
5
(at your option) any later version.
6
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
11
12
You should have received a copy of the GNU General Public License
13
along with this program. If not, see <http://www.gnu.org/licenses/>.
14
*/
15
16
#pragma once
17
18
#include <
AP_Common/AP_Common.h
>
19
#include <
AP_HAL/AP_HAL.h
>
20
#include <
AP_Param/AP_Param.h
>
21
22
#include "
NotifyDevice.h
"
23
24
#define HIGH 1
25
#define LOW 0
26
27
class
ExternalLED
:
public
NotifyDevice
28
{
29
public
:
30
// constructor
31
ExternalLED
() :
_counter
(0),
_counter2
(0),
_pattern
(
NONE
),
_pattern_counter
(0) {}
32
33
// initialise the LED driver
34
bool
init
(
void
);
35
36
// should be called at 50Hz
37
void
update
(
void
);
38
39
private
:
40
41
enum
LEDPattern
{
42
NONE
= 0,
43
FAST_FLASH
= 1,
44
OSCILLATE
= 2
45
};
46
48
struct
copterleds_flag_type
{
49
// individual led status
50
uint8_t
armedled_on
: 1;
// 1 if the armed led is currently on
51
uint8_t
gpsled_on
: 1;
// 1 if the gps led is currently on
52
uint8_t
motorled1_on
: 1;
// 1 if motor led #1 is currently on
53
uint8_t
motorled2_on
: 1;
// 1 if motor led #2 is currently on
54
}
_flags
;
55
56
uint8_t
_counter
;
// reduces 50hz calls to 10hz
57
uint8_t
_counter2
;
// used to control steps of arming and gps leds
58
LEDPattern
_pattern
;
// current pattern for motor leds
59
uint8_t
_pattern_counter
;
// used to time on/off of current patter
60
61
// armed_led - set armed light on or off
62
void
armed_led
(
bool
on_off);
63
64
// gps_led - set gps light on or off
65
void
gps_led
(
bool
on_off);
66
67
// set_pattern - sets pattern for motor leds
68
void
set_pattern
(
LEDPattern
pattern_id);
69
70
// motor_led1, motor_led2 - set motor lights on or off
71
void
motor_led1
(
bool
on_off);
72
void
motor_led2
(
bool
on_off);
73
};
ExternalLED::copterleds_flag_type
buzzer_flag_type - bitmask of current state and ap_notify states we track
Definition:
ExternalLED.h:48
ExternalLED::_pattern_counter
uint8_t _pattern_counter
Definition:
ExternalLED.h:59
ExternalLED::_flags
struct ExternalLED::copterleds_flag_type _flags
ExternalLED::NONE
Definition:
ExternalLED.h:42
ExternalLED::motor_led1
void motor_led1(bool on_off)
NotifyDevice.h
AP_HAL.h
ExternalLED::_pattern
LEDPattern _pattern
Definition:
ExternalLED.h:58
ExternalLED::_counter2
uint8_t _counter2
Definition:
ExternalLED.h:57
ExternalLED::init
bool init(void)
Definition:
ExternalLED.cpp:252
ExternalLED::ExternalLED
ExternalLED()
Definition:
ExternalLED.h:31
NotifyDevice
Definition:
NotifyDevice.h:8
AP_Param.h
A system for managing and storing variables that are of general interest to the system.
ExternalLED::copterleds_flag_type::gpsled_on
uint8_t gpsled_on
Definition:
ExternalLED.h:51
ExternalLED::copterleds_flag_type::motorled1_on
uint8_t motorled1_on
Definition:
ExternalLED.h:52
ExternalLED::set_pattern
void set_pattern(LEDPattern pattern_id)
ExternalLED::LEDPattern
LEDPattern
Definition:
ExternalLED.h:41
ExternalLED::copterleds_flag_type::armedled_on
uint8_t armedled_on
Definition:
ExternalLED.h:50
AP_Common.h
Common definitions and utility routines for the ArduPilot libraries.
ExternalLED::gps_led
void gps_led(bool on_off)
ExternalLED::_counter
uint8_t _counter
Definition:
ExternalLED.h:56
ExternalLED::armed_led
void armed_led(bool on_off)
ExternalLED::FAST_FLASH
Definition:
ExternalLED.h:43
ExternalLED
Definition:
ExternalLED.h:27
ExternalLED::copterleds_flag_type::motorled2_on
uint8_t motorled2_on
Definition:
ExternalLED.h:53
ExternalLED::OSCILLATE
Definition:
ExternalLED.h:44
ExternalLED::update
void update(void)
Definition:
ExternalLED.cpp:253
ExternalLED::motor_led2
void motor_led2(bool on_off)
Generated on Sun Jun 17 2018 14:18:50 for APM:Libraries by
1.8.13