Main Page
Namespaces
Classes
Files
File List
File Members
include
um7
comms.h
Go to the documentation of this file.
1
35
#ifndef UM7_COMMS_H_
36
#define UM7_COMMS_H_
37
38
#include <stdint.h>
39
#include <string>
40
41
namespace
serial
42
{
43
class
Serial
;
44
}
45
46
namespace
um7
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 um7
89
90
#endif // UM7_COMMS_H
91
um7::Comms::serial_
serial::Serial * serial_
Definition:
comms.h:86
Serial
um7::Comms::first_spin_
bool first_spin_
Definition:
comms.h:85
um7::Comms::Comms
Comms(serial::Serial *s)
Definition:
comms.h:59
serial
serial::Serial
um7::Comms::PACKET_BATCH_LENGTH_MASK
static const uint8_t PACKET_BATCH_LENGTH_MASK
Definition:
comms.h:77
um7
Definition:
comms.h:46
um7::SerialTimeout
Definition:
comms.h:49
um7::Comms::PACKET_IS_BATCH
static const uint8_t PACKET_IS_BATCH
Definition:
comms.h:76
um7::Registers
Definition:
registers.h:158
um7::Accessor_
Definition:
registers.h:93
um7::Comms::PACKET_BATCH_LENGTH_OFFSET
static const uint8_t PACKET_BATCH_LENGTH_OFFSET
Definition:
comms.h:78
um7::Comms::PACKET_HAS_DATA
static const uint8_t PACKET_HAS_DATA
Definition:
comms.h:75
um7::BadChecksum
Definition:
comms.h:51
um7::Comms
Definition:
comms.h:56
um7
Author(s): Mike Purvis
, Alex Brown
autogenerated on Tue Feb 11 2020 03:26:50