hex.h 825 B

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include "stdint.h"
  3. #include "stdbool.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /** Convert ASCII hex value to nibble
  8. * @param c ASCII character
  9. * @param nibble nibble pointer, output
  10. *
  11. * @return bool conversion status
  12. */
  13. bool hex_char_to_hex_nibble(char c, uint8_t* nibble);
  14. /** Convert ASCII hex values to byte
  15. * @param hi hi nibble text
  16. * @param low low nibble text
  17. * @param value output value
  18. *
  19. * @return bool conversion status
  20. */
  21. bool hex_chars_to_uint8(char hi, char low, uint8_t* value);
  22. /** Convert ASCII hex values to uint64_t
  23. * @param value_str ASCII 64 bi data
  24. * @param value output value
  25. *
  26. * @return bool conversion status
  27. */
  28. bool hex_chars_to_uint64(const char* value_str, uint64_t* value);
  29. #ifdef __cplusplus
  30. }
  31. #endif