26 uint8_t *uid = (uint8_t *)uid_buf;
27 const char chars[] =
"0123456789ABCDEF";
32 len = (2 *
sizeof(uid_buf) < string_len) ?
33 2 *
sizeof(uid_buf) : string_len - 1;
35 for (i = 0; i < len; i += 2) {
36 string[i] = chars[(uid[i / 2] >> 4) & 0x0F];
37 string[i + 1] = chars[(uid[i / 2] >> 0) & 0x0F];
45 uint8_t *uid = (uint8_t *)uid_buf;
51 serial[1] = uid[10] + uid[2];
53 serial[3] = uid[8] + uid[0];
57 uint8_t *ser = &serial[0];
58 uint8_t *end = &serial[6];
59 const char hex_digit[] =
"0123456789ABCDEF";
61 for (; ser < end; ser++) {
62 *
string++ = hex_digit[(*ser >> 4) & 0x0f];
63 *
string++ = hex_digit[(*ser >> 0) & 0x0f];
void desig_get_unique_id(uint32_t *result)
Read the full 96 bit unique identifier Note: ST specifies that bits 31..16 are also reserved for futu...
void desig_get_unique_id_as_dfu(char *string)
Generate the same serial number from the unique id registers as the DFU bootloader.
void desig_get_unique_id_as_string(char *string, unsigned int string_len)
Read the full 96 bit unique identifier and return it as a zero-terminated string.