Re: how to describe a peripheral with power enable pin
ok, ok. I have to enable the regulator device driver. Now it is working. My overlay is as below: / { Si7021_pwr: Si7021-pwr-ctrl { compatible = "regulator-fixed"; regulator-name = "Si7021 enable pin"; enable-gpios = < &gpiod 9 0 >; label = "Si7021-pwr"; }; }; But when I'll try to use the pin, I'm getting a EINVAL error after the gpio_pin_config function: const struct device* pwr = device_get_binding( "Si7021-pwr" ); if (NULL == pwr ) { printf( "Could not get pwr port\n" ); return; } rc = gpio_pin_configure(pwr, 9, GPIO_OUTPUT_ACTIVE | GPIO_OUTPUT_INIT_HIGH ); if (rc < 0) { printk("Failed to configure gpio pin\n"); return; } if I use the same sequence, but opening the gpiod port, everything works fine: const struct device* gpiod = device_get_binding( DT_LABEL( DT_NODELABEL( gpiod ) ) ); if (NULL == gpiod ) { printf( "Could not get gpiod port\n" ); return; } rc = gpio_pin_configure(gpiod, 9, GPIO_OUTPUT_ACTIVE | GPIO_OUTPUT_INIT_HIGH ); if (rc < 0) { printk("Failed to configure gpio pin\n"); return; } I don't know where the error is..
On Thu, 8 Apr 2021 at 07:15, Rafael Dias via lists.zephyrproject.org <rdmeneze=gmail.com@...> wrote:
-- Rafael Dias Menezes tel.: +436507008854
|
|