ardupilot/libraries/AP_HAL_Linux/GPIO.cpp

36 lines
544 B
C++
Raw Normal View History

#include <AP_HAL/AP_HAL.h>
#include "GPIO.h"
2013-12-30 19:00:04 -04:00
2014-07-06 23:03:26 -03:00
#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX
2013-09-22 03:01:24 -03:00
using namespace Linux;
static const AP_HAL::HAL& hal = AP_HAL_BOARD_DRIVER;
2013-09-22 03:01:24 -03:00
LinuxDigitalSource::LinuxDigitalSource(uint8_t v) :
_v(v)
{
}
2013-09-22 03:01:24 -03:00
void LinuxDigitalSource::mode(uint8_t output)
{
hal.gpio->pinMode(_v, output);
}
2013-09-22 03:01:24 -03:00
uint8_t LinuxDigitalSource::read()
{
return hal.gpio->read(_v);
2013-09-22 03:01:24 -03:00
}
void LinuxDigitalSource::write(uint8_t value)
{
return hal.gpio->write(_v,value);
2013-09-22 03:01:24 -03:00
}
void LinuxDigitalSource::toggle()
{
write(!read());
2013-09-22 03:01:24 -03:00
}
2013-12-30 19:00:04 -04:00
#endif