Skyward boardcore
Loading...
Searching...
No Matches
Boardcore::SerialTransceiver Class Reference

#include <SerialTransceiver.h>

Inheritance diagram for Boardcore::SerialTransceiver:
Collaboration diagram for Boardcore::SerialTransceiver:

Public Member Functions

 SerialTransceiver (USARTInterface &usart)
 
bool send (uint8_t *packet, size_t packetLength)
 Send a packet.
 
ssize_t receive (uint8_t *packet, size_t packetLength)
 Wait until a new packet is received.
 
- Public Member Functions inherited from Boardcore::Transceiver
 Transceiver ()
 
virtual ~Transceiver ()
 

Detailed Description

Definition at line 34 of file SerialTransceiver.h.

Constructor & Destructor Documentation

◆ SerialTransceiver()

Boardcore::SerialTransceiver::SerialTransceiver ( USARTInterface & usart)
inline

Definition at line 37 of file SerialTransceiver.h.

Member Function Documentation

◆ receive()

ssize_t Boardcore::SerialTransceiver::receive ( uint8_t * packet,
size_t packetLength )
inlinevirtual

Wait until a new packet is received.

Parameters
packetBuffer to store the packet (at least packetLength bytes).
packetLengthMaximum length of the received data.
Returns
Size of the data received or -1 if failure

Implements Boardcore::Transceiver.

Definition at line 45 of file SerialTransceiver.h.

◆ send()

bool Boardcore::SerialTransceiver::send ( uint8_t * packet,
size_t packetLength )
inlinevirtual

Send a packet.

The function must block the thread until the packet is sent (successfully or not).

Parameters
packetPointer to the packet (at least packetLength bytes).
packetLengthLength of the packet to be sent.
Returns
True if the message was sent correctly.

Implements Boardcore::Transceiver.

Definition at line 39 of file SerialTransceiver.h.


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