From 84246d1687e7e26a76661d66354ad91c2d1dc4de Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Tue, 10 Jan 2017 15:19:48 +0100 Subject: [PATCH] drivers/cc110x: use uuid module for addr gen --- drivers/Makefile.dep | 1 + drivers/cc110x/cc110x-netdev2.c | 1 - drivers/cc110x/cc110x.c | 13 ++++--------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/Makefile.dep b/drivers/Makefile.dep index bab106b7d1..25878d84d0 100644 --- a/drivers/Makefile.dep +++ b/drivers/Makefile.dep @@ -31,6 +31,7 @@ endif ifneq (,$(filter cc110x,$(USEMODULE))) USEMODULE += ieee802154 + USEMODULE += uuid ifneq (,$(filter gnrc_netdev_default,$(USEMODULE))) USEMODULE += gnrc_cc110x # XXX: this can be modelled as a dependency for gnrc_netdev_default as soon diff --git a/drivers/cc110x/cc110x-netdev2.c b/drivers/cc110x/cc110x-netdev2.c index c8f58bdd7a..e7c862acc4 100644 --- a/drivers/cc110x/cc110x-netdev2.c +++ b/drivers/cc110x/cc110x-netdev2.c @@ -29,7 +29,6 @@ #include "cc110x-interface.h" #include "net/eui64.h" -#include "periph/cpuid.h" #include "periph/gpio.h" #include "net/netdev2.h" #include "net/gnrc/nettype.h" diff --git a/drivers/cc110x/cc110x.c b/drivers/cc110x/cc110x.c index 4e6b547750..778a103597 100644 --- a/drivers/cc110x/cc110x.c +++ b/drivers/cc110x/cc110x.c @@ -20,8 +20,8 @@ * @} */ +#include "uuid.h" #include "board.h" -#include "periph/cpuid.h" #include "periph/gpio.h" #include "periph/spi.h" #include "xtimer.h" @@ -87,14 +87,9 @@ int cc110x_setup(cc110x_t *dev, const cc110x_params_t *params) cc110x_set_channel(dev, CC110X_DEFAULT_CHANNEL); /* set default node id */ -#if CPUID_LEN - char cpuid[CPUID_LEN]; - cpuid_get(cpuid); - for (int i = 1; i < CPUID_LEN; i++) { - cpuid[0] ^= cpuid[i]; - } - cc110x_set_address(dev, (uint8_t) cpuid[0]); -#endif + uint8_t addr; + uuid_get(&addr, 1); + cc110x_set_address(dev, addr); LOG_INFO("cc110x: initialized with address=%u and channel=%i\n", (unsigned)dev->radio_address,