Line data Source code
1 : #pragma once 2 : 3 : #include "AP_Scripting_config.h" 4 : #include "AP_Scripting.h" 5 : 6 : #include <AP_HAL/UARTDriver.h> 7 : 8 : class AP_Scripting_SerialAccess { 9 : public: 10 : /* Do not allow copies */ 11 : CLASS_NO_COPY(AP_Scripting_SerialAccess); 12 : 13 2 : AP_Scripting_SerialAccess() {} 14 : 15 : void begin(uint32_t baud); 16 : void begin(); 17 : 18 : void configure_parity(uint8_t parity); 19 : void set_stop_bits(uint8_t stop_bits); 20 : void set_unbuffered_writes(bool on); 21 : 22 : size_t write(uint8_t c); 23 : size_t write(const uint8_t *buffer, size_t size); 24 : 25 : int16_t read(void); 26 : ssize_t read(uint8_t *buffer, uint16_t count); 27 : 28 : uint32_t available(void); 29 : 30 : void set_flow_control(enum AP_HAL::UARTDriver::flow_control fcs); 31 : 32 : AP_HAL::UARTDriver *stream; 33 : #if AP_SCRIPTING_ENABLED 34 : #if AP_SCRIPTING_SERIALDEVICE_ENABLED 35 : bool is_device_port; 36 : #endif 37 : #endif 38 : };