我们可以明星t Advertising and Stop Advertising on button press?

⚠️
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.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
2 posts / 0 new
Last post
前腿帕特尔
Offline
Last seen:2 years 6 months ago
加入:2017-03-29 10:50
我们可以明星t Advertising and Stop Advertising on button press?

Dear Dialog_Support,

1. My requirement is to start advertising whenever i short press the push button and stop advertising on long press of the push button. Is it possible to implement this? If yes then how to implement this?

2. I want to store some data permanently into flash and also modify whenever requirement of data modification then how to implement this? What are the steps required to implement this? Do i need to erase the sector everytime i write something into flash? How many max write and erase cycles are available for DA14583 board?

Thank you in advance.

With Regards,
前腿帕特尔

Device:
PM_Dialog
Offline
Last seen:2 days 13 hours ago
工作人员
加入:2018-02-08 11:03
Hi Ruchi Patel,

Hi Ruchi Patel,

In order to implement a short and a long press button you should add a timer into the callback function that is registered into the wkupct_register_callback(). When the timer elapses, you should check the status of the button. If it is not pressed this means that is a short press but if it is still pressed this means that is a long press. So, if you detect a short press button and the device isn’t advertising you should call the user_app_adv_start(), and if you detect a long press button and the device is advertising, you should stop the advertising with the user_app_adv_stop (). This function is not implemented in the SDK, so you should implement your own function to stop advertising by calling the app_easy_gap_advertise_stop() into the user_app_adv_stop (). Also, you could check some previous threads on the forum:

https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-da1458x-bt42-%E2%80%93-software/button-long-press-detection

https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-42-%E2%80%93-software/button-press-time

Regarding your second question, I suggest you to have a look at the Smart Tag application project and check how the bonding data are stored in the SPI Flash. The internal SPI Flash of the DA14583 SoC, supports 100,000 erase/program cycles at minimum.

Thanks, PM_Dialog