So at this point it works properly, I tested what could be the minimal stack necessary in order to run the timer queue and arrive at 512 bytes which is 4 times bigger than what we used to have when using a delayed fiber in SMP so the timer API only really payoff in terms of memory in case there is 4 or more timer active, which there will be since we will be adding more user for that in ATT and L2CAP protocols.
I don't get this why you need 512bytes if only 128 was needed by SMP. This should mostly depend on how heavy is the callback, right? Is overhead for queue that big?
Ive also make the timer queue abort if there is no timers left, this is something that perhaps is not such a good idea if there is too much overhead starting the fibers on demand, perhaps by the it cannot be used if the ticks are low perhaps it is shorter then starting a fiber thus loosing precision. Anyway the idea here is not to invent a high precision timer, in fact later on we may introduce a function that takes the timeout in seconds instead of ticks and then coalesce multiple timers that would happen in the same second thus reducing the amount of wakeups.
Luiz Augusto von Dentz (3): Bluetooth: Add timer API Bluetooth: Kconfig: Add BLUETOOTH_DEBUG_TIMER Bluetooth: SMP: Make use of bt_timer API