1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #9543 from smlng/pr/netdev/reset

cc2538: use netdev reset
This commit is contained in:
Koen Zandberg 2018-07-13 14:52:39 +02:00 committed by GitHub
commit 9f289dff1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -367,24 +367,20 @@ static int _init(netdev_t *netdev)
uint16_t addr_short = cc2538_get_addr_short();
uint64_t addr_long = cc2538_get_addr_long();
netdev_ieee802154_reset(&dev->netdev);
/* Initialise netdev_ieee802154_t struct */
netdev_ieee802154_set((netdev_ieee802154_t *)netdev, NETOPT_NID, &pan,
sizeof(pan));
netdev_ieee802154_set((netdev_ieee802154_t *)netdev, NETOPT_CHANNEL, &chan,
sizeof(chan));
netdev_ieee802154_set((netdev_ieee802154_t *)netdev, NETOPT_ADDRESS,
netdev_ieee802154_set(&dev->netdev, NETOPT_NID,
&pan, sizeof(pan));
netdev_ieee802154_set(&dev->netdev, NETOPT_CHANNEL,
&chan, sizeof(chan));
netdev_ieee802154_set(&dev->netdev, NETOPT_ADDRESS,
&addr_short, sizeof(addr_short));
netdev_ieee802154_set((netdev_ieee802154_t *)netdev, NETOPT_ADDRESS_LONG,
netdev_ieee802154_set(&dev->netdev, NETOPT_ADDRESS_LONG,
&addr_long, sizeof(addr_long));
cc2538_set_state(dev, NETOPT_STATE_IDLE);
/* set default protocol */
#ifdef MODULE_GNRC_SIXLOWPAN
dev->netdev.proto = GNRC_NETTYPE_SIXLOWPAN;
#elif MODULE_GNRC
dev->netdev.proto = GNRC_NETTYPE_UNDEF;
#endif
#ifdef MODULE_NETSTATS_L2
memset(&netdev->stats, 0, sizeof(netstats_t));
#endif