1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

basic function layout added

This commit is contained in:
Stephan Arndt 2012-12-04 17:17:50 +01:00
parent fe7f371595
commit 2f912f2b3f
2 changed files with 36 additions and 14 deletions

View File

@ -1,5 +1,5 @@
SubDir TOP projects test_ping ; SubDir TOP projects test_ping ;
Module test_ping : main.c ; Module test_ping : main.c : shell shell_commands uart0 posix_io auto_init vtimer cc110x ;
UseModule test_ping ; UseModule test_ping ;

View File

@ -1,11 +1,25 @@
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <vtimer.h>
#include <thread.h>
#include <posix_io.h>
#include <shell.h>
#include <shell_commands.h>
#include <board_uart0.h>
// Prototypes
void help(char * arg);
void init(char * arg);
void ping(char * arg);
void stop(char * arg);
// Shell commands for this application // Shell commands for this application
const shell_command_t shell_commands[] = { const shell_command_t shell_commands[] =
{"help", "Prints a list of commands", help}, { { "help", "Prints the help", help },
{"init", "Initializes this node for a pingtest.", init}, { "init", "Initializes this node with an address and a channel.", init },
{ "ping", "Makes this node a pinging node", ping }, { "ping", "Makes this node a pinging node", ping },
{"stop", "Stops the current node's ping-action and prints a summary", ping}, { "stop", "Stops the current node's pings and prints a summary", stop },
{ NULL, NULL, NULL } { NULL, NULL, NULL }
}; };
@ -22,7 +36,13 @@ void init(char* arg) {
* Prints the shellcommands that are usable in this application for reference. * Prints the shellcommands that are usable in this application for reference.
*/ */
void help(char* unused) { void help(char* unused) {
//TODO implement printf("These are the usable commands:\n");
printf("\thelp (commandname)\n");
printf("\tinit [address] (channel)\n");
printf("\tping [address] (time)\n");
printf("\tstop\n");
printf("\n");
printf("[] = mandatory, () = optional");
} }
/** /**
@ -51,6 +71,8 @@ int main(void) {
puts("Ping Test Application\n"); puts("Ping Test Application\n");
puts("For commands type 'help'!\n"); puts("For commands type 'help'!\n");
posix_open(uart0_handler_pid, 0);
shell_t shell; shell_t shell;
shell_init(&shell, shell_commands, uart0_readc, uart0_putc); shell_init(&shell, shell_commands, uart0_readc, uart0_putc);