Skip to content

Commit 73a419c

Browse files
jtguggedalcarlescufi
authored andcommitted
[nrf fromtree] drivers: sensor: adxl362: Fix unused variable warnings
This patch fixes warnings for unused variables when acceleremoter range and sampling frequency are set to values different from the defaults. Signed-off-by: Jan Tore Guggedal <jantore.guggedal@nordicsemi.no>
1 parent 9ae8e24 commit 73a419c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/sensor/adxl362/adxl362.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ static int adxl362_set_power_mode(const struct device *dev, uint8_t mode)
171171
return adxl362_set_reg(dev, new_power_ctl, ADXL362_REG_POWER_CTL, 1);
172172
}
173173

174+
#if defined(CONFIG_ADXL362_ACCEL_ODR_RUNTIME)
174175
/*
175176
* Output data rate map with allowed frequencies:
176177
* freq = freq_int + freq_milli / 1000
@@ -211,7 +212,9 @@ static int adxl362_freq_to_odr_val(uint16_t freq_int, uint16_t freq_milli)
211212

212213
return -EINVAL;
213214
}
215+
#endif /* CONFIG_ADXL362_ACCEL_ODR_RUNTIME */
214216

217+
#if defined(CONFIG_ADXL362_ACCEL_RANGE_RUNTIME)
215218
static const struct adxl362_range {
216219
uint16_t range;
217220
uint8_t reg_val;
@@ -233,6 +236,7 @@ static int32_t adxl362_range_to_reg_val(uint16_t range)
233236

234237
return -EINVAL;
235238
}
239+
#endif /* CONFIG_ADXL362_ACCEL_RANGE_RUNTIME */
236240

237241
static int adxl362_set_range(const struct device *dev, uint8_t range)
238242
{

0 commit comments

Comments
 (0)