Will gpio_set_level() configure a GPIO properly before it has been set as an output, for example:
Code: Select all
gpio_num_t gpio = /* some valid GPIO pin # */;
gpio_set_level(gpio, 0);
gpio_set_direction(gpio, GPIO_MODE_OUTPUT);
Code: Select all
gpio_num_t gpio = /* some valid GPIO pin # */;
gpio_set_level(gpio, 0);
gpio_set_direction(gpio, GPIO_MODE_OUTPUT);
Code: Select all
static inline void gpio_ll_set_level(gpio_dev_t *hw, gpio_num_t gpio_num, uint32_t level)
{
if (level) {
hw->out_w1ts.out_w1ts = (1 << gpio_num);
} else {
hw->out_w1tc.out_w1tc = (1 << gpio_num);
}
}
Code: Select all
static inline __attribute__((always_inline)) void gpio_ll_output_enable(gpio_dev_t *hw, gpio_num_t gpio_num)
{
hw->enable_w1ts.enable_w1ts = (0x1 << gpio_num);
}
Users browsing this forum: Bing [Bot] and 344 guests