Skip to content

Commit

Permalink
sys/shell/commands: add interactive_sync commands
Browse files Browse the repository at this point in the history
  • Loading branch information
fjmolinas committed Oct 15, 2019
1 parent e5b1cd7 commit 28948d6
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 0 deletions.
12 changes: 12 additions & 0 deletions sys/auto_init/auto_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@
#include "schedstatistics.h"
#endif

#ifdef MODULE_TEST_UTILS_INTERACTIVE_SYNC
#ifndef MODULE_SHELL_COMMANDS
#include "test_utils/interactive_sync.h"
#endif
#endif

#define ENABLE_DEBUG (0)
#include "debug.h"

Expand Down Expand Up @@ -585,4 +591,10 @@ void auto_init(void)
extern void suit_init_conditions(void);
suit_init_conditions();
#endif /* MODULE_SUIT */

#ifdef MODULE_TEST_UTILS_INTERACTIVE_SYNC
#ifndef MODULE_SHELL_COMMANDS
test_utils_interactive_sync();
#endif
#endif /* MODULE_TEST_UTILS_INTERACTIVE_SYNC */
}
4 changes: 4 additions & 0 deletions sys/shell/commands/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,8 @@ ifneq (,$(filter nimble_netif,$(USEMODULE)))
SRC += sc_nimble_netif.c
endif

ifneq (,$(filter test_utils_interactive_sync,$(USEMODULE)))
SRC += sc_interactive_sync.c
endif

include $(RIOTBASE)/Makefile.base
40 changes: 40 additions & 0 deletions sys/shell/commands/sc_interactive_sync.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (C) 2019 Inria
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/

/**
* @ingroup sys_shell_commands
* @{
*
* @file
* @brief Shell commands interactive sync util
*
* @author Francisco Molina <[email protected]>
* @}
*/

#include <stdio.h>
#include "periph/pm.h"
#include "test_utils/interactive_sync.h"

int _s(int argc, char **argv)
{
(void) argc;
(void) argv;
puts("START");

return 0;
}


int _r(int argc, char **argv)
{
(void) argc;
(void) argv;
puts("READY");
return 0;
}
9 changes: 9 additions & 0 deletions sys/shell/commands/shell_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ extern int _loramac_handler(int argc, char **argv);
extern int _nimble_netif_handler(int argc, char **argv);
#endif

#ifdef MODULE_TEST_UTILS_INTERACTIVE_SYNC
extern int _s(int argc, char **argv);
extern int _r(int argc, char **argv);
#endif

const shell_command_t _shell_command_list[] = {
{"reboot", "Reboot the node", _reboot_handler},
#ifdef MODULE_CONFIG
Expand Down Expand Up @@ -267,6 +272,10 @@ const shell_command_t _shell_command_list[] = {
#endif
#ifdef MODULE_NIMBLE_NETIF
{ "ble", "Manage BLE connections for NimBLE", _nimble_netif_handler },
#endif
#ifdef MODULE_TEST_UTILS_INTERACTIVE_SYNC
{ "r", "Test sync, Ready query", _r },
{ "s", "Test sync, Start test tiger", _s },
#endif
{NULL, NULL, NULL}
};
19 changes: 19 additions & 0 deletions sys/test_utils/interactive_sync/interactive_sync.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
* Copyright (C) 2019 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/

/**
* @ingroup sys
* @{
*
* @file
* @brief Interactive Sync implementation
*
*
* @author Gaëtan Harter <[email protected]>
*/

#include <stdio.h>
#include "test_utils/interactive_sync.h"

Expand Down

0 comments on commit 28948d6

Please sign in to comment.