GPIO_OUTPUT_ACTIVE meaning

Hello, 
I have a pin that controls the power flow to the sensors on my board.
it is active low, when it gets a raw value of 0, it allows the power flow to the sensors.

I have these two pieces of code that, from my understanding, are supposed to create the same result from the pin's perspective.

first block:
void configure_and_set_sensor_power_pin(){
      gpio_pin_configure(gpio_dev1, 10, GPIO_OUTPUT);
      gpio_pin_set(gpio_dev1, 10, 0);
}


second block:
void configure_and_set_sensor_power_pin(){
      gpio_pin_configure(gpio_dev1, 10, GPIO_OUTPUT_ACTIVE);
      gpio_pin_set(gpio_dev1, 10, 0);
}

from my understanding, GPIO_OUTPUT_ACTIVE only means it sets the first value to 1, gpio_pin_set(gpio_dev1, 10, 0); should be setting it to 0 regardless.

in practice, only the first block works, the second block doesn't.
why is that?

thanks in advance,
shlomo






Parents
  • Hello Shlomo,

    After a quick look at this, if it is active low, my understanding is this:

    The first block gpio_pin_set() sets it inactive, meaning high.

    In the second block, then gpio_pin_configure(gpio_dev1, 10, GPIO_OUTPUT_ACTIVE) sets it at first active, meaning low. Then gpio_pin_configure() sets it inactive, meaning high.

    So both would end up high, but how they get there is a bit different. In what way are you seeing the two differ?

    Regards,

    Elfving

Reply
  • Hello Shlomo,

    After a quick look at this, if it is active low, my understanding is this:

    The first block gpio_pin_set() sets it inactive, meaning high.

    In the second block, then gpio_pin_configure(gpio_dev1, 10, GPIO_OUTPUT_ACTIVE) sets it at first active, meaning low. Then gpio_pin_configure() sets it inactive, meaning high.

    So both would end up high, but how they get there is a bit different. In what way are you seeing the two differ?

    Regards,

    Elfving

Children
No Data
Related