diff --git a/boards/stm32f4discovery/Makefile.features b/boards/stm32f4discovery/Makefile.features index 488ed7842..5585854cb 100644 --- a/boards/stm32f4discovery/Makefile.features +++ b/boards/stm32f4discovery/Makefile.features @@ -1,4 +1,4 @@ FEATURES_PROVIDED += cpp FEATURES_PROVIDED += periph_uart periph_gpio periph_spi periph_i2c periph_pwm periph_random \ - periph_adc periph_dac + periph_adc periph_dac periph_cpuid FEATURES_MCU_GROUP = cortex_m4 diff --git a/cpu/stm32f4/include/cpu-conf.h b/cpu/stm32f4/include/cpu-conf.h index a3bdeb332..c77ccf141 100644 --- a/cpu/stm32f4/include/cpu-conf.h +++ b/cpu/stm32f4/include/cpu-conf.h @@ -53,6 +53,11 @@ #endif /** @} */ +/** + * @brief Length for reading CPU_ID + */ +#define CPUID_ID_LEN (12) + /** * @name CC110X buffer size definitions for the stm32f4 * @{ diff --git a/cpu/stm32f4/periph/cpuid.c b/cpu/stm32f4/periph/cpuid.c new file mode 100644 index 000000000..61f760cb0 --- /dev/null +++ b/cpu/stm32f4/periph/cpuid.c @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2015 James Hollister + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @addtogroup driver_periph + * @{ + * + * @file + * @brief Low-level CPUID driver implementation + * + * @author James Hollister + */ + +#include +#include "cpu-conf.h" + +#include "periph/cpuid.h" + +#define STM32F4_CPUID_ADDR (0x1fff7a10) + +void cpuid_get(void *id) +{ + memcpy(id, (void *)(STM32F4_CPUID_ADDR), CPUID_ID_LEN); +} + +/** @} */