APM:Libraries
DiscoLED.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2016 Mathieu Othacehe. All rights reserved.
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17 #pragma once
18 
19 #include <AP_HAL/AP_HAL.h>
20 
21 #if CONFIG_HAL_BOARD == HAL_BOARD_LINUX
22 #include <AP_HAL_Linux/Led_Sysfs.h>
23 #include <AP_HAL_Linux/PWM_Sysfs.h>
24 
25 #include "RGBLed.h"
26 
27 class DiscoLED: public RGBLed
28 {
29 public:
30  DiscoLED();
31 
32 protected:
33  bool hw_init(void) override;
34  bool hw_set_rgb(uint8_t r, uint8_t g, uint8_t b) override;
35 
36 private:
40 
44 
45  uint32_t red_pwm_period;
46  uint32_t green_pwm_period;
47  uint32_t blue_pwm_period;
48 
49  enum led_backend {
52  };
53 
55 };
56 #endif
uint8_t b
Definition: RGBLed.h:67
Definition: RGBLed.h:25
Linux::PWM_Sysfs_Bebop green_pwm
Definition: DiscoLED.h:38
uint8_t g
Definition: RGBLed.h:67
Linux::Led_Sysfs blue_led
Definition: DiscoLED.h:43
Linux::PWM_Sysfs_Bebop blue_pwm
Definition: DiscoLED.h:39
uint32_t blue_pwm_period
Definition: DiscoLED.h:47
led_backend
Definition: DiscoLED.h:49
Linux::PWM_Sysfs_Bebop red_pwm
Definition: DiscoLED.h:37
uint8_t r
Definition: RGBLed.h:67
bool hw_init(void) override
Definition: DiscoLED.cpp:50
DiscoLED()
Definition: DiscoLED.cpp:38
uint32_t red_pwm_period
Definition: DiscoLED.h:45
enum led_backend backend
Definition: DiscoLED.h:54
Linux::Led_Sysfs green_led
Definition: DiscoLED.h:42
bool hw_set_rgb(uint8_t r, uint8_t g, uint8_t b) override
Definition: DiscoLED.cpp:76
uint32_t green_pwm_period
Definition: DiscoLED.h:46
Linux::Led_Sysfs red_led
Definition: DiscoLED.h:41