APM:Libraries
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 
28 {
29 public:
30  // constructor
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,
45  };
46 
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 };
buzzer_flag_type - bitmask of current state and ap_notify states we track
Definition: ExternalLED.h:48
uint8_t _pattern_counter
Definition: ExternalLED.h:59
struct ExternalLED::copterleds_flag_type _flags
void motor_led1(bool on_off)
LEDPattern _pattern
Definition: ExternalLED.h:58
uint8_t _counter2
Definition: ExternalLED.h:57
bool init(void)
A system for managing and storing variables that are of general interest to the system.
void set_pattern(LEDPattern pattern_id)
Common definitions and utility routines for the ArduPilot libraries.
void gps_led(bool on_off)
uint8_t _counter
Definition: ExternalLED.h:56
void armed_led(bool on_off)
void update(void)
void motor_led2(bool on_off)