mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-02-08 07:24:21 +08:00
Adding another layer instead of just exposing UARTDriver bindings allows substitution of the different functions for device simulation later. Also take the opportunity to rework the docs a little.
26 lines
530 B
C++
26 lines
530 B
C++
#pragma once
|
|
|
|
#include <AP_HAL/UARTDriver.h>
|
|
|
|
class AP_Scripting_SerialAccess {
|
|
public:
|
|
/* Do not allow copies */
|
|
CLASS_NO_COPY(AP_Scripting_SerialAccess);
|
|
|
|
AP_Scripting_SerialAccess() {}
|
|
|
|
void begin(uint32_t baud);
|
|
|
|
size_t write(uint8_t c);
|
|
size_t write(const uint8_t *buffer, size_t size);
|
|
|
|
int16_t read(void);
|
|
ssize_t read(uint8_t *buffer, uint16_t count);
|
|
|
|
uint32_t available(void);
|
|
|
|
void set_flow_control(enum AP_HAL::UARTDriver::flow_control fcs);
|
|
|
|
AP_HAL::UARTDriver *stream;
|
|
};
|