Hi,
I have the structure for a Vesper VM3011 MEMS microphone:
struct vm3011_config { const struct device *i2c_dev; uint16_t i2c_address; gpio_pin_t data_pin; gpio_pin_t clk_pin; bool lr_pin_level; #if defined(CONFIG_VM3011_INT) const char *gpio_port; gpio_pin_t dout_pin; gpio_dt_flags_t dout_flags; #endif };
In the 'overlay' file, I define it as hardware:
&i2c1 { clock-frequency = <I2C_BITRATE_FAST>; vm3011: vm3011@60 { compatible = "i2c-device"; label = "VM3011"; reg = <0x60>; clk-pin = <41>; data-pin = <27>; dout-gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>; }; }; / { chosen { zephyr,console = &cdc_acm_uart0; zephyr,shell-uart = &cdc_acm_uart0; nordic,pm-ext-flash = &mx25r64; }; aliases { mic0 = &i2c1; }; };
static const struct vm3011_config vm3011_cfg = { .i2c_dev = DEVICE_DT_GET(DT_ALIAS(mic0)), .i2c_address = DT_INST_REG_ADDR(0), .data_pin = DT_INST_PROP(0, data_pin), .clk_pin = DT_INST_PROP(0, clk_pin), .lr_pin_level = DT_INST_PROP(0, lr_select), #if defined(CONFIG_VM3011_INT) //.gpio_port = DT_INST_GPIO_LABEL(0, dout_gpios), .dout_pin = DT_INST_GPIO_PIN(0, dout_gpios), .dout_flags = DT_INST_GPIO_FLAGS(0, dout_gpios), #endif };
static const struct vm3011_config vm3011_cfg = { .i2c_dev = DEVICE_DT_GET(DT_ALIAS(mic0)), .i2c_address = (uint16_t)DT_REG_ADDR(DT_ALIAS(mic0)), .data_pin = 27, .clk_pin = 41, .lr_pin_level = true, #if defined(CONFIG_VM3011_INT) .gpio_port = "gpio0", .dout_pin = 25, .dout_flags = GPIO_ACTIVE_HIGH, #endif };
This compiles, but I don't like hardcoding values in such an absolute way.
I believe these are Zephyr deprecations, but I cannot find relevant documentation.
Can you help me understand what's going on?
sdk 2.6.1 toolchain 2.7.0
Thank you.
BABOS