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 bfe1f8529dd7d222d5ac5d40fc20ee22ba54d9f9 Author: Jerzy Kasenberg <[email protected]> AuthorDate: Fri Jun 6 20:57:05 2025 +0200 drivers/adxl345: Register command statically Now adxl345 shell command is registered at link time to reduce memory footprint. Command was register before by function adxl345_shell_init() Now command is added when syscfg value ADXL345_CLI is 1 Signed-off-by: Jerzy Kasenberg <[email protected]> --- hw/drivers/sensors/adxl345/include/adxl345/adxl345.h | 4 ---- hw/drivers/sensors/adxl345/pkg.yml | 8 ++++++++ hw/drivers/sensors/adxl345/src/adxl345_shell.c | 20 ++------------------ 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/hw/drivers/sensors/adxl345/include/adxl345/adxl345.h b/hw/drivers/sensors/adxl345/include/adxl345/adxl345.h index d40a2ab15..a58e94dd9 100644 --- a/hw/drivers/sensors/adxl345/include/adxl345/adxl345.h +++ b/hw/drivers/sensors/adxl345/include/adxl345/adxl345.h @@ -193,10 +193,6 @@ int adxl345_config(struct adxl345 *, struct adxl345_cfg *); int adxl345_get_accel_data(struct sensor_itf *itf, struct sensor_accel_data *sad); -#if MYNEWT_VAL(ADXL345_CLI) -int adxl345_shell_init(void); -#endif - #if MYNEWT_VAL(BUS_DRIVER_PRESENT) int adxl345_create_i2c_sensor_dev(struct bus_i2c_node *node, const char *name, const struct bus_i2c_node_cfg *i2c_cfg, diff --git a/hw/drivers/sensors/adxl345/pkg.yml b/hw/drivers/sensors/adxl345/pkg.yml index bdbc83643..cf3776926 100644 --- a/hw/drivers/sensors/adxl345/pkg.yml +++ b/hw/drivers/sensors/adxl345/pkg.yml @@ -37,5 +37,13 @@ pkg.deps: pkg.req_apis: - stats +pkg.whole_archive: true + +pkg.srouce_files: + - src/ds1307.c + +pkg.srouce_files.ADXL345_CLI: + - src/ds1307_shell.c + pkg.deps.ADXL345_CLI: - "@apache-mynewt-core/util/parse" diff --git a/hw/drivers/sensors/adxl345/src/adxl345_shell.c b/hw/drivers/sensors/adxl345/src/adxl345_shell.c index 2e7edbb29..ab803304e 100644 --- a/hw/drivers/sensors/adxl345/src/adxl345_shell.c +++ b/hw/drivers/sensors/adxl345/src/adxl345_shell.c @@ -29,13 +29,6 @@ #if MYNEWT_VAL(ADXL345_CLI) -static int adxl345_shell_cmd(int argc, char **argv); - -static struct shell_cmd adxl345_shell_cmd_struct = { - .sc_cmd = "adxl345", - .sc_cmd_func = adxl345_shell_cmd -}; - static struct sensor_itf g_sensor_itf = { .si_type = MYNEWT_VAL(ADXL345_SHELL_ITF_TYPE), .si_num = MYNEWT_VAL(ADXL345_SHELL_ITF_NUM), @@ -70,7 +63,7 @@ adxl345_shell_err_invalid_arg(char *cmd_name) static int adxl345_shell_help(void) { - console_printf("%s cmd [flags...]\n", adxl345_shell_cmd_struct.sc_cmd); + console_printf("adxl345 cmd [flags...]\n"); console_printf("cmd:\n"); console_printf("\tr [n_samples]\n"); console_printf("\tchipid\n"); @@ -249,15 +242,6 @@ adxl345_shell_cmd(int argc, char **argv) return adxl345_shell_err_unknown_arg(argv[1]); } -int -adxl345_shell_init(void) -{ - int rc; - - rc = shell_cmd_register(&adxl345_shell_cmd_struct); - SYSINIT_PANIC_ASSERT(rc == 0); - - return rc; -} +MAKE_SHELL_CMD(adxl345, adxl345_shell_cmd, NULL) #endif
