ieee802154: Notify radio layer of changes in devmode
This commit is contained in:
parent
f944a33485
commit
420db06b37
|
@ -133,8 +133,14 @@ int mac802154_req_associate(MACHANDLE mac,
|
|||
|
||||
/* Copy in the capabilities information bitfield */
|
||||
|
||||
priv->devmode = (req->capabilities.devtype) ?
|
||||
IEEE802154_DEVMODE_COORD : IEEE802154_DEVMODE_ENDPOINT;
|
||||
if (req->capabilities.devtype)
|
||||
{
|
||||
mac802154_setdevmode(priv, IEEE802154_DEVMODE_COORD);
|
||||
}
|
||||
else
|
||||
{
|
||||
mac802154_setdevmode(priv, IEEE802154_DEVMODE_ENDPOINT);
|
||||
}
|
||||
|
||||
mac802154_setrxonidle(priv, req->capabilities.rxonidle);
|
||||
|
||||
|
|
|
@ -816,15 +816,16 @@ static inline void mac802154_setrxonidle(FAR struct ieee802154_privmac_s *priv,
|
|||
mac802154_rxdisable(priv);
|
||||
}
|
||||
|
||||
/* Unlike other attributes, we can't simply cast this one since it is a bit
|
||||
* in a bitfield. Casting it will give us unpredicatble results. Instead
|
||||
* of creating a ieee802154_attr_u, we use a local bool. Allocating the
|
||||
* ieee802154_attr_u value would take up more room on the stack since it is
|
||||
* as large as the largest attribute type.
|
||||
*/
|
||||
|
||||
priv->radio->setattr(priv->radio, IEEE802154_ATTR_MAC_RX_ON_WHEN_IDLE,
|
||||
(FAR const union ieee802154_attr_u *)&rxonidle);
|
||||
}
|
||||
|
||||
static inline void mac802154_setdevmode(FAR struct ieee802154_privmac_s *priv,
|
||||
enum ieee802154_devmode_e mode)
|
||||
{
|
||||
priv->devmode = mode;
|
||||
priv->radio->setattr(priv->radio, IEEE802154_ATTR_MAC_RX_ON_WHEN_IDLE,
|
||||
(FAR const union ieee802154_attr_u *)&mode);
|
||||
}
|
||||
|
||||
#endif /* __WIRELESS_IEEE802154__MAC802154_INTERNAL_H */
|
||||
|
|
Loading…
Reference in New Issue