|
UMRT Arm Firmware Library
|
A collection of helper functions related to encoding/decoding data for communication over a Firmata link. More...
#include <cstdint>#include <string>#include <vector>

Go to the source code of this file.
Functions | |
| std::vector< uint8_t > | pack_32 (const uint32_t integer) |
| Packs a 32-bit integer into a vector of 8-bit integers, in little-endian format. More... | |
| std::vector< uint8_t > | pack_32_big (const uint32_t integer) |
| Packs a 32-bit integer into a vector of 8-bit integers, in big-endian format. More... | |
| std::vector< uint8_t > | pack_24_big (const uint32_t integer) |
| Packs a 24-bit integer into a vector of 8-bit integers, in big-endian format. More... | |
| std::vector< uint8_t > | pack_16 (const uint16_t integer) |
| Packs a 16-bit integer into a vector of 8-bit integers, in little-endian format. More... | |
| std::vector< uint8_t > | pack_16_big (const uint16_t integer) |
| Packs a 16-bit integer into a vector of 8-bit integers, in big-endian format. More... | |
| std::vector< uint8_t > | firmatify_32 (const std::vector< uint8_t >::const_iterator &pack) |
| Converts a packed byte vector to the 7-bit packets Firmata receives. More... | |
| std::vector< uint8_t > | firmatify_32 (const std::vector< uint8_t > &pack) |
Calls firmatify_32(const std::vector<uint8_t>::const_iterator&) with pack.cbegin() More... | |
| std::vector< uint8_t > | firmatify_16 (const std::vector< uint8_t >::const_iterator &pack) |
| Converts a packed byte vector to the 7-bit packets Firmata receives. More... | |
| std::vector< uint8_t > | firmatify_16 (const std::vector< uint8_t > &pack) |
Calls firmatify_16(const std::vector<uint8_t>::const_iterator&) with pack.cbegin() More... | |
| std::vector< uint8_t > | firmatify_8 (const uint8_t val) |
| Converts an 8-bit integer to the two 7-bit packets Firmata uses. More... | |
| uint32_t | decode_32 (const std::vector< uint8_t >::const_iterator &data) |
| Reconstructs a little-endian byte vector into a 32-bit integer. More... | |
| uint32_t | decode_32 (const std::vector< uint8_t > &data) |
Calls decode_32(const std::vector<uint8_t>::const_iterator&) with data.cbegin() More... | |
| uint32_t | decode_32_big (const std::vector< uint8_t >::const_iterator &data) |
| Reconstructs a big-endian byte vector into a 32-bit integer. More... | |
| uint32_t | decode_32_big (const std::vector< uint8_t > &data) |
Calls decode_32_big(const std::vector<uint8_t>::const_iterator&) with data.cbegin() More... | |
| uint16_t | decode_16 (const std::vector< uint8_t >::const_iterator &data) |
| Reconstructs a little-endian byte vector into a 16-bit integer. More... | |
| uint16_t | decode_16 (const std::vector< uint8_t > &data) |
Calls decode_16(const std::vector<uint8_t>::const_iterator&) with data.cbegin() More... | |
| uint16_t | decode_16_big (const std::vector< uint8_t >::const_iterator &data) |
| Reconstructs a big-endian byte vector into a 16-bit integer. More... | |
| uint16_t | decode_16_big (const std::vector< uint8_t > &data) |
Calls decode_16(const std::vector<uint8_t>::const_iterator&) with data.cbegin() More... | |
| std::vector< uint8_t > | encode_string (const std::string &str) |
| Packs an std::string into a vector of 8-bit integers, in little-endian format. More... | |
| std::string | decode_string (const std::vector< uint8_t > &data) |
| Decodes a little-endian byte vector into an std::string. More... | |
A collection of helper functions related to encoding/decoding data for communication over a Firmata link.
|
inline |
Calls decode_16(const std::vector<uint8_t>::const_iterator&) with data.cbegin()
| data | the byte vector to convert |
|
inline |
Reconstructs a little-endian byte vector into a 16-bit integer.
| data | iterator to the byte vector subset to convert |
|
inline |
Calls decode_16(const std::vector<uint8_t>::const_iterator&) with data.cbegin()
| data | the byte vector to convert |
|
inline |
Reconstructs a big-endian byte vector into a 16-bit integer.
| data | iterator to the byte vector subset to convert |
|
inline |
Calls decode_32(const std::vector<uint8_t>::const_iterator&) with data.cbegin()
| data | the byte vector to convert |
|
inline |
Reconstructs a little-endian byte vector into a 32-bit integer.
| data | iterator to the byte vector subset to convert |
|
inline |
Calls decode_32_big(const std::vector<uint8_t>::const_iterator&) with data.cbegin()
| data | the byte vector to convert |
|
inline |
Reconstructs a big-endian byte vector into a 32-bit integer.
| data | iterator to the byte vector subset to convert |
|
inline |
Decodes a little-endian byte vector into an std::string.
| data | the byte vector to convert |
|
inline |
Packs an std::string into a vector of 8-bit integers, in little-endian format.
| str | the std::string to pack |
str
|
inline |
Calls firmatify_16(const std::vector<uint8_t>::const_iterator&) with pack.cbegin()
| pack | the byte vector to convert |
pack
|
inline |
Converts a packed byte vector to the 7-bit packets Firmata receives.
Useful for checking a == decode_16(firmatify_16(pack_16(a)))
e.g. for { 0xEF, 0xBE }:
| pack | iterator to the byte vector subset to convert |
pack
|
inline |
Calls firmatify_32(const std::vector<uint8_t>::const_iterator&) with pack.cbegin()
| pack | the byte vector to convert |
pack
|
inline |
Converts a packed byte vector to the 7-bit packets Firmata receives.
Useful for checking a == decode_32(firmatify_32(pack_32(a)))
E.g. for { 0xEF, 0xBE, 0xAD, 0xDE }:
| pack | iterator to the byte vector subset to convert |
pack
|
inline |
Converts an 8-bit integer to the two 7-bit packets Firmata uses.
E.g. for 0xBE: input = 1010 1101 firmatified = { 0010 1101, 0000 0001 } = { 0x2D, 0x01 }
| val | the integer to convert |
val
|
inline |
Packs a 16-bit integer into a vector of 8-bit integers, in little-endian format.
E.g. for 0xBEEF:
| integer | the integer to pack |
integer
|
inline |
Packs a 16-bit integer into a vector of 8-bit integers, in big-endian format.
E.g. for 0xBEEF:
| integer | the integer to pack |
integer
|
inline |
Packs a 24-bit integer into a vector of 8-bit integers, in big-endian format.
E.g. for 0AD_xBEEF:
| integer | the integer to pack, with bits [31, 24] ignored |
integer
|
inline |
Packs a 32-bit integer into a vector of 8-bit integers, in little-endian format.
E.g. for 0xDEAD_BEEF:
| integer | the integer to pack |
integer
|
inline |
Packs a 32-bit integer into a vector of 8-bit integers, in big-endian format.
E.g. for 0xDEAD_BEEF:
| integer | the integer to pack |
integer