tests: added test application for enc28j60 driver
This commit is contained in:
parent
22cc26e9d7
commit
6cbdec8395
40
tests/driver_enc28j60/Makefile
Normal file
40
tests/driver_enc28j60/Makefile
Normal file
@ -0,0 +1,40 @@
|
||||
export APPLICATION = driver_enc28j60
|
||||
include ../Makefile.tests_common
|
||||
|
||||
FEATURES_REQUIRED = periph_spi periph_gpio
|
||||
|
||||
BOARD_INSUFFICIENT_MEMORY := msb-430h nucleo-f334 stm32f0discovery weio z1
|
||||
|
||||
USEMODULE += gnrc_netdev2
|
||||
USEMODULE += gnrc_netif_default
|
||||
USEMODULE += auto_init_gnrc_netif
|
||||
USEMODULE += enc28j60
|
||||
USEMODULE += gnrc_ipv6_router_default
|
||||
USEMODULE += gnrc_icmpv6_echo
|
||||
USEMODULE += shell
|
||||
USEMODULE += shell_commands
|
||||
USEMODULE += ps
|
||||
|
||||
# set board specific peripheral configurations
|
||||
ifneq (,$(filter stm32f4discovery,$(BOARD)))
|
||||
ENC_SPI ?= SPI_1
|
||||
ENC_CS ?= GPIO_PIN\(PORT_B,12\)
|
||||
ENC_INT ?= GPIO_PIN\(PORT_B,11\)
|
||||
ENC_RST ?= GPIO_PIN\(PORT_B,10\)
|
||||
endif
|
||||
|
||||
# fallback: set SPI bus and pins to default values
|
||||
ENC_SPI ?= SPI_0
|
||||
ENC_CS ?= GPIO_PIN\(0,0\)
|
||||
ENC_INT ?= GPIO_PIN\(0,1\)
|
||||
ENC_RST ?= GPIO_PIN\(0,2\)
|
||||
# export SPI and pins
|
||||
CFLAGS += -DENC28J60_PARAM_SPI=$(ENC_SPI)
|
||||
CFLAGS += -DENC28J60_PARAM_CS=$(ENC_CS)
|
||||
CFLAGS += -DENC28J60_PARAM_INT=$(ENC_INT)
|
||||
CFLAGS += -DENC28J60_PARAM_RESET=$(ENC_RST)
|
||||
|
||||
# make sure we read the local enc28j60 params file
|
||||
CFLAGS += -I$(CURDIR)
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
46
tests/driver_enc28j60/main.c
Normal file
46
tests/driver_enc28j60/main.c
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Freie Universität Berlin
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup tests
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Test application for the ENC28J60 Ethernet device driver
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "shell.h"
|
||||
#include "msg.h"
|
||||
|
||||
#define MAIN_QUEUE_SIZE (8U)
|
||||
static msg_t _main_msg_queue[MAIN_QUEUE_SIZE];
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* we need a message queue for the thread running the shell in order to
|
||||
* receive potentially fast incoming networking packets */
|
||||
msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE);
|
||||
puts("Test application for the enc28j60 driver\n");
|
||||
puts("This test just pulls in parts of the GNRC network stack, use the\n"
|
||||
"provided shell commands (i.e. ifconfig, ping6) to interact with\n"
|
||||
"your enc28j60 device.\n");
|
||||
|
||||
/* start shell */
|
||||
puts("Starting the shell now...");
|
||||
char line_buf[SHELL_DEFAULT_BUFSIZE];
|
||||
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);
|
||||
|
||||
/* should be never reached */
|
||||
return 0;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user