drivers/sensor: lis2dw12: add bw_filt support
Add bandwidth filter support. (BW_FILT in CTRL6) Value is configurable through DT per instance. Signed-off-by: Maxime Vincent <maxime@veemax.be>
This commit is contained in:
parent
089f70d4b3
commit
47021a608d
3 changed files with 24 additions and 0 deletions
|
@ -289,6 +289,9 @@ static int lis2dw12_init(const struct device *dev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
LOG_DBG("bandwidth filter is %u", (int)cfg->bw_filt);
|
||||
lis2dw12_filter_bandwidth_set(ctx, cfg->bw_filt);
|
||||
|
||||
#ifdef CONFIG_LIS2DW12_TRIGGER
|
||||
if (lis2dw12_init_interrupt(dev) < 0) {
|
||||
LOG_ERR("Failed to initialize interrupts");
|
||||
|
@ -363,6 +366,7 @@ static int lis2dw12_init(const struct device *dev)
|
|||
}, \
|
||||
.pm = DT_INST_PROP(inst, power_mode), \
|
||||
.range = DT_INST_PROP(inst, range), \
|
||||
.bw_filt = DT_INST_PROP(inst, bw_filt), \
|
||||
LIS2DW12_CONFIG_TAP(inst) \
|
||||
COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, irq_gpios), \
|
||||
(LIS2DW12_CFG_IRQ(inst)), ()) \
|
||||
|
@ -387,6 +391,7 @@ static int lis2dw12_init(const struct device *dev)
|
|||
}, \
|
||||
.pm = DT_INST_PROP(inst, power_mode), \
|
||||
.range = DT_INST_PROP(inst, range), \
|
||||
.bw_filt = DT_INST_PROP(inst, bw_filt), \
|
||||
LIS2DW12_CONFIG_TAP(inst) \
|
||||
COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, irq_gpios), \
|
||||
(LIS2DW12_CFG_IRQ(inst)), ()) \
|
||||
|
|
|
@ -68,6 +68,7 @@ struct lis2dw12_device_config {
|
|||
} stmemsc_cfg;
|
||||
lis2dw12_mode_t pm;
|
||||
uint8_t range;
|
||||
uint8_t bw_filt;
|
||||
#ifdef CONFIG_LIS2DW12_TRIGGER
|
||||
struct gpio_dt_spec gpio_int;
|
||||
uint8_t int_pin;
|
||||
|
|
|
@ -48,6 +48,24 @@ properties:
|
|||
- 4
|
||||
- 2
|
||||
|
||||
bw-filt:
|
||||
type: int
|
||||
required: false
|
||||
default: 0
|
||||
description: |
|
||||
Digital filtering cutoff bandwidth. Default is power-up configuration.
|
||||
|
||||
3 # ODR/20 (HP/LP)
|
||||
2 # ODR/10 (HP/LP)
|
||||
1 # ODR/ 4 (HP/LP)
|
||||
0 # ODR/ 2 (up to ODR = 800 Hz, 400 Hz when ODR = 1600 Hz)
|
||||
|
||||
enum:
|
||||
- 3
|
||||
- 2
|
||||
- 1
|
||||
- 0
|
||||
|
||||
power-mode:
|
||||
type: int
|
||||
required: false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue