Hi,
I want to make at the Coap application from the example wireless_examples_thread_router_eligible_device an custom application. I need to send my luxometer value through Coap when an input interrupt comes in PTA17.
I see on the example that there is a sw2 button event. When I push sw2 from my board I cand send its temperature. Can I change the sw2 input to PTA17 input. I mean can I associate my PTA17 input to the sw2 event? How do I solve this?
The extract of the code I want to change is the following:
I need to associate the "gKBD_EventPB2_c" to the PTA17 input event.
Best regards,
Diego Comin
Hello Estephania,
I was in holidays during these days so that I could not reply your message. To recycle a keyboard event report I changed the switch SW2 pin PTC5 to my PTA17.
I thought I could use the event "gKBD_EventPB2_c" attached to the previous switch pin SW2 PTC5 (now attached to my PTA17), but when I trigger PTA17 input the module resets.
What could be the problem? If it is not possible to replace the switch pin to any custom pin, could you show me an example how to create a new event to report as it is done in Keyboard.c file with my PTA17?
Thanks in advance,
Diego Comin
Please make sure the Port A clock is enabled and the pin is configured as GPIO.
Add these in the BOARD_InitButtons() function.
CLOCK_EnableClock(kCLOCK_PortA);
PORT_SetPinMux(PORTA, 17, kPORT_MuxAsGpio); /* PORTA17 is configured as PTA17 */
Hello,
You will need to configure the PTA17 as an input as it is done for the other buttons, you can check the switchPins[] struct with the configuration on how it is done for the switches on the gpio_pins.c file.
Also, you can create you own event to report as it is done in the Keyboard.c / .h files.
To send the CoAP message, you can use the temperature callback as a guide and here is another explanation of CoAP that might help you Kinetis W: [Thread] CoAP basics and hands on
Regards,
Estephania