Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
hosted_terminal_device.hpp
Go to the documentation of this file.
1/*****************************************************************************/
2/********** !!! WARNING: CODE GENERATED BY TAPROOT. DO NOT EDIT !!! **********/
3/*****************************************************************************/
4
5/*
6 * Copyright (c) 2020-2021 Advanced Robotics at the University of Washington <robomstr@uw.edu>
7 *
8 * This file is part of Taproot.
9 *
10 * Taproot is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * Taproot is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with Taproot. If not, see <https://www.gnu.org/licenses/>.
22 */
23
24#ifndef TAPROOT_HOSTED_TERMINAL_DEVICE_HPP_
25#define TAPROOT_HOSTED_TERMINAL_DEVICE_HPP_
26
27#ifdef PLATFORM_HOSTED
28
29#include <mutex>
30
31#include "tap/util_macros.hpp"
32
33#include "modm/container/deque.hpp"
34#include "modm/io/iodevice.hpp"
35
36namespace std
37{
38class thread;
39}
40
41namespace tap
42{
43class Drivers;
44}
45
47{
56class HostedTerminalDevice : public modm::IODevice
57{
58public:
59 HostedTerminalDevice(Drivers *drivers);
60 DISALLOW_COPY_AND_ASSIGN(HostedTerminalDevice);
61 virtual ~HostedTerminalDevice();
62
63 void initialize();
64
65 bool read(char &c) override;
66
67 using IODevice::write;
68 void write(char c) override;
69
70 void flush() override;
71
72private:
73 static constexpr int RX_BUFF_SIZE = 256;
74
76
77 std::thread *readStdinThread;
78
79 modm::BoundedDeque<char, RX_BUFF_SIZE> rxBuff;
80
81 std::mutex rxBuffMutex;
82
83 void readCin();
84}; // class HostedTerminalDevice
85} // namespace tap::communication::serial
86
87#endif
88
89#endif // TAPROOT_HOSTED_TERMINAL_DEVICE_HPP_
void initialize()
Definition board.hpp:183
Definition dji_serial.cpp:41
Definition ballistics.cpp:29
tap::Drivers Drivers
Definition drivers.hpp:11
fang::Drivers & drivers
Definition robot_singleton.cpp:45
#define DISALLOW_COPY_AND_ASSIGN(Typename)
Definition util_macros.hpp:27