[FL-1542], [FL-1603] Generate random name (#602)
* Lib: add random name library * Text_input: add default text clearing * All: rework all applications with new text_input API * Nfc: fix removing dev file on save_name scene enter * Lib: move all free radicals to toolbox and update API usage. Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
16
lib/toolbox/hex.c
Normal file
16
lib/toolbox/hex.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "hex.h"
|
||||
|
||||
bool hex_char_to_hex_nibble(char c, uint8_t* nibble) {
|
||||
if((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')) {
|
||||
if((c >= '0' && c <= '9')) {
|
||||
*nibble = c - '0';
|
||||
} else if((c >= 'A' && c <= 'F')) {
|
||||
*nibble = c - 'A' + 10;
|
||||
} else {
|
||||
*nibble = c - 'a' + 10;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user