Reply
Highlighted
Posts: 1
Registered: ‎08-12-2017

BLE113 Event Priority vs While loop

Hello,

 

I have an interrupt triggered by an external accelerometer used to bring my BLE out of PM3. This int triggers a timer. If a device connects, the timer event runs a while loop while a variable "connected" = 1. Outside the loop, I have a connection_disconnected event that sets "connected" variable = 0. Will the connection_disconnected event take priority over executing the while loop in order to bring the while loop to an end? Hopefully this makes sense.

 

Thanks,
coltonrb

Posts: 2,612
Registered: ‎08-25-2015

Re: BLE113 Event Priority vs While loop

Hi,

 

No, it won't, there is no preemptive execution in BGScript, each procedure/even will execute all the way until it exists. If you place infinite while loops conditional to some externally set data then your application will freeze.

 

Regards,

Tiago