AP_HAL_AVR: add Util stubs

This commit is contained in:
Pat Hickey 2012-12-18 16:09:40 -08:00 committed by Andrew Tridgell
parent 0d702045b8
commit b3abe89989
8 changed files with 53 additions and 4 deletions

View File

@ -26,6 +26,7 @@ namespace AP_HAL_AVR {
class AVRTimer;
class AVRSemaphore;
class ISRRegistry;
class AVRUtil;
}
#endif //__AP_HAL_AVR_NAMESPACE_H__

View File

@ -12,6 +12,7 @@
#include "RCInput.h"
#include "RCOutput.h"
#include "Scheduler.h"
#include "Util.h"
#include "utility/ISRRegistry.h"
#endif // __AP_HAL_AVR_PRIVATE_H__

View File

@ -30,6 +30,7 @@ static AVRGPIO avrGPIO;
static APM1RCInput apm1RCInput;
static APM1RCOutput apm1RCOutput;
static AVRScheduler avrScheduler;
static AVRUtil avrUtil;
static ISRRegistry isrRegistry;
@ -47,7 +48,8 @@ HAL_AVR_APM1::HAL_AVR_APM1() :
&avrGPIO,
&apm1RCInput,
&apm1RCOutput,
&avrScheduler )
&avrScheduler,
&avrUtil )
{}
void HAL_AVR_APM1::init(int argc, char * const argv[]) const {

View File

@ -30,6 +30,7 @@ static AVRGPIO avrGPIO;
static APM2RCInput apm2RCInput;
static APM2RCOutput apm2RCOutput;
static AVRScheduler avrScheduler;
static AVRUtil avrUtil;
static ISRRegistry isrRegistry;
@ -46,7 +47,8 @@ HAL_AVR_APM2::HAL_AVR_APM2() :
&avrGPIO,
&apm2RCInput,
&apm2RCOutput,
&avrScheduler )
&avrScheduler,
&avrUtil )
{}
void HAL_AVR_APM2::init(int argc, char * const argv[]) const {

View File

@ -7,8 +7,8 @@
#include <avr/wdt.h>
#include <avr/interrupt.h>
#include "HAL_AVR.h"
#include "Scheduler.h"
#include "ISRRegistry.h"
using namespace AP_HAL_AVR;
extern const AP_HAL::HAL& hal;

View File

@ -4,7 +4,6 @@
#include <avr/io.h>
#include <avr/interrupt.h>
#include "HAL_AVR.h"
#include "Scheduler.h"
using namespace AP_HAL_AVR;

View File

@ -0,0 +1,27 @@
#include "Util.h"
using namespace AP_HAL_AVR;
int AVRUtil::snprintf(char* str, size_t size, const char *format, ...)
{
}
int AVRUtil::snprintf_P(char* str, size_t size, const prog_char_t *format, ...)
{
}
int AVRUtil::vsnprintf(char* str, size_t size, const char *format, va_list ap)
{
}
int AVRUtil::vsnprintf_P(char* str, size_t size, const prog_char_t *format,
va_list ap)
{
}

View File

@ -0,0 +1,17 @@
#ifndef __AP_HAL_AVR_UTIL_H__
#define __AP_HAL_AVR_UTIL_H__
#include <AP_HAL.h>
#include "AP_HAL_AVR_Namespace.h"
class AP_HAL_AVR::AVRUtil : public AP_HAL::Util {
public:
int snprintf(char* str, size_t size, const char *format, ...);
int snprintf_P(char* str, size_t size, const prog_char_t *format, ...);
int vsnprintf(char* str, size_t size, const char *format, va_list ap);
int vsnprintf_P(char* str, size_t size, const prog_char_t *format,
va_list ap);
};
#endif // __AP_HAL_AVR_UTIL_H__