mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
rpl_udp: Addresses must only be 8-bit with cc110x
This commit is contained in:
parent
0641ccbd5d
commit
38fab9dbb6
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
command order:
|
command order:
|
||||||
|
|
||||||
set <node-id>
|
|
||||||
init [r|n]
|
init [r|n]
|
||||||
server
|
server
|
||||||
send <node-id> <message>
|
send <node-id> <message>
|
||||||
@ -24,11 +23,6 @@ Run the first node
|
|||||||
make term
|
make term
|
||||||
|
|
||||||
Type ``help`` to see the commands available.
|
Type ``help`` to see the commands available.
|
||||||
Now you need set the node ID. This ID will be used by other nodes to address this node.
|
|
||||||
|
|
||||||
> set 1
|
|
||||||
set 1
|
|
||||||
Set node ID to 1
|
|
||||||
|
|
||||||
Init your rpl node as either a root or a node router.
|
Init your rpl node as either a root or a node router.
|
||||||
|
|
||||||
|
@ -43,7 +43,11 @@ void rpl_udp_set_id(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
printf("Usage: %s address\n", argv[0]);
|
printf("Usage: %s address\n", argv[0]);
|
||||||
|
#if defined(MODULE_CC110X_LEGACY_CSMA) || defined(MODULE_CC110X_LEGACY)
|
||||||
printf("\taddress must be an 8 bit integer\n");
|
printf("\taddress must be an 8 bit integer\n");
|
||||||
|
#else
|
||||||
|
printf("\taddress must be an 16 bit integer\n");
|
||||||
|
#endif
|
||||||
printf("\n\t(Current address is %u)\n", id);
|
printf("\n\t(Current address is %u)\n", id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ int main(void)
|
|||||||
/* start shell */
|
/* start shell */
|
||||||
posix_open(uart0_handler_pid, 0);
|
posix_open(uart0_handler_pid, 0);
|
||||||
net_if_set_src_address_mode(0, NET_IF_TRANS_ADDR_M_SHORT);
|
net_if_set_src_address_mode(0, NET_IF_TRANS_ADDR_M_SHORT);
|
||||||
|
id = net_if_get_hardware_address(0);
|
||||||
|
|
||||||
shell_t shell;
|
shell_t shell;
|
||||||
shell_init(&shell, shell_commands, UART0_BUFSIZE, uart0_readc, uart0_putc);
|
shell_init(&shell, shell_commands, UART0_BUFSIZE, uart0_readc, uart0_putc);
|
||||||
|
@ -60,10 +60,12 @@ void rpl_udp_init(int argc, char **argv)
|
|||||||
((command == 'h') ? "non-" : ""),
|
((command == 'h') ? "non-" : ""),
|
||||||
(((command == 'n') || (command == 'h')) ? "node" : "root"), id);
|
(((command == 'n') || (command == 'h')) ? "node" : "root"), id);
|
||||||
|
|
||||||
|
#if defined(MODULE_CC110X_LEGACY_CSMA) || defined(MODULE_CC110X_LEGACY)
|
||||||
if (!id || (id > 255)) {
|
if (!id || (id > 255)) {
|
||||||
printf("ERROR: address not a valid 8 bit integer\n");
|
printf("ERROR: address not a valid 8 bit integer\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
DEBUGF("Setting HW address to %u\n", id);
|
DEBUGF("Setting HW address to %u\n", id);
|
||||||
net_if_set_hardware_address(0, id);
|
net_if_set_hardware_address(0, id);
|
||||||
|
Loading…
Reference in New Issue
Block a user