Browse Source

tests: make use of uart0_[readc|putc]

dev/timer
Hauke Petersen 7 years ago
parent
commit
8cbfaa8da2
  1. 20
      tests/driver_at86rf2xx/main.c
  2. 20
      tests/driver_kw2xrf/main.c
  3. 17
      tests/driver_nrfmin/main.c
  4. 14
      tests/driver_pcd8544/main.c
  5. 14
      tests/periph_i2c/main.c
  6. 17
      tests/struct_tm_utility/main.c

20
tests/driver_at86rf2xx/main.c

@ -32,24 +32,6 @@
*/
#define SHELL_BUFSIZE (64U)
/**
* @brief Read chars from STDIO
*/
int shell_read(void)
{
char c = 0;
(void) posix_read(uart0_handler_pid, &c, 1);
return c;
}
/**
* @brief Write chars to STDIO
*/
void shell_put(int c)
{
putchar((char)c);
}
/**
* @brief Maybe you are a golfer?!
*/
@ -69,7 +51,7 @@ 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, shell_read, shell_put);
shell_init(&shell, NULL, SHELL_BUFSIZE, uart0_readc, uart0_putc);
shell_run(&shell);
return 0;

20
tests/driver_kw2xrf/main.c

@ -31,24 +31,6 @@
*/
#define SHELL_BUFSIZE (64U)
/**
* @brief Read chars from STDIO
*/
int shell_read(void)
{
char c = 0;
(void) posix_read(uart0_handler_pid, &c, 1);
return c;
}
/**
* @brief Write chars to STDIO
*/
void shell_put(int c)
{
putchar((char)c);
}
int main(void)
{
shell_t shell;
@ -65,7 +47,7 @@ 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, shell_read, shell_put);
shell_init(&shell, NULL, SHELL_BUFSIZE, uart0_readc, uart0_putc);
shell_run(&shell);
return 0;

17
tests/driver_nrfmin/main.c

@ -32,21 +32,6 @@
static char nomac_stack[THREAD_STACKSIZE_DEFAULT];
int shell_read(void)
{
char c;
int result = posix_read(uart0_handler_pid, &c, 1);
if (result != 1) {
return -1;
}
return (unsigned char) c;
}
void shell_put(int c)
{
putchar(c);
}
int main(void)
{
shell_t shell;
@ -68,7 +53,7 @@ int main(void)
/* initialize and run the shell */
board_uart0_init();
posix_open(uart0_handler_pid, 0);
shell_init(&shell, NULL, SHELL_BUFSIZE, shell_read, shell_put);
shell_init(&shell, NULL, SHELL_BUFSIZE, uart0_readc, uart0_putc);
shell_run(&shell);
return 0;

14
tests/driver_pcd8544/main.c

@ -156,18 +156,6 @@ static const shell_command_t shell_commands[] = {
{ NULL, NULL, NULL }
};
static int _getchar(void)
{
char c = 0;
(void) posix_read(uart0_handler_pid, &c, 1);
return c;
}
static void _putchar(int c)
{
putchar(c);
}
int main(void)
{
shell_t shell;
@ -183,7 +171,7 @@ 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, _getchar, _putchar);
shell_init(&shell, shell_commands, SHELL_BUFSIZE, uart0_readc, uart0_putc);
shell_run(&shell);
return 0;

14
tests/periph_i2c/main.c

@ -304,18 +304,6 @@ static const shell_command_t shell_commands[] = {
{ NULL, NULL, NULL }
};
static int shell_readc(void)
{
char c = 0;
(void) posix_read(uart0_handler_pid, &c, 1);
return c;
}
static void shell_putchar(int c)
{
(void) putchar(c);
}
int main(void)
{
shell_t shell;
@ -327,7 +315,7 @@ int main(void)
posix_open(uart0_handler_pid, 0);
/* define own shell commands */
shell_init(&shell, shell_commands, UART0_BUFSIZE, shell_readc, shell_putchar);
shell_init(&shell, shell_commands, UART0_BUFSIZE, uart0_readc, uart0_putc);
shell_run(&shell);
return 0;

17
tests/struct_tm_utility/main.c

@ -134,28 +134,13 @@ static const shell_command_t shell_commands[] = {
{ NULL, NULL, NULL }
};
static int shell_readc(void)
{
char c;
int result = posix_read(uart0_handler_pid, &c, 1);
if (result != 1) {
return -1;
}
return (unsigned char) c;
}
static void shell_putchar(int c)
{
putchar(c);
}
int main(void)
{
board_uart0_init();
posix_open(uart0_handler_pid, 0);
shell_t shell;
shell_init(&shell, shell_commands, SHELL_BUFSIZE, shell_readc, shell_putchar);
shell_init(&shell, shell_commands, SHELL_BUFSIZE, uart0_readc, uart0_putc);
puts("`struct tm` utility shell.");
shell_run(&shell);

Loading…
Cancel
Save