2#ifndef PFLIB_UTILITY_INTEL_HEX_H
3#define PFLIB_UTILITY_INTEL_HEX_H
50 template <
typename WordType,
51 std::enable_if_t<std::is_integral<WordType>::value,
bool> =
true>
55 for (
int i_byte{0}; i_byte <
sizeof(WordType); i_byte++) {
56 data_[i_byte] =
static_cast<uint8_t
>(
57 (value >> 8 * (
sizeof(WordType) - i_byte - 1)) & 0xff);
63 template <
typename WordType,
64 std::enable_if_t<std::is_integral<WordType>::value,
bool> =
true>
68 word |= (
static_cast<WordType
>(
get_bytes().
at(i_byte))
69 << 8 * (
sizeof(WordType) - i_byte - 1));
74 const uint16_t&
addr()
const;
a record of data from/to the IntelHex format
Definition intel_hex.h:40
void from(uint16_t addr, WordType value)
set contents of data record using width of integer type
Definition intel_hex.h:52
const uint16_t & addr() const
get address
Definition intel_hex.cxx:16
const std::vector< uint8_t > & get_bytes() const
get raw bytes of data
Definition intel_hex.cxx:14
void from_bytes(uint16_t addr, std::vector< uint8_t > data)
set contents of data record
Definition intel_hex.cxx:9
std::vector< uint8_t > data_
actual data in this record
Definition intel_hex.h:42
uint16_t addr_
address for the data
Definition intel_hex.h:44
WordType get()
get data in terms of integer type
Definition intel_hex.h:65
reader for the IntelHex format
Definition intel_hex.h:93
writer for the IntelHexFormat
Definition intel_hex.h:124
Dumping ground for various functions that are used in many places.
Definition crc.cxx:9