you are viewing a single comment's thread
view the rest of the comments
[–] 6 points 1 year ago* (3 children)

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);
  • source
  • parent
  • hideshow 3 child comments
  • [–] 2 points 1 year ago (2 children)

    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.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 1 year ago (1 child)

    Define on as true or something? Or maybe that's more confusing. I'm not a C dev so I'm not gonna pretend to understand idiomatic microcontroller code lol.

  • source
  • parent
  • hideshow 1 child comment