cute F1 detection code

This commit is contained in:
rusefi 2022-08-07 19:12:00 -04:00
parent 4e750bcacd
commit a1cfe00ae8
1 changed files with 14 additions and 0 deletions

14
stm32-util/mcu-util.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef DBGMCU_IDCODE_REV_ID_Pos
#define DBGMCU_IDCODE_REV_ID_Pos (16U)
#endif
#ifndef DBGMCU_IDCODE_REV_ID_Msk
#define DBGMCU_IDCODE_REV_ID_Msk (0xFFFFUL << DBGMCU_IDCODE_REV_ID_Pos) /*!< 0xFFFF0000 */
#endif
// real stm32F1 would return 0x1001 they say
#define REAL_STM_F1_REV_CODE 0x1001
#define REAL_SOMETHING_F1_REV_CODE 0x2003
#define ARM_REV_CODE() ((DBGMCU->IDCODE & DBGMCU_IDCODE_REV_ID_Msk) >> DBGMCU_IDCODE_REV_ID_Pos)