2013-12-30 19:00:04 -04:00
|
|
|
#include <AP_HAL.h>
|
|
|
|
|
|
|
|
#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX
|
2013-09-22 03:01:24 -03:00
|
|
|
|
|
|
|
#include "GPIO.h"
|
|
|
|
|
|
|
|
using namespace Linux;
|
|
|
|
|
|
|
|
LinuxGPIO::LinuxGPIO()
|
|
|
|
{}
|
|
|
|
|
|
|
|
void LinuxGPIO::init()
|
|
|
|
{}
|
|
|
|
|
|
|
|
void LinuxGPIO::pinMode(uint8_t pin, uint8_t output)
|
|
|
|
{}
|
|
|
|
|
|
|
|
int8_t LinuxGPIO::analogPinToDigitalPin(uint8_t pin)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t LinuxGPIO::read(uint8_t pin) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void LinuxGPIO::write(uint8_t pin, uint8_t value)
|
|
|
|
{}
|
|
|
|
|
|
|
|
void LinuxGPIO::toggle(uint8_t pin)
|
|
|
|
{}
|
|
|
|
|
|
|
|
/* Alternative interface: */
|
|
|
|
AP_HAL::DigitalSource* LinuxGPIO::channel(uint16_t n) {
|
|
|
|
return new LinuxDigitalSource(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Interrupt interface: */
|
|
|
|
bool LinuxGPIO::attach_interrupt(uint8_t interrupt_num, AP_HAL::Proc p,
|
|
|
|
uint8_t mode) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool LinuxGPIO::usb_connected(void)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
LinuxDigitalSource::LinuxDigitalSource(uint8_t v) :
|
|
|
|
_v(v)
|
|
|
|
{}
|
|
|
|
|
|
|
|
void LinuxDigitalSource::mode(uint8_t output)
|
|
|
|
{}
|
|
|
|
|
|
|
|
uint8_t LinuxDigitalSource::read() {
|
|
|
|
return _v;
|
|
|
|
}
|
|
|
|
|
|
|
|
void LinuxDigitalSource::write(uint8_t value) {
|
|
|
|
_v = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void LinuxDigitalSource::toggle() {
|
|
|
|
_v = !_v;
|
|
|
|
}
|
2013-12-30 19:00:04 -04:00
|
|
|
|
|
|
|
#endif // CONFIG_HAL_BOARD
|