⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
8 posts / 0 new
Last post
ant777222
Offline
Last seen:1 month 1 week ago
加入:2019-07-11 17:03
IRQ

I am making some changes to the CodeLess code to fit the application that I need. I have added a read notify characteristic that I would like to use to monitor when the input of one of the GPIO pins goes high and when it goes back to low. I want to use an IRQ to do this but I am not too sure where the best place to add the IRQ in the CodeLess code is. Where would the best place to add this IRQ be?

Thanks,

Anthony

Keywords:
Device:
PM_Dialog
Offline
Last seen:19 hours 4 min ago
Staff
加入:2018-02-08 11:03
Hi ant777222,

Hi ant777222,

This depends on your requirements and it application specific. When do you want to enable the IRQ? When advertising or when in connected state? Can you please share more inputs?

Thanks, PM_Dialog

ant777222
Offline
Last seen:1 month 1 week ago
加入:2019-07-11 17:03
In the connected state.

In the connected state.

PM_Dialog
Offline
Last seen:19 hours 4 min ago
Staff
加入:2018-02-08 11:03
Hello,

Hello,

你可以使IRQ in the user_on_connection() callback function which will be triggered upon connection with a peer device.

Thanks, PM_Dialog

ant777222
Offline
Last seen:1 month 1 week ago
加入:2019-07-11 17:03
While connected I do not know

While connected I do not know when the GPIO pin will either go high or low. It sounds like user_on_connection() is only triggered upon connection with a peer device. If the transition of an input to a GPIO pin goes from low to high happens at any time while connected I need the IRQ to happen. I was thinking that user_catch_rest_hndl() would work. But I am not positive.

ant777222
Offline
Last seen:1 month 1 week ago
加入:2019-07-11 17:03
这听起来像是user_on

这听起来像是user_on_connection() is only triggered upon initial connection.

ant777222
Offline
Last seen:1 month 1 week ago
加入:2019-07-11 17:03
Maybe IRQ is not the right

Maybe IRQ is not the right thing to do. I just want to monitor the value of a GPIO input and send that value to a characteristic that I made.

PM_Dialog
Offline
Last seen:19 hours 4 min ago
Staff
加入:2018-02-08 11:03
Hi ant777222,

Hi ant777222,

Alright, I assume that you have already implemented a custom service with a notifiable characteristic. You should get the GPIO status by using GPIO_GetPinStatus() from the gpio.h library and then transmit the value though notifications. Please check ble_app_peripheral example of the SDK and app_adcval1_timer_cb_handler() function in order to find how to send data over notifications.

Thanks, PM_Dialog