Skip to content

Commit e1ca18e

Browse files
avisconticarlescufi
authored andcommitted
modules/hal_st: Align sensor drivers to stmemsc HAL i/f v2.3
Align all sensor drivers that are using stmemsc (STdC) HAL i/f to new APIs of stmemsc v2.3 Requires zephyrproject-rtos/hal_st#16 Signed-off-by: Armando Visconti <[email protected]>
1 parent bc7205e commit e1ca18e

File tree

4 files changed

+9
-29
lines changed

4 files changed

+9
-29
lines changed

drivers/sensor/lsm6dso/lsm6dso_shub.c

+2-8
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ static int lsm6dso_shub_read_target_reg(const struct device *dev,
485485
trgt_cfg.slv_subadd = trgt_reg;
486486
trgt_cfg.slv_len = len;
487487

488-
lsm6dso_sh_slv0_cfg_read(ctx, &trgt_cfg);
488+
lsm6dso_sh_slv_cfg_read(ctx, 0, &trgt_cfg);
489489

490490
/* turn SH on, wait for shub i2c read to finish */
491491
lsm6dso_shub_enable(dev, 1);
@@ -565,12 +565,6 @@ static int lsm6dso_shub_set_data_channel(const struct device *dev)
565565
stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx;
566566
uint8_t n;
567567
struct lsm6dso_shub_slist *sp;
568-
int32_t (*sh_chan_cfg[LSM6DSO_SHUB_MAX_NUM_TARGETS])
569-
(stmdev_ctx_t *ctx, lsm6dso_sh_cfg_read_t *val) = {
570-
lsm6dso_sh_slv1_cfg_read,
571-
lsm6dso_sh_slv2_cfg_read,
572-
lsm6dso_sh_slv3_cfg_read,
573-
};
574568
lsm6dso_sh_cfg_read_t trgt_cfg;
575569

576570
/* Configure shub data channels to access external targets */
@@ -581,7 +575,7 @@ static int lsm6dso_shub_set_data_channel(const struct device *dev)
581575
trgt_cfg.slv_subadd = sp->out_data_addr;
582576
trgt_cfg.slv_len = sp->out_data_len;
583577

584-
if (sh_chan_cfg[n](ctx, &trgt_cfg) < 0) {
578+
if (lsm6dso_sh_slv_cfg_read(ctx, n + 1, &trgt_cfg) < 0) {
585579
LOG_DBG("shub: error configuring shub for ext targets");
586580
return -EIO;
587581
}

drivers/sensor/lsm6dso16is/lsm6dso16is_shub.c

+3-10
Original file line numberDiff line numberDiff line change
@@ -580,14 +580,14 @@ static int lsm6dso16is_shub_read_target_reg(const struct device *dev,
580580
trgt_cfg.slv_subadd = trgt_reg;
581581
trgt_cfg.slv_len = len;
582582

583-
lsm6dso16is_sh_slv0_cfg_read(ctx, &trgt_cfg);
583+
lsm6dso16is_sh_slv_cfg_read(ctx, 0, &trgt_cfg);
584584

585585
/* turn SH on, wait for shub i2c read to finish */
586586
lsm6dso16is_shub_enable(dev, 1);
587587
lsm6dso16is_shub_wait_completed(ctx);
588588

589589
/* read data from external target */
590-
if (lsm6dso16is_sh_read_data_raw_get(ctx, (lsm6dso16is_emb_sh_read_t *)value, len) < 0) {
590+
if (lsm6dso16is_sh_read_data_raw_get(ctx, value, len) < 0) {
591591
LOG_DBG("shub: error reading sensor data");
592592
return -EIO;
593593
}
@@ -662,13 +662,6 @@ static int lsm6dso16is_shub_set_data_channel(const struct device *dev)
662662
struct lsm6dso16is_shub_slist *sp;
663663
lsm6dso16is_sh_cfg_read_t trgt_cfg;
664664

665-
int32_t (*sh_chan_cfg[LSM6DSO16IS_SHUB_MAX_NUM_TARGETS])
666-
(stmdev_ctx_t *ctx, lsm6dso16is_sh_cfg_read_t *val) = {
667-
lsm6dso16is_sh_slv1_cfg_read,
668-
lsm6dso16is_sh_slv2_cfg_read,
669-
lsm6dso16is_sh_slv3_cfg_read,
670-
};
671-
672665
/* Configure shub data channels to access external targets */
673666
for (n = 0; n < data->num_ext_dev; n++) {
674667
sp = &lsm6dso16is_shub_slist[data->shub_ext[n]];
@@ -677,7 +670,7 @@ static int lsm6dso16is_shub_set_data_channel(const struct device *dev)
677670
trgt_cfg.slv_subadd = sp->out_data_addr;
678671
trgt_cfg.slv_len = sp->out_data_len;
679672

680-
if (sh_chan_cfg[n](ctx, &trgt_cfg) < 0) {
673+
if (lsm6dso16is_sh_slv_cfg_read(ctx, n + 1, &trgt_cfg) < 0) {
681674
LOG_DBG("shub: error configuring shub for ext targets");
682675
return -EIO;
683676
}

drivers/sensor/lsm6dsv16x/lsm6dsv16x_shub.c

+3-10
Original file line numberDiff line numberDiff line change
@@ -580,14 +580,14 @@ static int lsm6dsv16x_shub_read_target_reg(const struct device *dev,
580580
trgt_cfg.slv_subadd = trgt_reg;
581581
trgt_cfg.slv_len = len;
582582

583-
lsm6dsv16x_sh_slv0_cfg_read(ctx, &trgt_cfg);
583+
lsm6dsv16x_sh_slv_cfg_read(ctx, 0, &trgt_cfg);
584584

585585
/* turn SH on, wait for shub i2c read to finish */
586586
lsm6dsv16x_shub_enable(dev, 1);
587587
lsm6dsv16x_shub_wait_completed(ctx);
588588

589589
/* read data from external target */
590-
if (lsm6dsv16x_sh_read_data_raw_get(ctx, (lsm6dsv16x_emb_sh_read_t *)value, len) < 0) {
590+
if (lsm6dsv16x_sh_read_data_raw_get(ctx, value, len) < 0) {
591591
LOG_DBG("shub: error reading sensor data");
592592
return -EIO;
593593
}
@@ -662,13 +662,6 @@ static int lsm6dsv16x_shub_set_data_channel(const struct device *dev)
662662
struct lsm6dsv16x_shub_slist *sp;
663663
lsm6dsv16x_sh_cfg_read_t trgt_cfg;
664664

665-
int32_t (*sh_chan_cfg[LSM6DSV16X_SHUB_MAX_NUM_TARGETS])
666-
(stmdev_ctx_t *ctx, lsm6dsv16x_sh_cfg_read_t *val) = {
667-
lsm6dsv16x_sh_slv1_cfg_read,
668-
lsm6dsv16x_sh_slv2_cfg_read,
669-
lsm6dsv16x_sh_slv3_cfg_read,
670-
};
671-
672665
/* Configure shub data channels to access external targets */
673666
for (n = 0; n < data->num_ext_dev; n++) {
674667
sp = &lsm6dsv16x_shub_slist[data->shub_ext[n]];
@@ -677,7 +670,7 @@ static int lsm6dsv16x_shub_set_data_channel(const struct device *dev)
677670
trgt_cfg.slv_subadd = sp->out_data_addr;
678671
trgt_cfg.slv_len = sp->out_data_len;
679672

680-
if (sh_chan_cfg[n](ctx, &trgt_cfg) < 0) {
673+
if (lsm6dsv16x_sh_slv_cfg_read(ctx, n + 1, &trgt_cfg) < 0) {
681674
LOG_DBG("shub: error configuring shub for ext targets");
682675
return -EIO;
683676
}

west.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ manifest:
224224
groups:
225225
- hal
226226
- name: hal_st
227-
revision: 5948f7b3304f1628a45ee928cd607619a7f53bbb
227+
revision: 9b128caf3e7b2e750169b880e83f210ea2213473
228228
path: modules/hal/st
229229
groups:
230230
- hal

0 commit comments

Comments
 (0)