summaryrefslogtreecommitdiff
path: root/ports/stm32/softtimer.h
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2021-04-27 16:30:58 +1000
committerDamien George <damien@micropython.org>2021-04-29 16:54:35 +1000
commit89b64478c73d2228419e77a4450c004157ec725a (patch)
treeab96181b33c920814e318fc4d3646b1ea3ee77cc /ports/stm32/softtimer.h
parent326dd7f0dbbadc4a536636d486600ce93dade8c5 (diff)
stm32/softtimer: Add support for having a C-based callback.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'ports/stm32/softtimer.h')
-rw-r--r--ports/stm32/softtimer.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/ports/stm32/softtimer.h b/ports/stm32/softtimer.h
index a80d9087b..6e06bbcc6 100644
--- a/ports/stm32/softtimer.h
+++ b/ports/stm32/softtimer.h
@@ -28,15 +28,21 @@
#include "py/pairheap.h"
+#define SOFT_TIMER_FLAG_PY_CALLBACK (1)
+
#define SOFT_TIMER_MODE_ONE_SHOT (1)
#define SOFT_TIMER_MODE_PERIODIC (2)
typedef struct _soft_timer_entry_t {
mp_pairheap_t pairheap;
- uint32_t mode;
+ uint16_t flags;
+ uint16_t mode;
uint32_t expiry_ms;
uint32_t delta_ms; // for periodic mode
- mp_obj_t callback;
+ union {
+ void (*c_callback)(struct _soft_timer_entry_t *);
+ mp_obj_t py_callback;
+ };
} soft_timer_entry_t;
extern volatile uint32_t soft_timer_next;