2013-09-19 03:26:14 -03:00
|
|
|
|
|
|
|
#include "GPIO.h"
|
|
|
|
|
|
|
|
using namespace Empty;
|
|
|
|
|
2015-12-07 14:53:55 -04:00
|
|
|
GPIO::GPIO()
|
2013-09-19 03:26:14 -03:00
|
|
|
{}
|
|
|
|
|
2015-12-07 14:53:55 -04:00
|
|
|
void GPIO::init()
|
2013-09-19 03:26:14 -03:00
|
|
|
{}
|
|
|
|
|
2015-12-07 14:53:55 -04:00
|
|
|
void GPIO::pinMode(uint8_t pin, uint8_t output)
|
2013-09-19 03:26:14 -03:00
|
|
|
{}
|
|
|
|
|
2015-12-07 14:53:55 -04:00
|
|
|
uint8_t GPIO::read(uint8_t pin) {
|
2013-09-19 03:26:14 -03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-12-07 14:53:55 -04:00
|
|
|
void GPIO::write(uint8_t pin, uint8_t value)
|
2013-09-19 03:26:14 -03:00
|
|
|
{}
|
|
|
|
|
2015-12-07 14:53:55 -04:00
|
|
|
void GPIO::toggle(uint8_t pin)
|
2013-09-19 03:26:14 -03:00
|
|
|
{}
|
|
|
|
|
|
|
|
/* Alternative interface: */
|
2015-12-07 14:53:55 -04:00
|
|
|
AP_HAL::DigitalSource* GPIO::channel(uint16_t n) {
|
|
|
|
return new DigitalSource(0);
|
2013-09-19 03:26:14 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Interrupt interface: */
|
2015-12-07 14:53:55 -04:00
|
|
|
bool GPIO::attach_interrupt(uint8_t interrupt_num, AP_HAL::Proc p,
|
2013-09-19 03:26:14 -03:00
|
|
|
uint8_t mode) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-12-07 14:53:55 -04:00
|
|
|
bool GPIO::usb_connected(void)
|
2013-09-19 03:26:14 -03:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-12-07 14:53:55 -04:00
|
|
|
DigitalSource::DigitalSource(uint8_t v) :
|
2013-09-19 03:26:14 -03:00
|
|
|
_v(v)
|
|
|
|
{}
|
|
|
|
|
2015-12-07 14:53:55 -04:00
|
|
|
void DigitalSource::mode(uint8_t output)
|
2013-09-19 03:26:14 -03:00
|
|
|
{}
|
|
|
|
|
2015-12-07 14:53:55 -04:00
|
|
|
uint8_t DigitalSource::read() {
|
2013-09-19 03:26:14 -03:00
|
|
|
return _v;
|
|
|
|
}
|
|
|
|
|
2015-12-07 14:53:55 -04:00
|
|
|
void DigitalSource::write(uint8_t value) {
|
2013-09-19 03:26:14 -03:00
|
|
|
_v = value;
|
|
|
|
}
|
|
|
|
|
2015-12-07 14:53:55 -04:00
|
|
|
void DigitalSource::toggle() {
|
2013-09-19 03:26:14 -03:00
|
|
|
_v = !_v;
|
|
|
|
}
|