Skip to content

Commit 36fac75

Browse files
committed
Fix [deprecated] clause
In compiler such as the one used in IAR this clause is not recognized. We use instead the following in the prtotype: __attribute__((deprecated("msg"))); Signed-off-by: Armando Visconti <armando.visconti@st.com>
1 parent 52dea3c commit 36fac75

2 files changed

Lines changed: 26 additions & 23 deletions

File tree

lsm6dsv320x_reg.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,8 @@ int32_t lsm6dsv320x_reboot(const stmdev_ctx_t *ctx)
539539
lsm6dsv320x_data_rate_t xl;
540540
lsm6dsv320x_data_rate_t gy;
541541
lsm6dsv320x_hg_xl_data_rate_t hg_xl;
542+
lsm6dsv320x_xl_mode_t xlm;
543+
lsm6dsv320x_gy_mode_t gym;
542544
uint8_t reg_out_en;
543545

544546
if (ctx->mdelay == NULL)
@@ -562,9 +564,17 @@ int32_t lsm6dsv320x_reboot(const stmdev_ctx_t *ctx)
562564
goto exit;
563565
}
564566

567+
/* Save XL/GY current modes */
568+
ret = lsm6dsv320x_xl_mode_get(ctx, &xlm);
569+
ret += lsm6dsv320x_gy_mode_get(ctx, &gym);
570+
if (ret != 0)
571+
{
572+
goto exit;
573+
}
574+
565575
/* 1. Set the low-g accelerometer, high-g accelerometer, and gyroscope in power-down mode */
566-
ret = lsm6dsv320x_xl_data_rate_set(ctx, LSM6DSV320X_ODR_OFF);
567-
ret += lsm6dsv320x_gy_data_rate_set(ctx, LSM6DSV320X_ODR_OFF);
576+
ret = lsm6dsv320x_xl_setup(ctx, LSM6DSV320X_ODR_OFF, LSM6DSV320X_XL_HIGH_PERFORMANCE_MD);
577+
ret += lsm6dsv320x_gy_setup(ctx, LSM6DSV320X_ODR_OFF, LSM6DSV320X_GY_HIGH_PERFORMANCE_MD);
568578
ret += lsm6dsv320x_hg_xl_data_rate_set(ctx, LSM6DSV320X_HG_XL_ODR_OFF, 0);
569579
if (ret != 0)
570580
{
@@ -583,8 +593,8 @@ int32_t lsm6dsv320x_reboot(const stmdev_ctx_t *ctx)
583593
ctx->mdelay(30);
584594

585595
/* Restore data rates */
586-
ret = lsm6dsv320x_xl_data_rate_set(ctx, xl);
587-
ret += lsm6dsv320x_gy_data_rate_set(ctx, gy);
596+
ret = lsm6dsv320x_xl_setup(ctx, xl, xlm);
597+
ret += lsm6dsv320x_gy_setup(ctx, gy, gym);
588598
ret += lsm6dsv320x_hg_xl_data_rate_set(ctx, hg_xl, reg_out_en);
589599

590600
exit:
@@ -644,8 +654,8 @@ int32_t lsm6dsv320x_sw_reset(const stmdev_ctx_t *ctx)
644654
}
645655

646656
/* 1. Set the low-g accelerometer, high-g accelerometer, and gyroscope in power-down mode */
647-
ret = lsm6dsv320x_xl_data_rate_set(ctx, LSM6DSV320X_ODR_OFF);
648-
ret += lsm6dsv320x_gy_data_rate_set(ctx, LSM6DSV320X_ODR_OFF);
657+
ret = lsm6dsv320x_xl_setup(ctx, LSM6DSV320X_ODR_OFF, LSM6DSV320X_XL_HIGH_PERFORMANCE_MD);
658+
ret += lsm6dsv320x_gy_setup(ctx, LSM6DSV320X_ODR_OFF, LSM6DSV320X_GY_HIGH_PERFORMANCE_MD);
649659
ret += lsm6dsv320x_hg_xl_data_rate_set(ctx, LSM6DSV320X_HG_XL_ODR_OFF, 0);
650660
if (ret != 0)
651661
{
@@ -1089,7 +1099,6 @@ int32_t lsm6dsv320x_haodr_set(
10891099
* @retval interface status (MANDATORY: return 0 -> no Error)
10901100
*
10911101
*/
1092-
[[deprecated("Use xl_setup function")]]
10931102
int32_t lsm6dsv320x_xl_data_rate_set(const stmdev_ctx_t *ctx,
10941103
lsm6dsv320x_data_rate_t val)
10951104
{
@@ -1480,7 +1489,6 @@ int32_t lsm6dsv320x_hg_xl_data_rate_get(const stmdev_ctx_t *ctx,
14801489
* @retval interface status (MANDATORY: return 0 -> no Error)
14811490
*
14821491
*/
1483-
[[deprecated("Use xl_setup function")]]
14841492
int32_t lsm6dsv320x_xl_mode_set(const stmdev_ctx_t *ctx, lsm6dsv320x_xl_mode_t val)
14851493
{
14861494
lsm6dsv320x_ctrl1_t ctrl1;
@@ -1562,7 +1570,6 @@ int32_t lsm6dsv320x_xl_mode_get(const stmdev_ctx_t *ctx, lsm6dsv320x_xl_mode_t *
15621570
* @retval interface status (MANDATORY: return 0 -> no Error)
15631571
*
15641572
*/
1565-
[[deprecated("Use gy_setup function")]]
15661573
int32_t lsm6dsv320x_gy_data_rate_set(const stmdev_ctx_t *ctx,
15671574
lsm6dsv320x_data_rate_t val)
15681575
{
@@ -1844,7 +1851,6 @@ int32_t lsm6dsv320x_gy_data_rate_get(const stmdev_ctx_t *ctx,
18441851
* @retval interface status (MANDATORY: return 0 -> no Error)
18451852
*
18461853
*/
1847-
[[deprecated("Use gy_setup function")]]
18481854
int32_t lsm6dsv320x_gy_mode_set(const stmdev_ctx_t *ctx, lsm6dsv320x_gy_mode_t val)
18491855
{
18501856
lsm6dsv320x_ctrl2_t ctrl2;

lsm6dsv320x_reg.h

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4426,14 +4426,11 @@ typedef enum
44264426
LSM6DSV320X_ODR_HA03_AT_3333Hz = 0x3B,
44274427
LSM6DSV320X_ODR_HA03_AT_6667Hz = 0x3C,
44284428
} lsm6dsv320x_data_rate_t;
4429-
// Deprecated: use xl_setup function instead
4430-
int32_t lsm6dsv320x_xl_data_rate_set(const stmdev_ctx_t *ctx,
4431-
lsm6dsv320x_data_rate_t val);
4432-
int32_t lsm6dsv320x_xl_data_rate_get(const stmdev_ctx_t *ctx,
4433-
lsm6dsv320x_data_rate_t *val);
4434-
// Deprecated: use gy_setup function instead
4435-
int32_t lsm6dsv320x_gy_data_rate_set(const stmdev_ctx_t *ctx,
4436-
lsm6dsv320x_data_rate_t val);
4429+
int32_t lsm6dsv320x_xl_data_rate_set(const stmdev_ctx_t *ctx, lsm6dsv320x_data_rate_t val)
4430+
__attribute__((deprecated("Use xl_setup function")));
4431+
int32_t lsm6dsv320x_xl_data_rate_get(const stmdev_ctx_t *ctx, lsm6dsv320x_data_rate_t *val);
4432+
int32_t lsm6dsv320x_gy_data_rate_set(const stmdev_ctx_t *ctx, lsm6dsv320x_data_rate_t val)
4433+
__attribute__((deprecated("Use gy_setup function")));
44374434
int32_t lsm6dsv320x_gy_data_rate_get(const stmdev_ctx_t *ctx,
44384435
lsm6dsv320x_data_rate_t *val);
44394436

@@ -4463,8 +4460,8 @@ typedef enum
44634460
LSM6DSV320X_XL_LOW_POWER_8_AVG_MD = 0x6,
44644461
LSM6DSV320X_XL_NORMAL_MD = 0x7,
44654462
} lsm6dsv320x_xl_mode_t;
4466-
// Deprecated: use xl_setup function instead
4467-
int32_t lsm6dsv320x_xl_mode_set(const stmdev_ctx_t *ctx, lsm6dsv320x_xl_mode_t val);
4463+
int32_t lsm6dsv320x_xl_mode_set(const stmdev_ctx_t *ctx, lsm6dsv320x_xl_mode_t val)
4464+
__attribute__((deprecated("Use xl_setup function")));
44684465
int32_t lsm6dsv320x_xl_mode_get(const stmdev_ctx_t *ctx, lsm6dsv320x_xl_mode_t *val);
44694466

44704467
typedef enum
@@ -4475,9 +4472,9 @@ typedef enum
44754472
LSM6DSV320X_GY_SLEEP_MD = 0x4,
44764473
LSM6DSV320X_GY_LOW_POWER_MD = 0x5,
44774474
} lsm6dsv320x_gy_mode_t;
4478-
// Deprecated: use gy_setup function instead
4479-
int32_t lsm6dsv320x_gy_mode_set(const stmdev_ctx_t *ctx, lsm6dsv320x_gy_mode_t val);
4480-
int32_t lsm6dsv320x_gy_mode_get(const stmdev_ctx_t *ctx, lsm6dsv320x_gy_mode_t *val);
4475+
int32_t lsm6dsv320x_gy_mode_set(const stmdev_ctx_t *ctx, lsm6dsv320x_gy_mode_t val)
4476+
__attribute__((deprecated("Use gy_setup function")));
4477+
int32_t lsm6dsv320x_gy_mode_get(const stmdev_ctx_t *ctx, lsm6dsv80x_gy_mode_t *val);
44814478

44824479
int32_t lsm6dsv320x_auto_increment_set(const stmdev_ctx_t *ctx, uint8_t val);
44834480
int32_t lsm6dsv320x_auto_increment_get(const stmdev_ctx_t *ctx, uint8_t *val);

0 commit comments

Comments
 (0)