Sem
Sem

Reputation: 55

How to translate this code from AVR into STM32

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

Answers (1)

0___________
0___________

Reputation: 67820

Assuming pin4 on port D.

data_in = !!(GPIOD -> IDR & (1 << 4));

Upvotes: 1

Related Questions