APM:Libraries
GPIO.cpp
Go to the documentation of this file.
1 #include <AP_HAL/AP_HAL.h>
2 
3 #include "GPIO.h"
4 
5 using namespace Linux;
6 
7 static const AP_HAL::HAL& hal = AP_HAL::get_HAL();
8 
10  _v(v)
11 {
12 
13 }
14 
15 void DigitalSource::mode(uint8_t output)
16 {
17  hal.gpio->pinMode(_v, output);
18 }
19 
21 {
22  return hal.gpio->read(_v);
23 }
24 
26 {
27  return hal.gpio->write(_v,value);
28 }
29 
31 {
32  write(!read());
33 }
DigitalSource(uint8_t v)
Definition: GPIO.cpp:9
uint8_t read()
Definition: GPIO.cpp:20
virtual void write(uint8_t pin, uint8_t value)=0
void write(uint8_t value)
Definition: GPIO.cpp:25
static const AP_HAL::HAL & hal
Definition: I2CDevice.cpp:61
virtual void pinMode(uint8_t pin, uint8_t output)=0
float v
Definition: Printf.cpp:15
const HAL & get_HAL()
virtual uint8_t read(uint8_t pin)=0
void mode(uint8_t output)
Definition: GPIO.cpp:15
AP_HAL::GPIO * gpio
Definition: HAL.h:111
float value
uint8_t _v
Definition: GPIO.h:15