Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Robert Hartung
ieee802154-radio-eval
Commits
967385a8
Commit
967385a8
authored
Dec 21, 2017
by
Robert Hartung
Browse files
Optimizes eval packet and removes include for fmt.h
parent
3e95e496
Changes
1
Hide whitespace changes
Inline
Side-by-side
software/main.c
View file @
967385a8
...
...
@@ -33,12 +33,11 @@
#include
"net/gnrc.h"
#include
"net/gnrc/netreg.h"
#include
"net/gnrc/netif/ieee802154.h"
#include
"fmt.h"
#define SEND_INTERVAL (1)
#define RCV_QUEUE_SIZE (4)
#define MAX_PAYLOAD_LENGTH (128)
#define MAGIC_STRING
(
"IBREVAL"
)
#define MAGIC_STRING "IBREVAL
\0
"
#ifndef NODE_ID
#error NODE_ID undefined
...
...
@@ -51,7 +50,7 @@ char send_thread_stack[256];
static
gnrc_netif_t
*
ieee802154_netif
=
NULL
;
typedef
struct
{
char
magic_string
[
7
];
char
magic_string
[
8
];
uint8_t
node_id
;
uint16_t
seq_nr
;
uint8_t
temp
;
...
...
@@ -76,15 +75,7 @@ static void _dump(gnrc_pktsnip_t *pkt) {
case
GNRC_NETTYPE_NETIF
:
hdr
=
snip
->
data
;
printf
(
"HDR: %d %d %d
\n
"
,
hdr
->
rssi
,
hdr
->
lqi
,
hdr
->
crc_valid
);
/*
print("HDR: ", 5);
print_u32_dec((uint32_t)hdr->rssi);
print(" ", 1);
print_u32_dec((uint32_t)hdr->lqi);
print(" ", 1);
print_u32_dec((uint32_t)hdr->crc_valid);
print("\n", 1);
*/
packet
=
(
eval_message_t
*
)
payload
->
data
;
if
(
hdr
->
crc_valid
&&
strcmp
(
packet
->
magic_string
,
MAGIC_STRING
)
==
0
)
{
...
...
@@ -96,29 +87,21 @@ static void _dump(gnrc_pktsnip_t *pkt) {
}
data
=
(
uint8_t
*
)
payload
->
data
;
/*
print("Contents(", 9);
print_u32_dec((uint32_t)len);
print("Contents)", 1);
*/
printf
(
"Contents(%02d):"
,
len
);
for
(
uint8_t
i
=
0
;
i
<
len
;
i
++
)
{
//print_byte_hex(data[i]);
printf
(
" %02X"
,
data
[
i
]);
}
//print(" | ", 3);
printf
(
" | "
);
for
(
uint8_t
i
=
0
;
i
<
len
;
i
++
)
{
if
(
data
[
i
]
>=
' '
&&
data
[
i
]
<=
'~'
)
{
printf
(
"%c"
,
data
[
i
]);
//print((char*)&data[i], 1);
}
else
{
printf
(
"."
);
//print(".", 1);
}
}
puts
(
""
);
}
break
;
default
:
printf
(
"snip of type %d
\n
"
,
snip
->
type
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment