mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-15 00:08:11 -07:00
Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
@@ -26,3 +26,14 @@ bool hex_chars_to_uint8(char hi, char low, uint8_t* value) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool hex_chars_to_uint64(const char* value_str, uint64_t* value) {
|
||||
uint8_t* _value = (uint8_t*)value;
|
||||
bool parse_success = false;
|
||||
|
||||
for(uint8_t i = 0; i < 8; i++) {
|
||||
parse_success = hex_chars_to_uint8(value_str[i * 2], value_str[i * 2 + 1], &_value[7 - i]);
|
||||
if(!parse_success) break;
|
||||
}
|
||||
return parse_success;
|
||||
}
|
||||
|
||||
+19
-11
@@ -6,23 +6,31 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Convert ASCII hex value to nibble
|
||||
* @param c ASCII character
|
||||
* @param nibble nibble pointer, output
|
||||
* @return bool conversion status
|
||||
/** Convert ASCII hex value to nibble
|
||||
* @param c ASCII character
|
||||
* @param nibble nibble pointer, output
|
||||
*
|
||||
* @return bool conversion status
|
||||
*/
|
||||
bool hex_char_to_hex_nibble(char c, uint8_t* nibble);
|
||||
|
||||
/**
|
||||
* Convert ASCII hex values to byte
|
||||
* @param hi hi nibble text
|
||||
* @param low low nibble text
|
||||
* @param value output value
|
||||
* @return bool conversion status
|
||||
/** Convert ASCII hex values to byte
|
||||
* @param hi hi nibble text
|
||||
* @param low low nibble text
|
||||
* @param value output value
|
||||
*
|
||||
* @return bool conversion status
|
||||
*/
|
||||
bool hex_chars_to_uint8(char hi, char low, uint8_t* value);
|
||||
|
||||
/** Convert ASCII hex values to uint64_t
|
||||
* @param value_str ASCII 64 bi data
|
||||
* @param value output value
|
||||
*
|
||||
* @return bool conversion status
|
||||
*/
|
||||
bool hex_chars_to_uint64(const char* value_str, uint64_t* value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user