APM:Libraries
GPIO.cpp
Go to the documentation of this file.
1 
2 #include "GPIO.h"
3 
4 using namespace Empty;
5 
7 {}
8 
9 void GPIO::init()
10 {}
11 
12 void GPIO::pinMode(uint8_t pin, uint8_t output)
13 {}
14 
16 {
17  return -1;
18 }
19 
20 
21 uint8_t GPIO::read(uint8_t pin) {
22  return 0;
23 }
24 
25 void GPIO::write(uint8_t pin, uint8_t value)
26 {}
27 
28 void GPIO::toggle(uint8_t pin)
29 {}
30 
31 /* Alternative interface: */
33  return new DigitalSource(0);
34 }
35 
36 /* Interrupt interface: */
37 bool GPIO::attach_interrupt(uint8_t interrupt_num, AP_HAL::Proc p,
38  uint8_t mode) {
39  return true;
40 }
41 
43 {
44  return false;
45 }
46 
48  _v(v)
49 {}
50 
51 void DigitalSource::mode(uint8_t output)
52 {}
53 
55  return _v;
56 }
57 
58 void DigitalSource::write(uint8_t value) {
59  _v = value;
60 }
61 
63  _v = !_v;
64 }
void write(uint8_t value)
Definition: GPIO.cpp:58
GPIO()
Definition: GPIO.cpp:6
uint8_t read()
Definition: GPIO.cpp:54
bool usb_connected(void)
Definition: GPIO.cpp:42
void(* Proc)(void)
AP_HAL::DigitalSource * channel(uint16_t n)
Definition: GPIO.cpp:32
int8_t analogPinToDigitalPin(uint8_t pin)
Definition: GPIO.cpp:15
void pinMode(uint8_t pin, uint8_t output)
Definition: GPIO.cpp:12
void mode(uint8_t output)
Definition: GPIO.cpp:51
void write(uint8_t pin, uint8_t value)
Definition: GPIO.cpp:25
float v
Definition: Printf.cpp:15
uint8_t _v
Definition: GPIO.h:34
uint8_t read(uint8_t pin)
Definition: GPIO.cpp:21
bool attach_interrupt(uint8_t interrupt_num, AP_HAL::Proc p, uint8_t mode)
Definition: GPIO.cpp:37
float value
void toggle(uint8_t pin)
Definition: GPIO.cpp:28
static int8_t pin
Definition: AnalogIn.cpp:15
void init()
Definition: GPIO.cpp:9
DigitalSource(uint8_t v)
Definition: GPIO.cpp:47