]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blobdiff - commands/cmd.c
Merge branch 'eth'
[pes-rpp/rpp-test-sw.git] / commands / cmd.c
index a769d28af93acfa77c1a0f17b29fe474d1c0859e..5c6e16940c80f0217b4ef8b223ab34cbdf409360 100644 (file)
@@ -47,6 +47,7 @@
 #include "cmd_spi.h"
 #include "cmd_vbat.h"
 #include "cmd_motor_example.h"
+#include "cmd_fr_basic_test.h"
 
 #ifndef DOCGEN
 
@@ -74,6 +75,13 @@ int cmd_do_sleep(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
        return 0;
 }
 
+#include <version.h>
+
+int cmd_do_version(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
+       rpp_sci_printf("version=%s\n", GIT_VERSION);
+       return 0;
+}
+
 #endif /* DOCGEN */
 
 /** Root list in which commands are stored */
@@ -111,6 +119,27 @@ cmd_des_t const cmd_des_help={
     CMD_HANDLER(cmd_do_help), (void *)&cmd_list
 };
 
+cmd_des_t const cmd_des_version={
+    0, 0,
+    "version","Print version of the software",
+    "=== Syntax ===\n"
+    "\n"
+    " version\n"
+    "\n"
+    "=== Description ===\n"
+    "\n"
+    "This command prints the version of the test software. The version\n"
+    "number is the output of 'git describe' command, i.e. it is composed\n"
+    "from the last tag in the git repository, the number of commits since\n"
+    "the tag and the abbreviated commit hash.\n"
+    "\n"
+    "=== Example ===\n"
+    "\n"
+    "   --> version\n"
+    "   version=v0.2-109-ga81a9dd\n",
+    CMD_HANDLER(cmd_do_version),
+};
+
 /*  ------------------------
  *  Command lists definitons
  *  ------------------------
@@ -120,6 +149,7 @@ cmd_des_t const cmd_des_help={
 cmd_des_t const *cmd_list_main[]={
   &cmd_des_help,
   &cmd_des_sleep,
+  &cmd_des_version,
   CMD_DES_INCLUDE_SUBLIST(cmd_list_adc),
   CMD_DES_INCLUDE_SUBLIST(cmd_list_can),
   CMD_DES_INCLUDE_SUBLIST(cmd_list_dac),
@@ -138,6 +168,7 @@ cmd_des_t const *cmd_list_main[]={
   CMD_DES_INCLUDE_SUBLIST(cmd_list_spi),
   CMD_DES_INCLUDE_SUBLIST(cmd_list_vbat),
   CMD_DES_INCLUDE_SUBLIST(cmd_list_motor_example),
+  CMD_DES_INCLUDE_SUBLIST(cmd_list_fr_basic_test),
   NULL
 };