Brian Silverman | bfbbe87 | 2019-02-10 18:00:57 -0800 | [diff] [blame] | 1 | #ifndef Y2019_JEVOIS_UART_H_ |
| 2 | #define Y2019_JEVOIS_UART_H_ |
| 3 | |
| 4 | #include "aos/containers/sized_array.h" |
| 5 | #include "third_party/optional/tl/optional.hpp" |
| 6 | #include "y2019/jevois/structures.h" |
| 7 | |
| 8 | // This file manages serializing and deserializing the various structures for |
| 9 | // transport via UART. |
| 10 | |
| 11 | namespace frc971 { |
| 12 | namespace jevois { |
| 13 | |
| 14 | constexpr size_t uart_max_size() { |
| 15 | // TODO(Brian): Make this real. |
| 16 | return 10; |
| 17 | } |
| 18 | using UartBuffer = aos::SizedArray<char, uart_max_size()>; |
| 19 | |
| 20 | UartBuffer UartPackToTeensy(const Frame &message); |
| 21 | tl::optional<CameraCalibration> UartUnpackToCamera(const UartBuffer &message); |
| 22 | |
| 23 | } // namespace jevois |
| 24 | } // namespace frc971 |
| 25 | |
| 26 | #endif // Y2019_JEVOIS_UART_H_ |