I'm having trouble with what would seemingly be a simple task.
I have customized my own board.c/board.h files to fit my specific needs.
I am able to successfully write to and change the value of a GPIO pin that is configured as an output, but unsuccessful when attempting to read the value of a GPIO pin that is configured as an Input.
Any suggestions on what I could be missing, I have done everything in the PIN.h file examples as well as looked over the SWRU393 Guide.
Board.h
/*TAMPER SWITCH PINS*/ #define REED_SWITCH_STATUS IOID_3 #define REED_SWITCH_ENABLE IOID_2 /*LIGHT SENSOR PINS*/ #define LIGHT_SENSOR_ENABLE IOID_7 #define LIGHT_SENSOR_STATUS IOID_8 /*BATTERY VOLTAGE PINS*/ #define BATTERY_READ_ENABLE IOID_13 #define BATTERY_VOLTAGE_READ IOID_14 /*DEBUG UART*/ #define UART_DEBUG_RX IOID_1 #define UART_DEBUG_TX IOID_0
Board.c
PIN_Config BoardGpioInitTable[] = {
REED_SWITCH_ENABLE | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,
REED_SWITCH_STATUS | PIN_INPUT_EN | PIN_PULLUP | PIN_HYSTERESIS,
/*LIGHT SENSOR PINS*/
LIGHT_SENSOR_ENABLE | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,
LIGHT_SENSOR_STATUS | PIN_INPUT_EN | PIN_NOPULL | PIN_HYSTERESIS,
PIN_TERMINATE
};
SimpleBLE Peripheral
// eTag pin handle
PIN_Handle hEtagPins;
PIN_State EtagPins;
hEtagPins = PIN_open(&EtagPins, BoardGpioInitTable);
//Tamper Switch Logic
PIN_setOutputValue(hEtagPins, REED_SWITCH_ENABLE, 0);
PIN_setOutputValue(hEtagPins, LIGHT_SENSOR_ENABLE, 0);
// Sleep for 100ms
Task_sleep(100000/10);
//Get Input of Tamper
reedSwitchStatus = PIN_getInputValue(REED_SWITCH_STATUS);
lightSensorStatus = PIN_getInputValue(LIGHT_SENSOR_STATUS);
reedSwitchStatus = PIN_getInputValue(REED_SWITCH_STATUS);
if(reedSwitchStatus)
{
Task_sleep(10000/10);
}
else
{
Task_sleep(10000/10);
}
}
Thanks in advance for any help.