Other Parts Discussed in Thread: CC2640,
Tool/software: TI-RTOS
Hi everyone, I create a custom APP for android for my project. In this moment I see (on my APP) the Input State (Low-High) of some PIN and I can turn ON/OFF of relay. Now, I would like to add a new function on my APP. I thought about checking an input, then I click 1 and the input becomes 1 if I click 0 the inverse. I thought about doing this by following the example of the LED services, but how can I check the input?
This is my part of code:
void user_PinService_ValueChangeHandler(char_data_t *pCharData) { static uint8_t pretty_data_holder[16]; // 5 bytes as hex string "AA:BB:CC:DD:EE" Util_convertArrayToHexString(pCharData->data, pCharData->dataLen, pretty_data_holder, sizeof(pretty_data_holder)); switch (pCharData->paramID) { case PN_PIN0_ID: Log_info3("Value Change msg: %s %s: %s", (IArg)"PIN Service", (IArg)"PIN1", (IArg)pretty_data_holder); // Do something useful with pCharData->data here // ------------------------- // Set the output value equal to the received value. 0 is off, not 0 is on PIN_setInputValue(pinPinHandle, Board_PIN_DIO19, pCharData->data[0]); Log_info2("input1 mon %s %s", (IArg)"\x1b[31mInput1\x1b[0m", (IArg)(pCharData->data[0]?"mon":"bis")); break; case PN_PIN1_ID: Log_info3("Value Change msg: %s %s: %s", (IArg)"Pin Service", (IArg)"PIN2", (IArg)pretty_data_holder); // Do something useful with pCharData->data here // ------------------------- // Set the output value equal to the received value. 0 is off, not 0 is on PIN_setInputValue(pinPinHandle, Board_PIN_DIO23, pCharData->data[0]); Log_info2("Pin2 mon %s %s", (IArg)"\x1b[32PIN2\x1b[0m", (IArg)(pCharData->data[0]?"mon":"bis")); break; default: return; } }