This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit e1dbe8386fe756d041191c4c44117e2e7bc46533
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Wed Jun 4 18:42:07 2025 +0200

    drivers/ina219: Register command statically
    
    Now ina219 shell command is registered at link time to
    reduce memory footprint.
    No change in functionality.
    
    Signed-off-by: Jerzy Kasenberg <[email protected]>
---
 hw/drivers/sensors/ina219/include/ina219/ina219.h | 10 ----------
 hw/drivers/sensors/ina219/pkg.yml                 |  5 ++---
 hw/drivers/sensors/ina219/src/ina219_shell.c      | 20 ++------------------
 hw/drivers/sensors/ina219/syscfg.yml              |  3 ---
 4 files changed, 4 insertions(+), 34 deletions(-)

diff --git a/hw/drivers/sensors/ina219/include/ina219/ina219.h 
b/hw/drivers/sensors/ina219/include/ina219/ina219.h
index 94e131e4f..9cf11df20 100644
--- a/hw/drivers/sensors/ina219/include/ina219/ina219.h
+++ b/hw/drivers/sensors/ina219/include/ina219/ina219.h
@@ -228,16 +228,6 @@ int ina219_start_continuous_mode(struct ina219_dev 
*ina219, enum ina219_oper_mod
  */
 int ina219_stop_continuous_mode(struct ina219_dev *ina219);
 
-#if MYNEWT_VAL(INA219_CLI)
-/**
- * Initialize the INA219 shell extensions.
- *
- * @return 0 on success, non-zero on failure.
- */
-int ina219_shell_init(void);
-#endif
-
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/hw/drivers/sensors/ina219/pkg.yml 
b/hw/drivers/sensors/ina219/pkg.yml
index 17c62c174..9f05fbafc 100644
--- a/hw/drivers/sensors/ina219/pkg.yml
+++ b/hw/drivers/sensors/ina219/pkg.yml
@@ -33,8 +33,7 @@ pkg.deps:
 pkg.req_apis:
     - stats
 
+pkg.whole_archive: true
+
 pkg.deps.INA219_CLI:
     - "@apache-mynewt-core/util/parse"
-
-pkg.init.INA219_CLI:
-    ina219_shell_init: 'MYNEWT_VAL(INA219_CLI_SYSINIT_STAGE)'
diff --git a/hw/drivers/sensors/ina219/src/ina219_shell.c 
b/hw/drivers/sensors/ina219/src/ina219_shell.c
index e6ea4c2a6..cbac0ce49 100644
--- a/hw/drivers/sensors/ina219/src/ina219_shell.c
+++ b/hw/drivers/sensors/ina219/src/ina219_shell.c
@@ -30,13 +30,6 @@ static enum ina219_adc_mode smod = 
MYNEWT_VAL(INA219_DEFAULT_VSHUNT_ADC_MODE);
 static enum ina219_vbus_full_scale fs = 
MYNEWT_VAL(INA219_DEFAULT_VBUS_FULL_SACLE);
 static uint8_t soft_avg = 1;
 
-static int ina219_shell_cmd(int argc, char **argv);
-
-static struct shell_cmd ina219_shell_cmd_struct = {
-    .sc_cmd = "ina219",
-    .sc_cmd_func = ina219_shell_cmd
-};
-
 static int
 ina219_shell_err_too_many_args(char *cmd_name)
 {
@@ -64,7 +57,7 @@ ina219_shell_err_invalid_arg(char *cmd_name)
 static int
 ina219_shell_help(void)
 {
-    console_printf("%s cmd [flags...]\n", ina219_shell_cmd_struct.sc_cmd);
+    console_printf("ina219 cmd [flags...]\n");
     console_printf("cmd:\n");
     console_printf("\tr [n_samples]\n");
     console_printf("\tfs [0..1]\n");
@@ -238,15 +231,6 @@ ina219_shell_cmd(int argc, char **argv)
     return ina219_shell_err_unknown_arg(argv[1]);
 }
 
-int
-ina219_shell_init(void)
-{
-    int rc;
-
-    rc = shell_cmd_register(&ina219_shell_cmd_struct);
-    SYSINIT_PANIC_ASSERT(rc == 0);
-
-    return rc;
-}
+MAKE_SHELL_CMD(ina219, ina219_shell_cmd, NULL)
 
 #endif
diff --git a/hw/drivers/sensors/ina219/syscfg.yml 
b/hw/drivers/sensors/ina219/syscfg.yml
index 6436c0dde..88de51803 100644
--- a/hw/drivers/sensors/ina219/syscfg.yml
+++ b/hw/drivers/sensors/ina219/syscfg.yml
@@ -52,9 +52,6 @@ syscfg.defs:
     INA219_LOG_LVL:
         description: 'Minimum level for the INA219 log.'
         value: 1
-    INA219_CLI_SYSINIT_STAGE:
-        description: 'Sysinit stage for the INA219 shell'
-        value: 500
 syscfg.logs:
     INA219_LOG:
         module: MYNEWT_VAL(INA219_LOG_MODULE)

Reply via email to