changed mac framer to be able to change panid during runtime

example:
#include "net/mac/framer-802154.h"
uint16_t panid = 1234;
framer_802154_set_panid(panid);

attention: this only changes the framer panid, you need to change
the radio panid too, e.g. with rf230_set_pan_addr on avr atmega128rfa1
This commit is contained in:
AndreasReder 2013-03-20 07:00:46 +01:00 committed by harald
parent 057a3c3345
commit 033adfa678
2 changed files with 17 additions and 4 deletions

View file

@ -65,13 +65,23 @@ static uint8_t initialized = 0;
* sending to. If this value is 0xffff, the device is not
* associated.
*/
static const uint16_t mac_dst_pan_id = IEEE802154_PANID;
static uint16_t mac_dst_pan_id = IEEE802154_PANID;
/** \brief The 16-bit identifier of the PAN on which the device is
* operating. If this value is 0xffff, the device is not
* associated.
*/
static const uint16_t mac_src_pan_id = IEEE802154_PANID;
static uint16_t mac_src_pan_id = IEEE802154_PANID;
/*---------------------------------------------------------------------------*/
void framer_802154_set_panid(uint16_t panid){
mac_dst_pan_id = panid;
mac_src_pan_id = panid;
}
/*---------------------------------------------------------------------------*/
uint16_t framer_802154_get_panid(){
return mac_dst_pan_id;
}
/*---------------------------------------------------------------------------*/
static int
@ -175,7 +185,6 @@ create(void)
PRINTF("15.4-OUT: %2X", params.fcf.frame_type);
PRINTADDR(params.dest_addr);
PRINTF("%d %u (%u)\n", len, packetbuf_datalen(), packetbuf_totlen());
return len;
} else {
PRINTF("15.4-OUT: too large header: %u\n", len);

View file

@ -39,8 +39,12 @@
#ifndef FRAMER_802154_H_
#define FRAMER_802154_H_
#include <stdint.h>
#include "net/mac/framer.h"
extern const struct framer framer_802154;
#endif /* FRAMER_802154_H_ */
void framer_802154_set_panid(uint16_t panid);
uint16_t framer_802154_get_panid();
#endif /* __FRAMER_802154_H__ */