Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | List of all members
um6::Comms Class Reference

#include <comms.h>

Public Member Functions

 Comms (serial::Serial *s)
 
int16_t receive (Registers *r)
 
void send (const Accessor_ &a) const
 
bool sendWaitAck (const Accessor_ &a)
 

Static Public Member Functions

static std::string checksum (const std::string &s)
 
static std::string message (uint8_t address, std::string data)
 

Static Public Attributes

static const uint8_t PACKET_BATCH_LENGTH_MASK = 0x0F
 
static const uint8_t PACKET_BATCH_LENGTH_OFFSET = 2
 
static const uint8_t PACKET_HAS_DATA = 1 << 7
 
static const uint8_t PACKET_IS_BATCH = 1 << 6
 

Private Attributes

bool first_spin_
 
serial::Serialserial_
 

Detailed Description

Definition at line 56 of file comms.h.

Constructor & Destructor Documentation

um6::Comms::Comms ( serial::Serial s)
inlineexplicit

Definition at line 59 of file comms.h.

Member Function Documentation

std::string um6::Comms::checksum ( const std::string &  s)
static

Definition at line 154 of file comms.cpp.

std::string um6::Comms::message ( uint8_t  address,
std::string  data 
)
static

Definition at line 168 of file comms.cpp.

int16_t um6::Comms::receive ( Registers r = NULL)

Returns -1 if the serial port timed out before receiving a packet successfully, or if there was a bad checksum or any other error. Otherwise, returns the 8-bit register number of the successfully returned packet.

Definition at line 54 of file comms.cpp.

void um6::Comms::send ( const Accessor_ a) const

Definition at line 191 of file comms.cpp.

bool um6::Comms::sendWaitAck ( const Accessor_ a)

Definition at line 198 of file comms.cpp.

Member Data Documentation

bool um6::Comms::first_spin_
private

Definition at line 85 of file comms.h.

const uint8_t um6::Comms::PACKET_BATCH_LENGTH_MASK = 0x0F
static

Definition at line 77 of file comms.h.

const uint8_t um6::Comms::PACKET_BATCH_LENGTH_OFFSET = 2
static

Definition at line 78 of file comms.h.

const uint8_t um6::Comms::PACKET_HAS_DATA = 1 << 7
static

Definition at line 75 of file comms.h.

const uint8_t um6::Comms::PACKET_IS_BATCH = 1 << 6
static

Definition at line 76 of file comms.h.

serial::Serial* um6::Comms::serial_
private

Definition at line 86 of file comms.h.


The documentation for this class was generated from the following files:


um6
Author(s): Mike Purvis
autogenerated on Thu Sep 26 2019 03:18:02