diff --git a/sys/fmt/fmt.c b/sys/fmt/fmt.c index 2c997c6c29..11eddf3cfa 100644 --- a/sys/fmt/fmt.c +++ b/sys/fmt/fmt.c @@ -550,6 +550,15 @@ void print_byte_hex(uint8_t byte) print(buf, sizeof(buf)); } +void print_bytes_hex(const void *bytes, size_t num) +{ + const uint8_t *b = bytes; + + while (num--) { + print_byte_hex(*b++); + } +} + void print_u32_hex(uint32_t val) { char buf[8]; diff --git a/sys/include/fmt.h b/sys/include/fmt.h index c3a7b1cace..45d340fed7 100644 --- a/sys/include/fmt.h +++ b/sys/include/fmt.h @@ -450,6 +450,14 @@ void print_s32_dec(int32_t val); */ void print_byte_hex(uint8_t byte); +/** + * @brief Print bytes as hex to stdout + * + * @param[in] bytes Byte array to print + * @param[in] n Number of bytes to print + */ +void print_bytes_hex(const void *bytes, size_t n); + /** * @brief Print uint32 value as hex to stdout *