mirror of
https://github.com/4yn/slidershim.git
synced 2024-12-18 07:05:52 +01:00
25 lines
622 B
C++
25 lines
622 B
C++
#pragma once
|
|
#include "rust/cxx.h"
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
struct CxxSerial
|
|
{
|
|
CxxSerial(rust::String port, uint32_t baud, uint32_t read_timeout, uint32_t write_timeout, bool hardware);
|
|
|
|
uint32_t write(const rust::Vec<uint8_t> &data) const;
|
|
|
|
uint32_t read(rust::Vec<uint8_t> &data) const;
|
|
|
|
void flush() const;
|
|
|
|
bool check() const;
|
|
|
|
private:
|
|
struct impl;
|
|
std::shared_ptr<impl> impl;
|
|
};
|
|
|
|
// port: String, baud: u32, timeout: u32, hardware: bool
|
|
std::unique_ptr<CxxSerial> new_cxx_serial(rust::String port, uint32_t baud, uint32_t read_timeout, uint32_t write_timeout, bool hardware); |