mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
examples/rpl_udp: User configurable value for unassigned channel
0 is a valid channel on some transceivers (e.g. sub-GHz IEEE802.15.4 band) UNASSIGNED_CHANNEL is set to INT_MIN by default, but can be overridden via CFLAGS.
This commit is contained in:
parent
ebe0cb4516
commit
964bfbab41
@ -33,6 +33,10 @@
|
|||||||
#define ENABLE_DEBUG (0)
|
#define ENABLE_DEBUG (0)
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
#ifndef UNASSIGNED_CHANNEL
|
||||||
|
#define UNASSIGNED_CHANNEL INT_MIN
|
||||||
|
#endif
|
||||||
|
|
||||||
#define TRANSCEIVER TRANSCEIVER_DEFAULT
|
#define TRANSCEIVER TRANSCEIVER_DEFAULT
|
||||||
|
|
||||||
static char monitor_stack_buffer[MONITOR_STACK_SIZE];
|
static char monitor_stack_buffer[MONITOR_STACK_SIZE];
|
||||||
@ -44,7 +48,7 @@ void rpl_udp_init(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
transceiver_command_t tcmd;
|
transceiver_command_t tcmd;
|
||||||
msg_t m;
|
msg_t m;
|
||||||
int32_t chan = 0;
|
int32_t chan = UNASSIGNED_CHANNEL;
|
||||||
|
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
printf("Usage: %s (r|n|h)\n", argv[0]);
|
printf("Usage: %s (r|n|h)\n", argv[0]);
|
||||||
@ -76,7 +80,7 @@ void rpl_udp_init(int argc, char **argv)
|
|||||||
m.content.ptr = (void *) &tcmd;
|
m.content.ptr = (void *) &tcmd;
|
||||||
|
|
||||||
msg_send_receive(&m, &m, transceiver_pid);
|
msg_send_receive(&m, &m, transceiver_pid);
|
||||||
if( chan == 0 ) {
|
if( chan == UNASSIGNED_CHANNEL ) {
|
||||||
DEBUGF("The channel has not been set yet.");
|
DEBUGF("The channel has not been set yet.");
|
||||||
|
|
||||||
/* try to set the channel to 10 (RADIO_CHANNEL) */
|
/* try to set the channel to 10 (RADIO_CHANNEL) */
|
||||||
@ -85,7 +89,7 @@ void rpl_udp_init(int argc, char **argv)
|
|||||||
|
|
||||||
m.type = SET_CHANNEL;
|
m.type = SET_CHANNEL;
|
||||||
msg_send_receive(&m, &m, transceiver_pid);
|
msg_send_receive(&m, &m, transceiver_pid);
|
||||||
if( chan == 0 ) {
|
if( chan == UNASSIGNED_CHANNEL ) {
|
||||||
puts("ERROR: channel NOT set! Aborting initialization.");
|
puts("ERROR: channel NOT set! Aborting initialization.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user