blob: 36bb1704993f32082d1a4be2a26d7b99d405de3c [file] [log] [blame]
Daniel Petti059be422013-12-14 19:47:42 -08001#ifndef FCR971_INPUT_UART_RECEIVER_H_
2#define FRC971_INPUT_UART_RECEIVER_H_
3
4#include <cstdint>
Daniel Petti059be422013-12-14 19:47:42 -08005
6#define DATA_STRUCT_NAME DataStruct
7#include <bbb_cape/src/cape/data_struct.h>
8#undef DATA_STRUCT_NAME
9
10namespace bbb {
11
12 class UartReceiver {
Daniel Petti23dcf6c2013-12-19 08:56:41 -080013 uint32_t baud_rate_;
Daniel Petti059be422013-12-14 19:47:42 -080014 size_t packet_size_, stuffed_size_;
15 int fd_;
16 uint32_t buf_used_;
17 char *buf_;
18
19 public:
Daniel Petti23dcf6c2013-12-19 08:56:41 -080020 UartReceiver(uint32_t baud_rate);
Daniel Petti059be422013-12-14 19:47:42 -080021 ~UartReceiver();
22 // Opens file descriptor, etc.
23 int SetUp();
24 int GetPacket(DataStruct *packet);
25
26 };
27
28} //bbb
29
30#endif