drivers: sensors: add missing const qualifiers

Ensure conversion tables and the like are marked as const to save on
RAM usage.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This commit is contained in:
Benjamin Cabé 2025-06-16 16:58:26 +02:00 committed by Anas Nashif
commit 0f6b3f066a
6 changed files with 7 additions and 7 deletions

View file

@ -131,7 +131,7 @@ static int apds9253_attr_set_gain(const struct device *dev, uint8_t gain)
return 0;
}
static uint8_t value_map[] = {
static const uint8_t value_map[] = {
APDS9253_LS_GAIN_RANGE_1, APDS9253_LS_GAIN_RANGE_3, APDS9253_LS_GAIN_RANGE_6,
APDS9253_LS_GAIN_RANGE_9, APDS9253_LS_GAIN_RANGE_18,
};

View file

@ -21,7 +21,7 @@ LOG_MODULE_DECLARE(bma4xx, CONFIG_SENSOR_LOG_LEVEL);
#ifdef CONFIG_BMA4XX_STREAM
static uint64_t accel_period_ns[] = {
static const uint64_t accel_period_ns[] = {
[BMA4XX_ODR_0_78125] = UINT64_C(100000000000000) / 78125,
[BMA4XX_ODR_1_5625] = UINT64_C(10000000000000) / 15625,
[BMA4XX_ODR_3_125] = UINT64_C(10000000000000) / 31250,

View file

@ -91,7 +91,7 @@ static int hp206c_cmd_send(const struct device *dev, uint8_t cmd)
* conversion wait time which looks like a good compromise provided the highest
* precision computation takes 131.1ms.
*/
static uint8_t hp206c_adc_time_ms[] = {
static const uint8_t hp206c_adc_time_ms[] = {
/* conversion time(ms), OSR */
132, /* 4096 */
66, /* 2048 */

View file

@ -16,7 +16,7 @@
LOG_MODULE_REGISTER(MC3419, CONFIG_SENSOR_LOG_LEVEL);
static const uint16_t mc3419_accel_sense_map[] = {1, 2, 4, 8, 6};
static struct mc3419_odr_map odr_map_table[] = {
static const struct mc3419_odr_map odr_map_table[] = {
{25}, {50}, {62, 500}, {100},
{125}, {250}, {500}, {1000}
};

View file

@ -22,7 +22,7 @@
LOG_MODULE_REGISTER(SX9500, CONFIG_SENSOR_LOG_LEVEL);
static uint8_t sx9500_reg_defaults[] = {
static const uint8_t sx9500_reg_defaults[] = {
/*
* First number is register address to write to. The chip
* auto-increments the address for subsequent values in a single

View file

@ -286,7 +286,7 @@ static int icm42688_read_imu_from_packet(const uint8_t *pkt, bool is_accel, int
return 0;
}
static uint32_t accel_period_ns[] = {
static const uint32_t accel_period_ns[] = {
[ICM42688_DT_ACCEL_ODR_1_5625] = UINT32_C(10000000000000) / 15625,
[ICM42688_DT_ACCEL_ODR_3_125] = UINT32_C(10000000000000) / 31250,
[ICM42688_DT_ACCEL_ODR_6_25] = UINT32_C(10000000000000) / 62500,
@ -304,7 +304,7 @@ static uint32_t accel_period_ns[] = {
[ICM42688_DT_ACCEL_ODR_32000] = UINT32_C(1000000) / 32,
};
static uint32_t gyro_period_ns[] = {
static const uint32_t gyro_period_ns[] = {
[ICM42688_DT_GYRO_ODR_12_5] = UINT32_C(10000000000000) / 125000,
[ICM42688_DT_GYRO_ODR_25] = UINT32_C(1000000000) / 25,
[ICM42688_DT_GYRO_ODR_50] = UINT32_C(1000000000) / 50,