fix(h7): CPU id read (#7187)

This commit is contained in:
3djc
2026-03-17 10:42:38 +10:00
committed by GitHub
parent eea12d5769
commit 2fd271d551
+10 -7
View File
@@ -19,19 +19,22 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include "edgetx.h" #include "cpu_id.h"
#include "strhelpers.h"
#if defined(SIMU) #if defined(SIMU)
const uint32_t cpu_uid[3] = { 0x12345678, 0x55AA55AA, 0x87654321}; const uint32_t cpu_uid[3] = {0x12345678, 0x55AA55AA, 0x87654321};
#else #else
const uint32_t * const cpu_uid = (uint32_t *)0x1FFF7A10; #include "stm32_cmsis.h"
const uint32_t *const cpu_uid = (uint32_t *)UID_BASE;
#endif #endif
void getCPUUniqueID(char * s) void getCPUUniqueID(char* s)
{ {
char * tmp = strAppendUnsigned(s, cpu_uid[0], 8, 16); char* tmp = strAppendUnsigned(s, cpu_uid[0], 8, 16);
*tmp = ' '; *tmp = ' ';
tmp = strAppendUnsigned(tmp+1, cpu_uid[1], 8, 16); tmp = strAppendUnsigned(tmp + 1, cpu_uid[1], 8, 16);
*tmp = ' '; *tmp = ' ';
strAppendUnsigned(tmp+1, cpu_uid[2], 8, 16); strAppendUnsigned(tmp + 1, cpu_uid[2], 8, 16);
} }