JM9 UART packet unpacker. More...
#include <Jason.h>
Public Member Functions | |
| JM9_unpacker (HardwareSerial &init_uart, const uint8_t init_start_byte) | |
| Creates an unpacker. | |
| ~JM9_unpacker () | |
| Destroys this unpacker. | |
| bool | update () |
| Checks if a new packet is received. | |
| uint8_t * | get_packet_ptr () |
| Gets the pointer to the received data. | |
| uint8_t | get_packet_len () |
| Gets the length of the received data. | |
Public Attributes | |
| HardwareSerial & | uart |
| The underlying UART object. | |
JM9 UART packet unpacker.
| JM9_unpacker::JM9_unpacker | ( | HardwareSerial & | init_uart, |
| const uint8_t | init_start_byte ) |
Creates an unpacker.
| init_uart | the UART object to read packets from |
| init_start_byte | the start byte of each packet |
| JM9_unpacker::~JM9_unpacker | ( | ) |
Destroys this unpacker.
Releases the used memory.
| uint8_t JM9_unpacker::get_packet_len | ( | ) |
Gets the length of the received data.
Only call this method after update() returns true.
To be used with get_packet_ptr().
| uint8_t * JM9_unpacker::get_packet_ptr | ( | ) |
Gets the pointer to the received data.
The array pointed by this pointer contains data bytes only.
Only call this method after update() returns true.
To be used with get_packet_len().
| bool JM9_unpacker::update | ( | ) |
Checks if a new packet is received.
true if a new packet is completely received and checksumed, false otherwise