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 ;
Module test_ping : main.c ;
Module test_ping : main.c : shell shell_commands uart0 posix_io auto_init vtimer cc110x ;
UseModule test_ping ;

View File

@ -1,12 +1,26 @@
#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
const shell_command_t shell_commands[] = {
{"help", "Prints a list of commands", help},
{"init", "Initializes this node for a pingtest.", init},
{"ping", "Makes this node a pinging node", ping},
{"stop", "Stops the current node's ping-action and prints a summary", ping},
{NULL, NULL, NULL}
const shell_command_t shell_commands[] =
{ { "help", "Prints the help", help },
{ "init", "Initializes this node with an address and a channel.", init },
{ "ping", "Makes this node a pinging node", ping },
{ "stop", "Stops the current node's pings and prints a summary", stop },
{ NULL, NULL, NULL }
};
/**
@ -22,7 +36,13 @@ void init(char* arg) {
* Prints the shellcommands that are usable in this application for reference.
*/
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");
}
/**
@ -48,13 +68,15 @@ void stop(char* unused) {
* commands.
*/
int main(void) {
puts("Ping Test Application\n");
puts("For commands type 'help'!\n");
puts("Ping Test Application\n");
puts("For commands type 'help'!\n");
shell_t shell;
shell_init(&shell, shell_commands, uart0_readc, uart0_putc);
posix_open(uart0_handler_pid, 0);
shell_run(&shell);
shell_t shell;
shell_init(&shell, shell_commands, uart0_readc, uart0_putc);
return 0;
shell_run(&shell);
return 0;
}