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();
|
2018-11-07 06:59:10 -04:00
|
|
|
void init() override;
|
|
|
|
void pinMode(uint8_t pin, uint8_t output) override;
|
|
|
|
uint8_t read(uint8_t pin) override;
|
|
|
|
void write(uint8_t pin, uint8_t value) override;
|
|
|
|
void toggle(uint8_t pin) override;
|
2013-09-19 03:26:14 -03:00
|
|
|
|
|
|
|
/* Alternative interface: */
|
2018-11-07 06:59:10 -04:00
|
|
|
AP_HAL::DigitalSource* channel(uint16_t n) override;
|
2013-09-19 03:26:14 -03:00
|
|
|
|
|
|
|
/* return true if USB cable is connected */
|
2018-11-07 06:59:10 -04:00
|
|
|
bool usb_connected(void) override;
|
2013-09-19 03:26:14 -03:00
|
|
|
};
|
|
|
|
|
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);
|
2018-11-07 06:59:10 -04:00
|
|
|
void mode(uint8_t output) override;
|
|
|
|
uint8_t read() override;
|
|
|
|
void write(uint8_t value) override;
|
|
|
|
void toggle() override;
|
2013-09-19 03:26:14 -03:00
|
|
|
private:
|
|
|
|
uint8_t _v;
|
|
|
|
};
|