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:
parent
fe7f371595
commit
2f912f2b3f
@ -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 ;
|
||||||
|
@ -1,12 +1,26 @@
|
|||||||
#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");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -48,13 +68,15 @@ void stop(char* unused) {
|
|||||||
* commands.
|
* commands.
|
||||||
*/
|
*/
|
||||||
int main(void) {
|
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");
|
||||||
|
|
||||||
shell_t shell;
|
posix_open(uart0_handler_pid, 0);
|
||||||
shell_init(&shell, shell_commands, uart0_readc, uart0_putc);
|
|
||||||
|
|
||||||
shell_run(&shell);
|
shell_t shell;
|
||||||
|
shell_init(&shell, shell_commands, uart0_readc, uart0_putc);
|
||||||
|
|
||||||
return 0;
|
shell_run(&shell);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user