APM:Libraries
VRBoard_LED.cpp
Go to the documentation of this file.
1 /*
2  ToshibaLED driver
3 */
4 
5 /*
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #include "VRBoard_LED.h"
20 
21 #include <AP_HAL/AP_HAL.h>
22 
23 #if (defined(HAL_GPIO_A_LED_PIN) && defined(HAL_GPIO_B_LED_PIN) && \
24  defined(HAL_GPIO_C_LED_PIN))
25 
26 #define VRBRAIN_LED_BRIGHT 1 // full brightness
27 #define VRBRAIN_LED_MEDIUM 1 // medium brightness
28 #define VRBRAIN_LED_DIM 1 // dim
29 #define VRBRAIN_LED_OFF 0 // off
30 
31 extern const AP_HAL::HAL& hal;
32 
34  RGBLed(VRBRAIN_LED_OFF, VRBRAIN_LED_BRIGHT, VRBRAIN_LED_MEDIUM, VRBRAIN_LED_DIM)
35 {
36 
37 }
38 bool VRBoard_LED::hw_init(void){
39  // setup the main LEDs as outputs
43 
44  // turn all lights off
48  return true;
49 }
50 bool VRBoard_LED::hw_set_rgb(uint8_t r, uint8_t g, uint8_t b){
51 
52  if(r > 0){
54  } else {
56  }
57  if (g > 0) {
59  } else {
61  }
62  if (b > 0) {
64  } else {
66  }
67 
68  return true;
69 }
70 
71 #endif
uint8_t b
Definition: RGBLed.h:67
Definition: RGBLed.h:25
uint8_t g
Definition: RGBLed.h:67
#define HAL_GPIO_A_LED_PIN
Definition: chibios.h:9
bool hw_init(void) override
#define HAL_GPIO_C_LED_PIN
Definition: chibios.h:15
const AP_HAL::HAL & hal
Definition: UARTDriver.cpp:37
virtual void write(uint8_t pin, uint8_t value)=0
uint8_t r
Definition: RGBLed.h:67
virtual void pinMode(uint8_t pin, uint8_t output)=0
#define HAL_GPIO_LED_OFF
Definition: chibios.h:21
bool hw_set_rgb(uint8_t r, uint8_t g, uint8_t b) override
#define HAL_GPIO_OUTPUT
Definition: GPIO.h:8
AP_HAL::GPIO * gpio
Definition: HAL.h:111
#define HAL_GPIO_LED_ON
Definition: chibios.h:18
#define HAL_GPIO_B_LED_PIN
Definition: chibios.h:12