2016-02-17 21:25:23 -04:00
|
|
|
#pragma once
|
2013-09-19 03:26:14 -03:00
|
|
|
|
2015-08-11 03:28:43 -03:00
|
|
|
#include "AP_HAL_Empty.h"
|
2013-09-19 03:26:14 -03:00
|
|
|
|
2015-12-07 14:53:55 -04:00
|
|
|
class Empty::GPIO : public AP_HAL::GPIO {
|
2013-09-19 03:26:14 -03:00
|
|
|
public:
|
2015-12-07 14:53:55 -04:00
|
|
|
GPIO();
|
2013-09-19 03:26:14 -03:00
|
|
|
void init();
|
|
|
|
void pinMode(uint8_t pin, uint8_t output);
|
|
|
|
int8_t analogPinToDigitalPin(uint8_t pin);
|
|
|
|
uint8_t read(uint8_t pin);
|
|
|
|
void write(uint8_t pin, uint8_t value);
|
|
|
|
void toggle(uint8_t pin);
|
|
|
|
|
|
|
|
/* Alternative interface: */
|
|
|
|
AP_HAL::DigitalSource* channel(uint16_t n);
|
|
|
|
|
|
|
|
/* Interrupt interface: */
|
|
|
|
bool attach_interrupt(uint8_t interrupt_num, AP_HAL::Proc p,
|
|
|
|
uint8_t mode);
|
|
|
|
|
|
|
|
/* return true if USB cable is connected */
|
|
|
|
bool usb_connected(void);
|
|
|
|
};
|
|
|
|
|
2015-12-07 14:53:55 -04:00
|
|
|
class Empty::DigitalSource : public AP_HAL::DigitalSource {
|
2013-09-19 03:26:14 -03:00
|
|
|
public:
|
2015-12-07 14:53:55 -04:00
|
|
|
DigitalSource(uint8_t v);
|
2013-09-19 03:26:14 -03:00
|
|
|
void mode(uint8_t output);
|
|
|
|
uint8_t read();
|
|
|
|
void write(uint8_t value);
|
|
|
|
void toggle();
|
|
|
|
private:
|
|
|
|
uint8_t _v;
|
|
|
|
};
|