This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to read SW1 and SW2 from the CC3200 Launchpad?

Other Parts Discussed in Thread: CC3200

How can you read the SW1 and SW2 from the CC3200 Launchpad? I have looked quite deeply into the pinmux and gpio_if.c, along with others in cc3200-sdk/ but I cannot solve this one. So 45 minutes later I conceed - how do you read GPIO on the CC3200?

  • SW1: GPIO[13]
  • SW2: GPIO[22]

I could not find GPIO R/W info anywhere online for the CC3200 and expect this to immediately and comprehensively solve my questions. Does anyone know where this information is?

Thanks!

  • Hi Justin,

    Do a search in the forum for "GPIO Input". From what I remember there is a code at out of box demo setting SW1 and SW2 as GPIO input. You can learn from that.

    - kel
  • Hi Markel, and anyone else passing by this thread. Alright, I dove in head first. I gave it a strong, diligent and enthusiastic effort, and still come up empty, sheesh! Researching online, in the E2E forums and debugging and testing code ideas myself, none of it works!!! :(!

    Here is my best attempt (it fails)

    CC3200 Information

    • SW2: GPIO[22], Package Pin#15
    • SW3: GPIO[13], Package Pin#4  (PIN_04, GPIOA1_BASE.b5?)

    Code Attempt (GPIO read of PIN_04)

    MAP_PinTypeGPIO(PIN_04, PIN_MODE_0, false);               //Set GPIO[13] to GPIO Mode
    MAP_GPIODirModeSet(GPIOA1_BASE, 0x20, GPIO_DIR_MODE_IN); //Set GPIO[13] to Input int portA1_b5 = GPIORead(1,0x20); //Read GPIO[13]. (b5 == 0x20) //Use it! If this worked... :( if(portA1_b5) { Message("Pin#4 is High!"); } else { Message("Pin#4 is Low..."); }

    This does not work. So then I ask, how do I move forward? :)


    Thanks,

      Justin

     

  • Hi Justin,

    I currently don't have time to help you with code. But, for reading mechanical switches SW2 and SW3, you need to debounce it. One way digital switch debouncing is to read the GPIO Pin after 10 ms by using a timer interrupt or systick interrupt.

    - kel