mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 20:50:14 +01:00
tests: Generalise rp2 timer test into a cross-port test.
Now all ports with machine.Timer except nrf support both hard and soft callbacks, generalise tests/ports/rp2_machine_timer.py into tests/extmod/machine_timer.py. There is an existing machine_soft_timer.py which varies period= and covers the nrf port but skips esp32/esp8266 because they don't support software timers. In our new test, we try varying freq= instead of period=, and cover esp32/esp8266 (with a fixed choice of hardware timer) but skip nrf because it doesn't support hard= or freq=. Add a check that the heap is locked (so allocation fails) in hard callbacks and it is unlocked (so allocation succeeds) in soft callbacks, to ensure we're getting the right kind of callback, not falling back to the default. Signed-off-by: Chris Webb <chris@arachsys.com>
This commit is contained in:
committed by
Damien George
parent
64fd2f5f36
commit
ccc954256f
16
tests/extmod/machine_timer.py.exp
Normal file
16
tests/extmod/machine_timer.py.exp
Normal file
@@ -0,0 +1,16 @@
|
||||
callback one-shot soft 50 unlocked
|
||||
callback one-shot soft 25 unlocked
|
||||
callback one-shot hard 50 locked
|
||||
callback one-shot hard 25 locked
|
||||
callback periodic soft 50 unlocked
|
||||
callback periodic soft 50 unlocked
|
||||
callback periodic soft 50 unlocked
|
||||
callback periodic soft 50 unlocked
|
||||
callback periodic soft 25 unlocked
|
||||
callback periodic soft 25 unlocked
|
||||
callback periodic hard 50 locked
|
||||
callback periodic hard 50 locked
|
||||
callback periodic hard 50 locked
|
||||
callback periodic hard 50 locked
|
||||
callback periodic hard 25 locked
|
||||
callback periodic hard 25 locked
|
||||
Reference in New Issue
Block a user