Main Page
Namespaces
Classes
Files
File List
File Members
include
um6
comms.h
Go to the documentation of this file.
1
35
#ifndef UM6_COMMS_H
36
#define UM6_COMMS_H
37
38
#include <stdint.h>
39
#include <string>
40
41
namespace
serial
42
{
43
class
Serial
;
44
}
45
46
namespace
um6
47
{
48
49
class
SerialTimeout
:
public
std::exception {};
50
51
class
BadChecksum
:
public
std::exception {};
52
53
class
Registers
;
54
class
Accessor_
;
55
56
class
Comms
57
{
58
public
:
59
explicit
Comms
(
serial::Serial
* s) : serial_(s), first_spin_(true)
60
{
61
}
62
69
int16_t receive(
Registers
* r);
70
71
void
send(
const
Accessor_
& a)
const
;
72
73
bool
sendWaitAck(
const
Accessor_
& a);
74
75
static
const
uint8_t
PACKET_HAS_DATA
;
76
static
const
uint8_t
PACKET_IS_BATCH
;
77
static
const
uint8_t
PACKET_BATCH_LENGTH_MASK
;
78
static
const
uint8_t
PACKET_BATCH_LENGTH_OFFSET
;
79
80
static
std::string checksum(
const
std::string& s);
81
82
static
std::string message(uint8_t address, std::string data);
83
84
private
:
85
bool
first_spin_
;
86
serial::Serial
*
serial_
;
87
};
88
}
// namespace um6
89
90
#endif // UM6_COMMS_H
91
um6::BadChecksum
Definition:
comms.h:51
um6::Comms::PACKET_HAS_DATA
static const uint8_t PACKET_HAS_DATA
Definition:
comms.h:75
um6::Registers
Definition:
registers.h:158
Serial
um6::Comms::serial_
serial::Serial * serial_
Definition:
comms.h:86
um6::Comms::PACKET_IS_BATCH
static const uint8_t PACKET_IS_BATCH
Definition:
comms.h:76
um6
Definition:
comms.h:46
um6::Comms::PACKET_BATCH_LENGTH_OFFSET
static const uint8_t PACKET_BATCH_LENGTH_OFFSET
Definition:
comms.h:78
serial
serial::Serial
um6::SerialTimeout
Definition:
comms.h:49
um6::Comms::Comms
Comms(serial::Serial *s)
Definition:
comms.h:59
um6::Comms::PACKET_BATCH_LENGTH_MASK
static const uint8_t PACKET_BATCH_LENGTH_MASK
Definition:
comms.h:77
um6::Comms::first_spin_
bool first_spin_
Definition:
comms.h:85
um6::Comms
Definition:
comms.h:56
um6::Accessor_
Definition:
registers.h:93
um6
Author(s): Mike Purvis
autogenerated on Thu Sep 26 2019 03:18:02