title: GPIO button pressing in C
body: <p>I'm relatively new in the embedded world, so I may be a little newbie asking this.</p>
  
  <p>I'm having trouble to understand the syntax of an example program in C that checks if a button is pressed and then turning a LED on if so. I'm using a STM32F207VCT6 (Cortex-M3) microcontroller.</p>
  
  <p>The part of the program that I'm having trouble to understand is the following:</p>
  
  <pre><code>if(!(GPIOA-&gt;IDR &amp; (1&lt;&lt;4)))
    Key=1;
  </code></pre>
  
  <p>Port 4 from <code>GPIOA</code> is set to be an input with pull-up register. The signal from the button goes to GND once it's pressed. <code>IDR</code> is the input data register.</p>
  
  <p>So my question is:</p>
  
  <p>I don't understand in this code why the NOT symbol, <code>!</code>, inside the <code>if</code> statement is needed. And I do not know what comparison is being made inside the <code>if</code>, since there is no sign of equal. Can someone help me with that?</p>
  
  <p>PS: I already know that <code>(1&lt;&lt;4)</code> is the bit-wise operation for left shifting the bit 1 four times.</p>