• xthexder@l.sw0.com
    link
    fedilink
    arrow-up
    6
    ·
    edit-2
    4 months ago

    GPIOs are usually controlled by a single bit of a register anyway. Most likely you need to do something like:

    // Set high
    PORTB |= 1 << PINB5;
    // Set low
    PORTB &= ~(1 << PINB5);
    
    • Croquette@sh.itjust.works
      link
      fedilink
      arrow-up
      2
      ·
      4 months ago

      I am a lazy dev (not really, clients always want fast code), so I use the provided HAL libraries 99.9% of the time.

      But I have seen code where someone would write something like

      gpio_write(PIN_X, true) 
      

      and it always stood out to me.