-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomms.hpp
More file actions
39 lines (31 loc) · 705 Bytes
/
comms.hpp
File metadata and controls
39 lines (31 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once
#include <scode.h>
namespace comms {
/**
* Setup the Communications system
*/
void setup();
/**
* Read the next code from the stream
*
* @param code code to populate
*
* @return any errors (SCODE_ERROR_X) or 0
*/
int read(code_t *code);
/**
* Write a code to the stream
*
* @param code code to write
* @param binary whether to write the code in the binary format
*/
void write(const code_t &code, bool binary = true);
/**
* Write a finishing code
*
* @param binary whether to write the code in binary format
*/
void ok(param_t &&code, bool binary = true);
void err(uint8_t error, param_t &&code, bool binary = true);
} // namespace comms
#define COMMS_SERIAL Serial1