Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | List of all members
um7::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

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

Definition at line 59 of file comms.h.

Member Function Documentation

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

Definition at line 154 of file comms.cpp.

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

Definition at line 168 of file comms.cpp.

int16_t um7::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 um7::Comms::send ( const Accessor_ a) const

Definition at line 191 of file comms.cpp.

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

Definition at line 198 of file comms.cpp.

Member Data Documentation

bool um7::Comms::first_spin_
private

Definition at line 85 of file comms.h.

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

Definition at line 77 of file comms.h.

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

Definition at line 78 of file comms.h.

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

Definition at line 75 of file comms.h.

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

Definition at line 76 of file comms.h.

serial::Serial* um7::Comms::serial_
private

Definition at line 86 of file comms.h.


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


um7
Author(s): Mike Purvis , Alex Brown
autogenerated on Tue Feb 11 2020 03:26:50