2 posts / 0 new
Last post
sandeep
Offline
Last seen:4 years 11 months ago
Joined:2015-06-26 18:52
Advertise only once

I need to implement 2 functions for externally controlled GPIO (P0_6):
1) advertise ONLY once when P0_6 is asserted high
2) stop advertising when P0_6 is deasserted low

Could you please provide some sample codes for these 2 functions.

Device:
MT_dialog
Offline
Last seen:1 month 18 hours ago
Staff
Joined:2015-06-08 11:34
Hi sandeep,

Hi sandeep,

You can have a look at the smart tag reference design in the functions app_button_press_cb and app_button_release_cb. The reference design uses the button interrupts (different polarity each time) in order to wake up, if sleeping, and start advertising. Also if you dont want to use interrupts you can poll the status of the pin with the GPIO_GetPinStatus() function in the app_on_ble_powered callback for example and send either to start or stopadvertising,but in case you use sleep you have to periodically wake up and poll the status of the pin.

Thanks MT_dialog