diff --git a/boards/pic32-clicker/Makefile.features b/boards/pic32-clicker/Makefile.features index 272d7cc6fa..195a6f4b43 100644 --- a/boards/pic32-clicker/Makefile.features +++ b/boards/pic32-clicker/Makefile.features @@ -1,4 +1,5 @@ # Put defined MCU peripherals here (in alphabetical order) +FEATURES_PROVIDED += periph_cpuid FEATURES_PROVIDED += periph_gpio FEATURES_PROVIDED += periph_timer FEATURES_PROVIDED += periph_uart diff --git a/boards/pic32-wifire/Makefile.features b/boards/pic32-wifire/Makefile.features index 272d7cc6fa..195a6f4b43 100644 --- a/boards/pic32-wifire/Makefile.features +++ b/boards/pic32-wifire/Makefile.features @@ -1,4 +1,5 @@ # Put defined MCU peripherals here (in alphabetical order) +FEATURES_PROVIDED += periph_cpuid FEATURES_PROVIDED += periph_gpio FEATURES_PROVIDED += periph_timer FEATURES_PROVIDED += periph_uart diff --git a/cpu/mips_pic32_common/include/periph_cpu_common.h b/cpu/mips_pic32_common/include/periph_cpu_common.h index 3a3361f996..1e5a183714 100644 --- a/cpu/mips_pic32_common/include/periph_cpu_common.h +++ b/cpu/mips_pic32_common/include/periph_cpu_common.h @@ -26,6 +26,11 @@ extern "C" { #endif + /** + * @brief Length of the CPU_ID in bytes + */ +#define CPUID_LEN (4U) + #define GPIO_PIN(x,y) ((x << 4) | (y & 0xf)) /** diff --git a/cpu/mips_pic32_common/periph/cpuid.c b/cpu/mips_pic32_common/periph/cpuid.c new file mode 100644 index 0000000000..22842e8e19 --- /dev/null +++ b/cpu/mips_pic32_common/periph/cpuid.c @@ -0,0 +1,18 @@ +/* + * Copyright(C) 2017 Francois Berder + * + * 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. + * + */ + +#include +#include +#include "board.h" +#include "periph/cpuid.h" + + void cpuid_get(void *id) + { + memcpy(id, (uint32_t*)&DEVID, CPUID_LEN); + }