2012-09-14 14:58:55 -03:00
|
|
|
|
|
|
|
#ifndef __AP_HAL_AVR_CONSOLE_DRIVER_H__
|
|
|
|
#define __AP_HAL_AVR_CONSOLE_DRIVER_H__
|
|
|
|
|
2012-09-14 21:07:28 -03:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2012-09-14 14:58:55 -03:00
|
|
|
#include <AP_HAL.h>
|
|
|
|
#include "AP_HAL_AVR_Namespace.h"
|
|
|
|
|
|
|
|
class AP_HAL_AVR::AVRConsoleDriver : public AP_HAL::ConsoleDriver {
|
|
|
|
public:
|
|
|
|
void init(void* baseuartdriver);
|
|
|
|
void backend_open();
|
|
|
|
void backend_close();
|
2012-12-06 15:02:28 -04:00
|
|
|
size_t backend_read(uint8_t *data, size_t len);
|
|
|
|
size_t backend_write(const uint8_t *data, size_t len);
|
2012-09-14 14:58:55 -03:00
|
|
|
|
|
|
|
/* Implementations of BetterStream virtual methods */
|
|
|
|
void print_P(const prog_char_t *s);
|
|
|
|
void println_P(const prog_char_t *s);
|
|
|
|
void printf(const char *s, ...)
|
|
|
|
__attribute__ ((format(__printf__, 2, 3)));
|
|
|
|
void _printf_P(const prog_char *s, ...)
|
|
|
|
__attribute__ ((format(__printf__, 2, 3)));
|
|
|
|
|
2012-12-19 18:01:26 -04:00
|
|
|
void vprintf(const char *s, va_list ap);
|
|
|
|
void vprintf_P(const prog_char *s, va_list ap);
|
|
|
|
|
2012-09-14 14:58:55 -03:00
|
|
|
/* Implementations of Stream virtual methods */
|
2012-12-06 15:02:28 -04:00
|
|
|
int16_t available();
|
|
|
|
int16_t txspace();
|
|
|
|
int16_t read();
|
2012-09-14 14:58:55 -03:00
|
|
|
|
|
|
|
/* Implementations of Print virtual methods */
|
|
|
|
size_t write(uint8_t c);
|
2012-09-14 21:07:28 -03:00
|
|
|
|
2013-01-10 19:23:51 -04:00
|
|
|
private:
|
2012-09-14 14:58:55 -03:00
|
|
|
AP_HAL::UARTDriver* _base_uart;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __AP_HAL_AVR_CONSOLE_DRIVER_H__
|
|
|
|
|