ArduCopter: add ArduPlane's compat.h & compat.pde

This commit is contained in:
Pat Hickey 2012-12-12 16:16:47 -08:00 committed by Andrew Tridgell
parent 70f4739522
commit b90889dd11
2 changed files with 52 additions and 0 deletions

15
ArduCopter/compat.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef __COMPAT_H__
#define __COMPAT_H__
#define OUTPUT GPIO_OUTPUT
#define INPUT GPIO_INPUT
#define HIGH 1
#define LOW 0
/* Forward declarations to avoid broken auto-prototyper (coughs on '::'?) */
static void run_cli(AP_HAL::UARTDriver *port);
#endif // __COMPAT_H__

37
ArduCopter/compat.pde Normal file
View File

@ -0,0 +1,37 @@
void delay(uint32_t ms)
{
hal.scheduler->delay(ms);
}
void mavlink_delay(uint32_t ms)
{
hal.scheduler->delay(ms);
}
uint32_t millis()
{
return hal.scheduler->millis();
}
uint32_t micros()
{
return hal.scheduler->micros();
}
void pinMode(uint8_t pin, uint8_t output)
{
hal.gpio->pinMode(pin, output);
}
void digitalWrite(uint8_t pin, uint8_t out)
{
hal.gpio->write(pin,out);
}
uint8_t digitalRead(uint8_t pin)
{
return hal.gpio->read(pin);
}