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

examples/default: fix handling of 802.15.4 devices

This commit is contained in:
Thomas Eichinger 2014-09-03 14:55:17 +02:00
parent 19f612cf2c
commit a686e909aa
4 changed files with 29 additions and 3 deletions

View File

@ -28,7 +28,7 @@
#define ENABLE_DEBUG (0)
#if ENABLE_DEBUG
#define DEBUG_ENABLED
#define DEBUG_ENABLED (1)
#endif
#include "debug.h"

View File

@ -35,6 +35,10 @@
#include "ltc4150.h"
#endif
#if MODULE_AT86RF231 || MODULE_CC2420 || MODULE_MC1322X
#include "ieee802154_frame.h"
#endif
#ifdef MODULE_TRANSCEIVER
#include "transceiver.h"
#endif
@ -53,8 +57,13 @@ void *radio(void *arg)
(void) arg;
msg_t m;
#if MODULE_AT86RF231 || MODULE_CC2420 || MODULE_MC1322X
ieee802154_packet_t *p;
#else
radio_packet_t *p;
radio_packet_length_t i;
#endif
msg_init_queue(msg_q, RCV_BUFFER_SIZE);
@ -62,7 +71,22 @@ void *radio(void *arg)
msg_receive(&m);
if (m.type == PKT_PENDING) {
#if MODULE_AT86RF231 || MODULE_CC2420 || MODULE_MC1322X
p = (ieee802154_packet_t*) m.content.ptr;
printf("Got radio packet:\n");
printf("\tLength:\t%u\n", p->length);
printf("\tSrc:\t%u\n", p->frame.src_addr[0]);
printf("\tDst:\t%u\n", p->frame.dest_addr[0]);
printf("\tLQI:\t%u\n", p->lqi);
printf("\tRSSI:\t%u\n", p->rssi);
printf("Payload Length:%u\n", p->frame.payload_len);
printf("Payload:%s\n", p->frame.payload);
p->processing--;
#else
p = (radio_packet_t *) m.content.ptr;
printf("Got radio packet:\n");
printf("\tLength:\t%u\n", p->length);
printf("\tSrc:\t%u\n", p->src);
@ -76,6 +100,8 @@ void *radio(void *arg)
p->processing--;
puts("\n");
#endif
}
else if (m.type == ENOBUFFER) {
puts("Transceiver buffer full");

View File

@ -241,7 +241,7 @@ void _transceiver_send_handler(int argc, char **argv)
p.frame.fcf.dest_addr_m = IEEE_802154_SHORT_ADDR_M;
p.frame.fcf.src_addr_m = IEEE_802154_SHORT_ADDR_M;
memset(p.frame.dest_addr, 0, sizeof(p.frame.dest_addr));
p.frame.dest_addr[0] = atoi(argv[1]);
p.frame.dest_addr[1] = atoi(argv[1]);
#else
p.data = (uint8_t *) text_msg;
p.length = strlen(text_msg) + 1;

View File

@ -60,7 +60,7 @@
#include "ieee802154_frame.h"
#endif
#define ENABLE_DEBUG (1)
#define ENABLE_DEBUG (0)
#if ENABLE_DEBUG
#define DEBUG_ENABLED
#undef TRANSCEIVER_STACK_SIZE