Skip to content

Commit

Permalink
tests, examples: adapt to simplified shell
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspar030 committed Sep 3, 2015
1 parent 13995e8 commit 25f900e
Show file tree
Hide file tree
Showing 27 changed files with 49 additions and 178 deletions.
1 change: 0 additions & 1 deletion examples/default/Makefile
Expand Up @@ -29,7 +29,6 @@ QUIET ?= 1

# Modules to include:

USEMODULE += uart0
USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += ps
Expand Down
9 changes: 2 additions & 7 deletions examples/default/main.c
Expand Up @@ -26,10 +26,8 @@
#include <string.h>

#include "thread.h"
#include "posix_io.h"
#include "shell.h"
#include "shell_commands.h"
#include "board_uart0.h"

#if FEATURE_PERIPH_RTC
#include "periph/rtc.h"
Expand All @@ -41,9 +39,6 @@

int main(void)
{
shell_t shell;
(void) posix_open(uart0_handler_pid, 0);

#ifdef MODULE_LTC4150
ltc4150_start();
#endif
Expand All @@ -54,8 +49,8 @@ int main(void)

(void) puts("Welcome to RIOT!");

shell_init(&shell, NULL, UART0_BUFSIZE, uart0_readc, uart0_putc);
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);

shell_run(&shell);
return 0;
}
3 changes: 1 addition & 2 deletions examples/gnrc_networking/Makefile
Expand Up @@ -28,8 +28,7 @@ USEMODULE += gnrc_rpl
USEMODULE += gnrc_pktdump
# Additional networking modules that can be dropped if not needed
USEMODULE += gnrc_icmpv6_echo
# Add also the shell, some shell commands (which are based on uart0 in this app)
USEMODULE += uart0
# Add also the shell, some shell commands
USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += ps
Expand Down
9 changes: 2 additions & 7 deletions examples/gnrc_networking/main.c
Expand Up @@ -21,8 +21,6 @@
#include <stdio.h>

#include "shell.h"
#include "board_uart0.h"
#include "posix_io.h"

extern int udp_cmd(int argc, char **argv);

Expand All @@ -33,15 +31,12 @@ static const shell_command_t shell_commands[] = {

int main(void)
{
shell_t shell;

puts("RIOT network stack example application");

/* start shell */
puts("All up, running the shell now");
posix_open(uart0_handler_pid, 0);
shell_init(&shell, shell_commands, UART0_BUFSIZE, uart0_readc, uart0_putc);
shell_run(&shell);
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);

/* should be never reached */
return 0;
Expand Down
1 change: 0 additions & 1 deletion tests/driver_at86rf2xx/Makefile
Expand Up @@ -65,7 +65,6 @@ USEMODULE += auto_init_gnrc_netif
USEMODULE += gnrc_netif
USEMODULE += gnrc_nomac
USEMODULE += gnrc_pktdump
USEMODULE += uart0
USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += ps
Expand Down
14 changes: 3 additions & 11 deletions tests/driver_at86rf2xx/main.c
Expand Up @@ -22,22 +22,14 @@

#include "shell.h"
#include "shell_commands.h"
#include "posix_io.h"
#include "board_uart0.h"
#include "net/gnrc/pktdump.h"
#include "net/gnrc.h"

/**
* @brief Buffer size used by the shell
*/
#define SHELL_BUFSIZE (64U)

/**
* @brief Maybe you are a golfer?!
*/
int main(void)
{
shell_t shell;
gnrc_netreg_entry_t dump;

puts("AT86RF2xx device driver test");
Expand All @@ -50,9 +42,9 @@ int main(void)

/* start the shell */
puts("Initialization successful - starting the shell now");
(void) posix_open(uart0_handler_pid, 0);
shell_init(&shell, NULL, SHELL_BUFSIZE, uart0_readc, uart0_putc);
shell_run(&shell);

char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);

return 0;
}
1 change: 0 additions & 1 deletion tests/driver_kw2xrf/Makefile
Expand Up @@ -54,7 +54,6 @@ USEMODULE += auto_init_gnrc_netif
USEMODULE += gnrc_netif
USEMODULE += gnrc_nomac
USEMODULE += gnrc_pktdump
USEMODULE += uart0
USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += ps
Expand Down
14 changes: 3 additions & 11 deletions tests/driver_kw2xrf/main.c
Expand Up @@ -21,19 +21,11 @@

#include "shell.h"
#include "shell_commands.h"
#include "posix_io.h"
#include "board_uart0.h"
#include "net/gnrc.h"
#include "net/gnrc/pktdump.h"

/**
* @brief Buffer size used by the shell
*/
#define SHELL_BUFSIZE (64U)

int main(void)
{
shell_t shell;
gnrc_netreg_entry_t dump;

puts("KW2XRF device driver test");
Expand All @@ -46,9 +38,9 @@ int main(void)

/* start the shell */
puts("Initialization successful - starting the shell now");
(void) posix_open(uart0_handler_pid, 0);
shell_init(&shell, NULL, SHELL_BUFSIZE, uart0_readc, uart0_putc);
shell_run(&shell);

char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);

return 0;
}
10 changes: 2 additions & 8 deletions tests/driver_netdev_eth/main.c
Expand Up @@ -33,17 +33,11 @@
#include "net/dev_eth.h"
#include "dev_eth_tap.h"

/**
* @brief Buffer size used by the shell
*/
#define SHELL_BUFSIZE (64U)

/**
* @brief Maybe you are a golfer?!
*/
int main(void)
{
shell_t shell;
gnrc_netreg_entry_t dump;

puts("netdev ethernet device driver test");
Expand All @@ -60,8 +54,8 @@ int main(void)
gnrc_netreg_register(GNRC_NETTYPE_UNDEF, &dump);

/* start the shell */
shell_init(&shell, NULL, SHELL_BUFSIZE, getchar, putchar);
shell_run(&shell);
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);

return 0;
}
10 changes: 2 additions & 8 deletions tests/driver_nrf24l01p_lowlevel/main.c
Expand Up @@ -51,8 +51,6 @@

#define TEST_RX_MSG 1

#define SHELL_BUFFER_SIZE 128

static int cmd_send(int argc, char **argv);
static int cmd_print_regs(int argc, char **argv);
static int cmd_its(int argc, char **argv);
Expand Down Expand Up @@ -325,14 +323,10 @@ int cmd_print_regs(int argc, char **argv)

int main(void)
{
shell_t shell;

puts("Welcome to RIOT!");

puts("Initializing shell...");
shell_init(&shell, shell_commands, SHELL_BUFFER_SIZE, getchar, putchar);

puts("Starting shell...");
shell_run(&shell);
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);
return 0;
}
1 change: 0 additions & 1 deletion tests/driver_nrfmin/Makefile
Expand Up @@ -6,7 +6,6 @@ FEATURES_REQUIRED = radio_nrfmin
USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += ps
USEMODULE += uart0
USEMODULE += radio_nrfmin
USEMODULE += gnrc
USEMODULE += gnrc_nomac
Expand Down
11 changes: 2 additions & 9 deletions tests/driver_nrfmin/main.c
Expand Up @@ -21,20 +21,15 @@
#include <stdio.h>

#include "shell.h"
#include "posix_io.h"
#include "board_uart0.h"
#include "nrfmin.h"
#include "net/gnrc.h"
#include "net/gnrc/nomac.h"
#include "net/gnrc/pktdump.h"

#define SHELL_BUFSIZE (UART0_BUFSIZE)

static char nomac_stack[THREAD_STACKSIZE_DEFAULT];

int main(void)
{
shell_t shell;
gnrc_netdev_t dev;
gnrc_netreg_entry_t netobj;

Expand All @@ -51,10 +46,8 @@ int main(void)
gnrc_netreg_register(GNRC_NETTYPE_UNDEF, &netobj);

/* initialize and run the shell */
board_uart0_init();
posix_open(uart0_handler_pid, 0);
shell_init(&shell, NULL, SHELL_BUFSIZE, uart0_readc, uart0_putc);
shell_run(&shell);
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);

return 0;
}
1 change: 0 additions & 1 deletion tests/driver_pcd8544/Makefile
Expand Up @@ -3,7 +3,6 @@ include ../Makefile.tests_common

FEATURES_REQUIRED = periph_gpio periph_spi

USEMODULE += uart0
USEMODULE += shell
USEMODULE += pcd8544

Expand Down
12 changes: 3 additions & 9 deletions tests/driver_pcd8544/main.c
Expand Up @@ -35,13 +35,9 @@
#include <string.h>
#include <stdlib.h>

#include "posix_io.h"
#include "board_uart0.h"
#include "shell.h"
#include "pcd8544.h"

#define SHELL_BUFSIZE (64U)

static pcd8544_t dev;

static int _contrast(int argc, char **argv)
Expand Down Expand Up @@ -158,8 +154,6 @@ static const shell_command_t shell_commands[] = {

int main(void)
{
shell_t shell;

puts("PCD8544 LCD display test application\n");
printf("Initializing PCD8544 LCD at SPI_%i... ", TEST_PCD8544_SPI);
if (pcd8544_init(&dev, TEST_PCD8544_SPI, TEST_PCD8544_CS,
Expand All @@ -170,9 +164,9 @@ int main(void)

/* run shell */
puts("All OK, running shell now");
(void) posix_open(uart0_handler_pid, 0);
shell_init(&shell, shell_commands, SHELL_BUFSIZE, uart0_readc, uart0_putc);
shell_run(&shell);

char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);

return 0;
}
11 changes: 3 additions & 8 deletions tests/driver_xbee/main.c
Expand Up @@ -25,17 +25,11 @@
#include "net/gnrc.h"
#include "net/gnrc/pktdump.h"

/**
* @brief Buffer size used by the shell
*/
#define SHELL_BUFSIZE (64U)

/**
* @brief Maybe you are a golfer?!
*/
int main(void)
{
shell_t shell;
gnrc_netreg_entry_t dump;

puts("Xbee S1 device driver test");
Expand All @@ -51,8 +45,9 @@ int main(void)

/* start the shell */
puts("Initialization OK, starting shell now");
shell_init(&shell, NULL, SHELL_BUFSIZE, getchar, putchar);
shell_run(&shell);

char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);

return 0;
}
1 change: 0 additions & 1 deletion tests/periph_gpio/Makefile
Expand Up @@ -3,7 +3,6 @@ include ../Makefile.tests_common

FEATURES_REQUIRED = periph_gpio

USEMODULE += uart0
USEMODULE += shell

include $(RIOTBASE)/Makefile.include
11 changes: 2 additions & 9 deletions tests/periph_gpio/main.c
Expand Up @@ -22,13 +22,9 @@
#include <stdlib.h>

#include "shell.h"
#include "posix_io.h"
#include "board_uart0.h"
#include "periph/gpio.h"
#include "hwtimer.h"

#define SHELL_BUFSIZE (64U)

static void cb(void *arg)
{
printf("INT: external interrupt from pin %i\n", (int)arg);
Expand Down Expand Up @@ -237,8 +233,6 @@ static const shell_command_t shell_commands[] = {

int main(void)
{
shell_t shell;

puts("GPIO peripheral driver test\n");
puts("In this test, pins are specified by integer port and pin numbers.\n"
"So if your platform has a pin PA01, it will be port=0 and pin=1,\n"
Expand All @@ -247,9 +241,8 @@ int main(void)
" behavior for not existing ports/pins is not defined!");

/* start the shell */
(void) posix_open(uart0_handler_pid, 0);
shell_init(&shell, shell_commands, SHELL_BUFSIZE, uart0_readc, uart0_putc);
shell_run(&shell);
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);

return 0;
}
1 change: 0 additions & 1 deletion tests/periph_i2c/Makefile
Expand Up @@ -4,6 +4,5 @@ include ../Makefile.tests_common
FEATURES_REQUIRED = periph_i2c

USEMODULE += shell
USEMODULE += uart0

include $(RIOTBASE)/Makefile.include

0 comments on commit 25f900e

Please sign in to comment.