Skip to content
Snippets Groups Projects
Unverified Commit d692b1de authored by Alexandre Abadie's avatar Alexandre Abadie Committed by GitHub
Browse files

Merge pull request #8327 from daniel-k/fix/tests_sx127x_channel

tests/sx127x: adapt to driver interface change
parents e888e47a f95463a8
No related branches found
No related tags found
No related merge requests found
...@@ -104,11 +104,11 @@ int lora_setup_cmd(int argc, char **argv) { ...@@ -104,11 +104,11 @@ int lora_setup_cmd(int argc, char **argv) {
/* Configure radio device */ /* Configure radio device */
netdev_t *netdev = (netdev_t*) &sx127x; netdev_t *netdev = (netdev_t*) &sx127x;
netdev->driver->set(netdev, NETOPT_BANDWIDTH, netdev->driver->set(netdev, NETOPT_BANDWIDTH,
&lora_bw, sizeof(uint8_t)); &lora_bw, sizeof(lora_bw));
netdev->driver->set(netdev, NETOPT_SPREADING_FACTOR, netdev->driver->set(netdev, NETOPT_SPREADING_FACTOR,
&lora_sf, 1); &lora_sf, lora_sf);
netdev->driver->set(netdev, NETOPT_CODING_RATE, netdev->driver->set(netdev, NETOPT_CODING_RATE,
&lora_cr, sizeof(uint8_t)); &lora_cr, sizeof(lora_cr));
puts("[Info] setup: configuration set with success"); puts("[Info] setup: configuration set with success");
...@@ -240,12 +240,14 @@ int listen_cmd(int argc, char **argv) ...@@ -240,12 +240,14 @@ int listen_cmd(int argc, char **argv)
(void)argv; (void)argv;
/* Switch to continuous listen mode */ /* Switch to continuous listen mode */
netdev->driver->set(netdev, NETOPT_SINGLE_RECEIVE, false, sizeof(uint8_t)); const netopt_enable_t single = false;
netdev->driver->set(netdev, NETOPT_RX_TIMEOUT, 0, sizeof(uint8_t)); netdev->driver->set(netdev, NETOPT_SINGLE_RECEIVE, &single, sizeof(single));
const uint32_t timeout = 0;
netdev->driver->set(netdev, NETOPT_RX_TIMEOUT, &timeout, sizeof(timeout));
/* Switch to RX state */ /* Switch to RX state */
uint8_t state = NETOPT_STATE_RX; uint8_t state = NETOPT_STATE_RX;
netdev->driver->set(netdev, NETOPT_STATE, &state, sizeof(uint8_t)); netdev->driver->set(netdev, NETOPT_STATE, &state, sizeof(state));
printf("Listen mode set\n"); printf("Listen mode set\n");
...@@ -261,7 +263,7 @@ int channel_cmd(int argc, char **argv) ...@@ -261,7 +263,7 @@ int channel_cmd(int argc, char **argv)
uint32_t chan; uint32_t chan;
if (strstr(argv[1], "get") != NULL) { if (strstr(argv[1], "get") != NULL) {
netdev->driver->get(netdev, NETOPT_CHANNEL, &chan, sizeof(uint32_t)); netdev->driver->get(netdev, NETOPT_CHANNEL_FREQUENCY, &chan, sizeof(chan));
printf("Channel: %i\n", (int) chan); printf("Channel: %i\n", (int) chan);
return 0; return 0;
} }
...@@ -272,7 +274,7 @@ int channel_cmd(int argc, char **argv) ...@@ -272,7 +274,7 @@ int channel_cmd(int argc, char **argv)
return -1; return -1;
} }
chan = atoi(argv[2]); chan = atoi(argv[2]);
netdev->driver->set(netdev, NETOPT_CHANNEL, &chan, sizeof(uint32_t)); netdev->driver->set(netdev, NETOPT_CHANNEL_FREQUENCY, &chan, sizeof(chan));
printf("New channel set\n"); printf("New channel set\n");
} }
else { else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment