lpcware

How know if a GPIOpin is connected

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by pollo89 on Tue Sep 25 01:16:05 MST 2012
Hi guys,
I need to know an input GPIO status: if it is in a 1Logic, 0Logic or if it's not connected.

I used they blinky project in my LPC11C24 board and the GPIO pin is GPIO0_0

my GPIOGetValue:
uint32_t GPIOGetValue( uint32_t portNum, uint32_t bitPosi )
{
  return !! LPC_GPIO[portNum]->MASKED_ACCESS[(1<<bitPosi)];
}
in my main:
uint32_t temp;
GPIOInit();
GPIOSetDir( 0 , 0 , 0 );
temp = GPIOGetValue( 0, 0 );
temp after GPIOGetValue Function is 1 but my pin isn't connect.
How I can know if my pin is connected or not?

EDIT: add code ini GPIOinit
LPC_IOCON->RESET_PIO0_0 &= ~0x07;    /*  P0_0 I/O config */
LPC_IOCON->RESET_PIO0_0 |= 0x01;     /* NOT RESET */

Outcomes