TMF882X.Util (tmf882x v0.1.0)
Utilities for working with messages from the TMF882X
Link to this section Summary
Functions
Returns true if a given bit position set, false otherwise.
Encodes an integer as a single byte binary
Encodes an integer as a 2-byte binary
Encodes an integer as a 3-byte binary
Encodes an integer as a 4-byte binary
Returns the first byte of the binary
Returns the integer represented by the byte of the binary at position address
if the first byte of the binary is at position start
.
Returns the integer represented by the first two bytes of the binary
Returns the integer represented by the two bytes of the binary at position address
if the first byte of the binary is at position start
.
Returns the integer represented by the first three bytes of the binary
Returns the integer represented by the three bytes of the binary at position address
if the first byte of the binary is at position start
.
Returns the integer represented by the first four bytes of the binary
Returns the integer represented by the four bytes of the binary at position address
if the first byte of the binary is at position start
.
Returns an array of integer extracted three bytes at a time until either count
integers are found or the end of the binary is reached.
Returns an array of integer extracted four bytes at a time until either count
integers are found or the end of the binary is reached.
Link to this section Functions
bit_set?(a, bit)
@spec bit_set?(number(), non_neg_integer()) :: boolean()
Returns true if a given bit position set, false otherwise.
encode_int_1(a)
@spec encode_int_1(non_neg_integer()) :: binary()
Encodes an integer as a single byte binary
encode_int_2(a)
@spec encode_int_2(non_neg_integer()) :: binary()
Encodes an integer as a 2-byte binary
encode_int_3(a)
@spec encode_int_3(non_neg_integer()) :: binary()
Encodes an integer as a 3-byte binary
encode_int_4(a)
@spec encode_int_4(non_neg_integer()) :: binary()
Encodes an integer as a 4-byte binary
extract_int_1(arg)
Returns the first byte of the binary
extract_int_1_at(data, address, start \\ 0)
Returns the integer represented by the byte of the binary at position address
if the first byte of the binary is at position start
.
extract_int_2(arg)
@spec extract_int_2(binary()) :: non_neg_integer()
Returns the integer represented by the first two bytes of the binary
extract_int_2_at(data, address, start \\ 0)
Returns the integer represented by the two bytes of the binary at position address
if the first byte of the binary is at position start
.
extract_int_3(arg)
@spec extract_int_3(binary()) :: non_neg_integer()
Returns the integer represented by the first three bytes of the binary
extract_int_3_at(data, address, start \\ 0)
Returns the integer represented by the three bytes of the binary at position address
if the first byte of the binary is at position start
.
extract_int_4(arg)
@spec extract_int_4(binary()) :: non_neg_integer()
Returns the integer represented by the first four bytes of the binary
extract_int_4_at(data, address, start \\ 0)
Returns the integer represented by the four bytes of the binary at position address
if the first byte of the binary is at position start
.
extract_multi_int_3(data, address, start, count)
@spec extract_multi_int_3(binary(), byte(), byte(), non_neg_integer()) :: [ non_neg_integer() ]
Returns an array of integer extracted three bytes at a time until either count
integers are found or the end of the binary is reached.
extract_multi_int_4(data, address, start, count)
@spec extract_multi_int_4(binary(), byte(), byte(), non_neg_integer()) :: [ non_neg_integer() ]
Returns an array of integer extracted four bytes at a time until either count
integers are found or the end of the binary is reached.