Skip to content

Commit

Permalink
drivers/kw2xrf: reduce scope of test application
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterKietzmann authored and smlng committed Feb 7, 2017
1 parent a4e9640 commit 47f3b24
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 48 deletions.
37 changes: 1 addition & 36 deletions tests/driver_kw2xrf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,14 @@ include ../Makefile.tests_common
FEATURES_REQUIRED = periph_spi periph_gpio

BOARD_INSUFFICIENT_MEMORY := stm32f0discovery nucleo-f334 weio
# msba2 fails with linker error in cc110x

USEMODULE += auto_init_gnrc_netif
USEMODULE += gnrc_netif
USEMODULE += gnrc_txtsnd
USEMODULE += gnrc_nomac
USEMODULE += gnrc_netdev_default
USEMODULE += gnrc_pktdump
USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += ps

# define parameters for selected boards
ifneq (,$(filter pba-d-01-kw2x,$(BOARD)))
DRIVER := kw2xrf
USE_BOARD_PARAMETERS := true
endif

# only set specific parameters if not using board configuration
ifneq (true,$(USE_BOARD_PARAMETERS))

# set default device parameters in case they are undefined
DRIVER ?= kw2xrf
KW2XRF_SHARED_SPI ?= 1
KWRF_SPI ?= SPI_DEV\(0\)
KWRF_SPI_SPEED ?= SPI_CLK_5MHZ
KWRF_CS ?= GPIO_PIN\(0,0\)
KWRF_INT ?= GPIO_PIN\(0,1\)

# export parameters
CFLAGS += -DKW2XRF_SHARED_SPI=$(KW2XRF_SHARED_SPI)
CFLAGS += -DKWRF_SPI=$(KWRF_SPI)
CFLAGS += -DKWRF_SPI_SPEED=$(KWRF_SPI_SPEED)
CFLAGS += -DKWRF_CS=$(KWRF_CS)
CFLAGS += -DKWRF_INT=$(KWRF_INT)

# This adds . to include path so generic kw2xrf_params.h gets picked
# up. All boards actually having such a device on board should define
# USE_BOARD_PARAMETERS=true above to skip this step, as the board provides
# this header.
CFLAGS += -I$(CURDIR)

endif
DRIVER ?= kw2xrf

# finally include the actual chosen driver
USEMODULE += $(DRIVER)
Expand Down
8 changes: 3 additions & 5 deletions tests/driver_kw2xrf/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# About
This is a manual test application for testing the KW2xrf network device driver.
This is a manual test application for testing the KW2XRF device driver. It enables several shell commands, allowing for special test modes of that device. Without deeper knowledge about the hardware, this application might be useless except for compile tests. If you want an example to use this radio, check the [examples](../../examples) folder.

For running this test, you need to connect/configure the following pins of your
radio device:
radio device. If you are running on a phyNODE, this is already the on-board default.

- SPI DEV
- CS (chip select)
- INT (external interrupt)

# Usage
For testing the radio driver you can use the netif and txtsnd shell commands
that are included in this application.
9 changes: 2 additions & 7 deletions tests/driver_kw2xrf/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@
#include "kw2xrf.h"
#include "shell_commands.h"
#include "net/gnrc.h"
#include "net/gnrc/pktdump.h"
#include "net/gnrc/netif.h"
#include "net/gnrc/netapi.h"
#include "net/netopt.h"

#define KW2XRF_TESTMODE (1)

#ifdef KW2XRF_TESTMODE
#include "kw2xrf_tm.h"

Expand Down Expand Up @@ -159,15 +160,9 @@ static const shell_command_t shell_commands[] = {

int main(void)
{
gnrc_netreg_entry_t dump = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
gnrc_pktdump_pid);

puts("KW2XRF device driver test");

/* register the pktdump thread */
puts("Register the packet dump thread for GNRC_NETTYPE_UNDEF packets");
gnrc_netreg_register(GNRC_NETTYPE_UNDEF, &dump);

/* start the shell */
puts("Initialization successful - starting the shell now");

Expand Down

0 comments on commit 47f3b24

Please sign in to comment.