-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #350 from luisan00/feature/shell_extended
shell extended tool: extends shell funct. to our custom modules
- Loading branch information
Showing
15 changed files
with
272 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
APPLICATION ?= shell_extended | ||
|
||
include ../Makefile.common | ||
|
||
# Include the shell extended module, shell and shell commands modules | ||
# will be implicitly included. | ||
USEMODULE += shell_extended | ||
# Include desired modules where shell extended is enabled. | ||
USEMODULE += uniqueid | ||
|
||
include $(RIOTBASE)/Makefile.include |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright (C) 2022 Mesh4all <mesh4all.org> | ||
* | ||
* 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. | ||
*/ | ||
|
||
/** | ||
* @defgroup examples_shell_extended Application example for the shell extended module | ||
* @ingroup examples | ||
* @author Luis A. Ruiz <[email protected]> | ||
* @author Eduardo Azócar <[email protected]> | ||
* | ||
* ## How does it works? | ||
* | ||
* **ToDo** | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (c) 2022 Mesh4all <mesh4all.org> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
/** | ||
* @ingroup examples_shell_extended | ||
* @brief shows some uses of **shell-extended** module | ||
* @author Luis A. Ruiz <[email protected]> | ||
* @author Eduardo Azócar <[email protected]> | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include "shell.h" | ||
#include "msg.h" | ||
#include "shell_extended.h" | ||
|
||
#define MAIN_QUEUE_SIZE (8) | ||
msg_t _main_msg_queue[MAIN_QUEUE_SIZE]; | ||
|
||
int main(void) { | ||
puts("Shell extended example\n"); | ||
|
||
msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE); | ||
|
||
/* start the shell */ | ||
char line_buf[SHELL_DEFAULT_BUFSIZE]; | ||
shell_run(shell_extended_commands, line_buf, SHELL_DEFAULT_BUFSIZE); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
ifneq (,$(filter shell_extended,$(USEMODULE))) | ||
USEMODULE += shell | ||
USEMODULE += shell_commands | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
MODULE = shell_extended | ||
|
||
SRC += shell_extended.c | ||
|
||
ifneq (,$(filter uniqueid,$(USEMODULE))) | ||
SRC += se_uniqueid.c | ||
endif | ||
|
||
include $(RIOTBASE)/Makefile.base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
USEMODULE += shell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
USEMODULE_INCLUDES_shell_extended := $(LAST_MAKEFILEDIR)/include | ||
USEMODULE_INCLUDES += $(USEMODULE_INCLUDES_shell_extended) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* @defgroup sys_shell_extended Extends shell functionality | ||
* @ingroup sys | ||
* | ||
* ## Shell extended | ||
* ToDo | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (c) 2022 Mesh4all <mesh4all.org> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* @ingroup sys_shell_extended | ||
* @{ | ||
* @file | ||
* @brief Extends shell functionality | ||
* @author Luis A. Ruiz <[email protected]> | ||
* @author Eduardo Azócar <[email protected]> | ||
* | ||
*/ | ||
#ifndef SHELL_EXTENDED_H | ||
#define SHELL_EXTENDED_H | ||
|
||
#include "shell.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#endif | ||
|
||
/** | ||
* @brief Shell extended command array | ||
*/ | ||
extern const shell_command_t shell_extended_commands[]; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
#endif /* SHELL_EXTENDED_H */ | ||
/** @} */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (c) 2022 Mesh4all <mesh4all.org> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
/** | ||
* @brief Extends the shell functionality for uniqueid | ||
* @author Luis A. Ruiz <[email protected]> | ||
* @author Eduardo Azócar <[email protected]> | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <string.h> | ||
#include "uniqueid.h" | ||
|
||
void uid_usage(void) { | ||
puts("Uniqueid Tool"); | ||
puts("Usage: uid [static|rand]"); | ||
puts(""); | ||
} | ||
|
||
int uid_cmd(int argc, char **argv) { | ||
(void)argc; | ||
(void)argv; | ||
|
||
if ((argc < 2) || (argc > 2) || (strcmp(argv[1], "help") == 0)) { | ||
uid_usage(); | ||
return 0; | ||
} | ||
|
||
if (strcmp(argv[1], "static") == 0) { | ||
puts("ToDo: return static id (cpu-based)"); | ||
} else if (strcmp(argv[1], "random") == 0) { | ||
puts("Todo: return random id"); | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) 2022 Mesh4all <mesh4all.org> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
/** | ||
* @brief Extends functionality on the shell for uniqueid | ||
* @author Luis A. Ruiz <[email protected]> | ||
* @author Eduardo Azócar <[email protected]> | ||
*/ | ||
|
||
#include "shell_extended.h" | ||
#include "kernel_defines.h" | ||
|
||
#if IS_USED(MODULE_UNIQUEID) | ||
int uid_cmd(int argc, char **argv); | ||
#endif | ||
|
||
const shell_command_t shell_extended_commands[] = { | ||
#if IS_USED(MODULE_UNIQUEID) | ||
{"uid", "uniqueid commands", uid_cmd}, | ||
#endif | ||
{NULL, NULL, NULL}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
include ../Makefile.tests_common | ||
|
||
USEMODULE += embunit | ||
USEMODULE += shell_extended | ||
|
||
include $(RIOTBASE)/Makefile.include |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
@defgroup tests_shell_extended Shell-Extended unit tests | ||
@ingroup tests | ||
@{ | ||
|
||
## Shell Extended Tests. | ||
|
||
@} | ||
|
||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (c) 2022 Mesh4all <mesh4all.org> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* @brief | ||
* | ||
* @author Luis A. Ruiz <[email protected]> | ||
* @author Eduardo Azócar <[email protected]> | ||
* | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright (C) 2017 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. | ||
|
||
import sys | ||
from testrunner import run_check_unittests | ||
|
||
if __name__ == "__main__": | ||
sys.exit(run_check_unittests()) |