added rp2040 unique id (requires submodule update)
This commit is contained in:
parent
7f1af42e27
commit
26039d84c7
|
@ -41,7 +41,7 @@ if(FAMILY STREQUAL "rp2040")
|
|||
target_compile_definitions(${PROJECT} PUBLIC
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT} pico_stdlib)
|
||||
target_link_libraries(${PROJECT} pico_stdlib pico_fix_rp2040_usb_device_enumeration pico_unique_id)
|
||||
|
||||
pico_add_extra_outputs(${PROJECT})
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#include <stdint.h>
|
||||
#include "pico/stdlib.h"
|
||||
#include "pico/unique_id.h"
|
||||
#include "tusb.h"
|
||||
|
||||
static uint8_t get_unique_id(uint16_t *desc_str)
|
||||
{
|
||||
pico_unique_board_id_t uid;
|
||||
uint8_t chr_count = 0;
|
||||
|
||||
pico_get_unique_board_id(&uid);
|
||||
|
||||
for (int byte = 0; byte < TU_ARRAY_SIZE(uid.id); byte++)
|
||||
{
|
||||
uint8_t tmp = uid.id[byte];
|
||||
for (int digit = 0; digit < 2; digit++)
|
||||
{
|
||||
desc_str[chr_count++] = "0123456789ABCDEF"[tmp & 0xf];
|
||||
tmp >>= 4;
|
||||
}
|
||||
}
|
||||
|
||||
return chr_count;
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
#include <stdint.h>
|
||||
#include "tusb.h"
|
||||
|
||||
|
||||
static uint8_t get_unique_id(uint16_t *desc_str)
|
||||
{
|
||||
const uint32_t *idpnt = (uint32_t*)(0x1FFFF7AC); /*DEVICE_ID1*/
|
||||
|
|
2
tinyusb
2
tinyusb
|
@ -1 +1 @@
|
|||
Subproject commit 666a851a0745ea32ac57e288e3043a6b93aa87e1
|
||||
Subproject commit 09868434cd9f53394350cce682333ada97f796c3
|
Loading…
Reference in New Issue