sensor: adxl3xx: Move run-time modification of ODR from cfg to data
Config struct is constant and attempting to modify it triggers a fault. Signed-off-by: Luis Ubieda <luisf@croxel.com>
This commit is contained in:
parent
0a71e95c5a
commit
5a9ff03c21
6 changed files with 8 additions and 6 deletions
|
@ -550,7 +550,7 @@ static int adxl372_attr_set_odr(const struct device *dev,
|
|||
const struct sensor_value *val)
|
||||
{
|
||||
enum adxl372_odr odr;
|
||||
struct adxl372_dev_config *cfg = (struct adxl372_dev_config *)dev->config;
|
||||
struct adxl372_data *data = dev->data;
|
||||
|
||||
switch (val->val1) {
|
||||
case 400:
|
||||
|
@ -575,7 +575,7 @@ static int adxl372_attr_set_odr(const struct device *dev,
|
|||
int ret = adxl372_set_odr(dev, odr);
|
||||
|
||||
if (ret == 0) {
|
||||
cfg->odr = odr;
|
||||
data->odr = odr;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -312,6 +312,7 @@ struct adxl372_data {
|
|||
const struct adxl372_transfer_function *hw_tf;
|
||||
struct adxl372_fifo_config fifo_config;
|
||||
enum adxl372_act_proc_mode act_proc_mode;
|
||||
enum adxl372_odr odr;
|
||||
#ifdef CONFIG_ADXL372_TRIGGER
|
||||
struct gpio_callback gpio_cb;
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ static void adxl372_process_fifo_samples_cb(struct rtio *r, const struct rtio_sq
|
|||
hdr->is_fifo = 1;
|
||||
hdr->timestamp = data->timestamp;
|
||||
hdr->int_status = data->status1;
|
||||
hdr->accel_odr = cfg->odr;
|
||||
hdr->accel_odr = data->odr;
|
||||
hdr->sample_set_size = sample_set_size;
|
||||
|
||||
if ((cfg->fifo_config.fifo_format == ADXL372_X_FIFO) ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue