AP_HAL_PX4: Stub Console implemented

This commit is contained in:
Pat Hickey 2012-10-26 22:41:46 -07:00 committed by Andrew Tridgell
parent 166eff180d
commit 64a79f3598
3 changed files with 83 additions and 2 deletions

View File

@ -3,11 +3,12 @@
#include "AP_HAL_PX4.h"
#include "HAL_PX4.h"
#include "UARTDriver.h"
#include "Console.h"
using namespace AP_HAL;
using namespace AP_HAL_PX4;
static PX4ConsoleDriver px4ConsoleDriver;
const HAL_PX4 AP_HAL_PX4_Instance(
(UARTDriver*) NULL,
@ -19,7 +20,7 @@ const HAL_PX4 AP_HAL_PX4_Instance(
(AnalogIn*) NULL,
(Storage*) NULL,
(Dataflash*) NULL,
(ConsoleDriver*) NULL,
(ConsoleDriver*) &px4ConsoleDriver,
(GPIO*) NULL,
(RCInput*) NULL,
(RCOutput*) NULL,

View File

@ -0,0 +1,79 @@
#include <limits.h>
#include <stdarg.h>
#include <AP_HAL.h>
#include "Console.h"
using namespace AP_HAL_PX4;
PX4ConsoleDriver::PX4ConsoleDriver()
{}
// ConsoleDriver method implementations ///////////////////////////////////////
void PX4ConsoleDriver::init(void* base_uart) {
}
void PX4ConsoleDriver::backend_open() {
}
void PX4ConsoleDriver::backend_close() {
}
int PX4ConsoleDriver::backend_read(uint8_t *data, int len) {
return 0;
}
int PX4ConsoleDriver::backend_write(const uint8_t *data, int len) {
return 0;
}
// BetterStream method implementations /////////////////////////////////////////
void PX4ConsoleDriver::print_P(const prog_char_t *s) {
char c;
while ('\0' != (c = *s++))
write(c);
}
void PX4ConsoleDriver::println_P(const prog_char_t *s) {
print_P(s);
println();
}
void PX4ConsoleDriver::printf(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
// vprintf((AP_HAL::Print*)this, 0, fmt, ap);
va_end(ap);
}
void PX4ConsoleDriver::_printf_P(const prog_char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
// vprintf((AP_HAL::Print*)this, 1, fmt, ap);
va_end(ap);
}
// Stream method implementations /////////////////////////////////////////
int PX4ConsoleDriver::available(void) {
return 0;
}
int PX4ConsoleDriver::txspace(void) {
return 0;
}
int PX4ConsoleDriver::read() {
return -1;
}
int PX4ConsoleDriver::peek() {
return -1;
}
// Print method implementations /////////////////////////////////////////
size_t PX4ConsoleDriver::write(uint8_t c) {
return 0;
}

View File

@ -6,6 +6,7 @@
#include <AP_HAL_PX4_Namespace.h>
class AP_HAL_PX4::PX4ConsoleDriver : public AP_HAL::ConsoleDriver {
public:
PX4ConsoleDriver();
void init(void*);
void backend_open();