2022-04-04 07:03 AM
i am reading GPIO PIN using
bool X[n];
X[1] = (GPIOA->IDR >> 1)&1;
X[2] = (GPIOA->IDR >> 4)&1;
now i want to inverse reading bit because of pull up i am getting inverse output in X[n].
example
X[1] = (GPIOA->IDR >> 1)&1; gives 1 but i want 0
How can i do this ?
X[1] != (GPIOA->IDR >> 1)&1; gives warning
value computed but not used [-Wunused-value}
Solved! Go to Solution.
2022-04-04 07:23 AM
X[1] = !((GPIOA->IDR >> 1)&1);
X[1] = (~GPIOA->IDR >> 1)&1 // Tilde
2022-04-04 07:23 AM
X[1] = !((GPIOA->IDR >> 1)&1);
X[1] = (~GPIOA->IDR >> 1)&1 // Tilde