AP_HAL_AVR_SITL: add initial scaffolding

This commit is contained in:
Pat Hickey 2012-12-11 17:30:12 -08:00 committed by Andrew Tridgell
parent 81d77d2bf4
commit 54bab59066
4 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,9 @@
#ifndef __AP_HAL_AVR_SITL_H__
#define __AP_HAL_AVR_SITL_H__
#include "AP_HAL_AVR_SITL_Namespace.h"
#include "HAL_AVR_SITL_Class.h"
#endif // __AP_HAL_AVR_SITL_H__

View File

@ -0,0 +1,9 @@
#ifndef __AP_HAL_AVR_SITL_NAMESPACE_H__
#define __AP_HAL_AVR_SITL_NAMESPACE_H__
namespace AP_HAL_AVR_SITL {
class SITLUARTDriver;
}
#endif // __AP_HAL_AVR_SITL_NAMESPACE_H__

View File

@ -0,0 +1,49 @@
#include <AP_HAL.h>
#if CONFIG_HAL_BOARD == HAL_BOARD_AVR_SITL
#include <AP_HAL_AVR.h>
#include <AP_HAL_AVR_private.h>
#include <AP_HAL_AVR_SITL.h>
#include "AP_HAL_AVR_SITL_Namespace.h"
#include "HAL_AVR_SITL_Class.h"
// XXX placeholder
uint8_t isrRegistry;
static AVRScheduler avrScheduler;
HAL_AVR_SITL::HAL_AVR_SITL() :
AP_HAL::HAL(
NULL, /* uartA */
NULL, /* uartB */
NULL, /* uartC */
NULL, /* i2c */
NULL, /* spi */
NULL, /* analogin */
NULL, /* storage */
NULL, /* console */
NULL, /* gpio */
NULL, /* rcinput */
NULL, /* rcoutput */
&avrScheduler) /* scheduler */
{}
void HAL_AVR_SITL::init(void* machtnichts) const {
scheduler->init((void*)&isrRegistry);
uartA->begin(115200);
console->init((void*) uartA);
rcin->init((void*)&isrRegistry);
rcout->init(NULL);
spi->init(NULL);
i2c->begin();
i2c->setTimeout(100);
analogin->init(NULL);
}
const HAL_AVR_SITL AP_HAL_AVR_SITL;
#endif // CONFIG_HAL_BOARD == HAL_BOARD_AVR_SITL

View File

@ -0,0 +1,18 @@
#ifndef __AP_HAL_AVR_SITL_CLASS_H__
#define __AP_HAL_AVR_SITL_CLASS_H__
#include <AP_HAL.h>
#if CONFIG_HAL_BOARD == HAL_BOARD_AVR_SITL
class HAL_AVR_SITL :: public AP_HAL::HAL {
HAL_AVR_SITL();
void init(void*) const;
};
extern const HAL_AVR_SITL AP_HAL_AVR_SITL;
#endif // CONFIG_HAL_BOARD == HAL_BOARD_AVR_SITL
#endif // __AP_HAL_AVR_SITL_CLASS_H__