TM STM32F4xx Libraries  v1.0.0
Libraries for STM32F4xx devices from Tilen Majerle
tm_stm32f4_id.h
1 
30 #ifndef TM_IDENTIFICATION_H
31 #define TM_IDENTIFICATION_H 100
32 
33 /* C++ detection */
34 #ifdef __cplusplus
35 extern C {
36 #endif
37 
85 #include "stm32f4xx.h"
86 
98 #define ID_UNIQUE_ADDRESS 0x1FFF7A10
99 
103 #define ID_FLASH_ADDRESS 0x1FFF7A22
104 
108 #define ID_DBGMCU_IDCODE 0xE0042000
109 
131 #define TM_ID_GetSignature() ((*(uint16_t *) (ID_DBGMCU_IDCODE)) & 0x0FFF)
132 
144 #define TM_ID_GetRevision() (*(uint16_t *) (DBGMCU->IDCODE + 2))
145 
152 #define TM_ID_GetFlashSize() (*(uint16_t *) (ID_FLASH_ADDRESS))
153 
162 #define TM_ID_GetUnique8(x) ((x >= 0 && x < 12) ? (*(uint8_t *) (ID_UNIQUE_ADDRESS + (x))) : 0)
163 
172 #define TM_ID_GetUnique16(x) ((x >= 0 && x < 6) ? (*(uint16_t *) (ID_UNIQUE_ADDRESS + 2 * (x))) : 0)
173 
182 #define TM_ID_GetUnique32(x) ((x >= 0 && x < 3) ? (*(uint32_t *) (ID_UNIQUE_ADDRESS + 4 * (x))) : 0)
183 
197 /* C++ detection */
198 #ifdef __cplusplus
199 }
200 #endif
201 
202 #endif