4 Replies Latest reply on May 3, 2018 3:56 AM by AlanH_86

    Initial Drive State vs. Drive Mode for Resistive Pull Up/Pull Down

      Hi all, I'm new to the cypress community--so my apologies if this is posted in the wrong place.


      I'm making a simple project in my BLE Pioneer Kit where an LED changes color when you press SW2. I have configured SW2 as an input and two LEDs as outputs. I am using the following code to determine when the button is pressed:


      int push_flag = 0;
              while (Cy_GPIO_Read(PUSH_PORT, PUSH_NUM) == 1) { // If you push the button
                  push_flag = 1;
      //Code continues


      What I'm confused about is, regardless of whether or not my input is configured as a Resistive Pull Up or a Resistive Pull Down and regardless of whether or not I put a "0" or a "1" in the while loop comparison, my code works the same so long as the Initial Drive State of the pin is a 1.


      In other words, any combination of drive mode and while loop comparison is successful (4 possible combinations) so long as the Initial Drive State is 1.


      Clearly, I'm not understanding something about what initial drive state means, so any suggestions are much appreciated!