AP_HAL_Empty: add Util driver
This commit is contained in:
parent
f9eff068f9
commit
771f2a3acf
@ -22,6 +22,7 @@ namespace Empty {
|
||||
class EmptyRCOutput;
|
||||
class EmptySemaphore;
|
||||
class EmptyScheduler;
|
||||
class EmptyUtil;
|
||||
class EmptyPrivateMember;
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "RCOutput.h"
|
||||
#include "Semaphore.h"
|
||||
#include "Scheduler.h"
|
||||
#include "Util.h"
|
||||
#include "PrivateMember.h"
|
||||
|
||||
#endif // __AP_HAL_EMPTY_PRIVATE_H__
|
||||
|
@ -18,6 +18,7 @@ static EmptyGPIO gpioDriver;
|
||||
static EmptyRCInput rcinDriver;
|
||||
static EmptyRCOutput rcoutDriver;
|
||||
static EmptyScheduler schedulerInstance;
|
||||
static EmptyUtil utilInstance;
|
||||
|
||||
HAL_Empty::HAL_Empty() :
|
||||
AP_HAL::HAL(
|
||||
@ -32,7 +33,8 @@ HAL_Empty::HAL_Empty() :
|
||||
&gpioDriver,
|
||||
&rcinDriver,
|
||||
&rcoutDriver,
|
||||
&schedulerInstance),
|
||||
&schedulerInstance,
|
||||
&utilInstance),
|
||||
_member(new EmptyPrivateMember(123))
|
||||
{}
|
||||
|
||||
|
35
libraries/AP_HAL_Empty/Util.cpp
Normal file
35
libraries/AP_HAL_Empty/Util.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
#include "Util.h"
|
||||
using namespace Empty;
|
||||
|
||||
int EmptyUtil::snprintf(char* str, size_t size, const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
int res = this->vsnprintf(str, size, format, ap);
|
||||
va_end(ap);
|
||||
return res;
|
||||
}
|
||||
|
||||
int EmptyUtil::snprintf_P(char* str, size_t size, const prog_char_t *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
int res = this->vsnprintf_P(str, size, format, ap);
|
||||
va_end(ap);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
int EmptyUtil::vsnprintf(char* str, size_t size, const char *format, va_list ap)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EmptyUtil::vsnprintf_P(char* str, size_t size, const prog_char_t *format,
|
||||
va_list ap)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
17
libraries/AP_HAL_Empty/Util.h
Normal file
17
libraries/AP_HAL_Empty/Util.h
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
#ifndef __AP_HAL_EMPTY_UTIL_H__
|
||||
#define __AP_HAL_EMPTY_UTIL_H__
|
||||
|
||||
#include <AP_HAL.h>
|
||||
#include "AP_HAL_Empty_Namespace.h"
|
||||
|
||||
class Empty::EmptyUtil : 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_EMPTY_UTIL_H__
|
Loading…
Reference in New Issue
Block a user