mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #14942 from benpicco/drivers/dose_eui
drivers/dose: use EUI provider
This commit is contained in:
commit
8e74bb04d0
@ -1,3 +1,7 @@
|
||||
ifneq (,$(filter saul_default,$(USEMODULE)))
|
||||
USEMODULE += saul_gpio
|
||||
endif
|
||||
|
||||
ifneq (,$(filter eui_provider,$(USEMODULE)))
|
||||
USEMODULE += at24mac
|
||||
endif
|
||||
|
@ -21,6 +21,7 @@
|
||||
#define BOARD_H
|
||||
|
||||
#include "cpu.h"
|
||||
#include "at24mac.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -43,6 +44,22 @@ extern "C" {
|
||||
#define ATCA_PARAM_I2C I2C_DEV(1)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief AT24Mac provides a EUI-48
|
||||
*/
|
||||
static inline int _at24mac_get_eui48(const void *arg, eui48_t *addr)
|
||||
{
|
||||
return at24mac_get_eui48((uintptr_t)arg, addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @name EUI-48 sources on the board
|
||||
* AT24Mac is present on the board
|
||||
* @{
|
||||
*/
|
||||
#define EUI48_PROVIDER_FUNC _at24mac_get_eui48
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name LED pin definitions and handlers
|
||||
* @{
|
||||
|
@ -1,6 +1,8 @@
|
||||
FEATURES_REQUIRED += periph_gpio_irq
|
||||
FEATURES_REQUIRED += periph_uart
|
||||
|
||||
USEMODULE += eui_provider
|
||||
USEMODULE += iolist
|
||||
USEMODULE += netdev_eth
|
||||
USEMODULE += random
|
||||
USEMODULE += xtimer
|
||||
FEATURES_REQUIRED += periph_gpio_irq
|
||||
|
@ -21,12 +21,11 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "dose.h"
|
||||
#include "luid.h"
|
||||
#include "random.h"
|
||||
#include "irq.h"
|
||||
|
||||
#include "net/eui_provider.h"
|
||||
#include "net/netdev/eth.h"
|
||||
#include "net/eui64.h"
|
||||
|
||||
#define ENABLE_DEBUG (0)
|
||||
#include "debug.h"
|
||||
@ -559,7 +558,7 @@ void dose_setup(dose_t *ctx, const dose_params_t *params, uint8_t index)
|
||||
netdev_register(&ctx->netdev, NETDEV_DOSE, index);
|
||||
|
||||
assert(sizeof(ctx->mac_addr.uint8) == ETHERNET_ADDR_LEN);
|
||||
luid_get_eui48(&ctx->mac_addr);
|
||||
netdev_eui48_get(&ctx->netdev, &ctx->mac_addr);
|
||||
DEBUG("dose dose_setup(): mac addr %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
ctx->mac_addr.uint8[0], ctx->mac_addr.uint8[1], ctx->mac_addr.uint8[2],
|
||||
ctx->mac_addr.uint8[3], ctx->mac_addr.uint8[4], ctx->mac_addr.uint8[5]
|
||||
|
@ -30,7 +30,7 @@ extern "C" {
|
||||
* @{
|
||||
*/
|
||||
#ifndef DOSE_PARAM_UART
|
||||
#define DOSE_PARAM_UART (UART_DEV(0))
|
||||
#define DOSE_PARAM_UART (UART_DEV(1))
|
||||
#endif
|
||||
#ifndef DOSE_PARAM_BAUDRATE
|
||||
#define DOSE_PARAM_BAUDRATE (115200)
|
||||
|
Loading…
Reference in New Issue
Block a user