Reputation: 55
I am trying to rewrite the code from AVR to STM32. How to translate this code into STM32?
#define READ_IO PIND & (1 << PD4)
volatile unsigned char data_in = 0;
data_in = (READ_IO) >> PD4;
I use STM32CubeIDE
Upvotes: 0
Views: 122
Reputation: 67820
Assuming pin4 on port D.
data_in = !!(GPIOD -> IDR & (1 << 4));
Upvotes: 1