@@ -87,7 +87,8 @@ typedef enum {
8787#ifdef BLUETOOTH
8888 EV_BLUETOOTH_PENDING , // Tasks that came from the Bluetooth Stack in an IRQ
8989#endif
90- EV_CUSTOM , ///< Custom event (See IOCustomEventFlags)
90+ EV_RUN_INTERRUPT_JS , ///< Run some JavaScript code. See EXEC_RUN_INTERRUPT_JS. data is JsVarRef of code to run
91+ EV_CUSTOM , ///< Custom event (First byte is IOCustomEventFlags to determine the event type)
9192#ifdef BANGLEJS
9293 EV_BANGLEJS , // sent whenever Bangle.js-specific data needs to be queued
9394#endif
@@ -131,10 +132,13 @@ typedef enum {
131132/** Event types for EV_CUSTOM */
132133typedef enum {
133134 EVC_NONE ,
135+ EVC_TIMER_FINISHED ,
136+ EVC_TIMER_BUFFER_FLIP ,
134137#ifdef NRF52_SERIES
135138 EVC_LPCOMP , // jswrap_espruino: E.setComparator / E.on("comparator" event
136139#endif
137140 EVC_TYPE_MASK = 255 ,
141+ EVC_DATA_SHIFT = 8 ,
138142 EVC_DATA_LPCOMP_UP = 256
139143} PACKED_FLAGS IOCustomEventFlags ;
140144
@@ -185,6 +189,8 @@ typedef enum {
185189
186190/// Push an IO event (max IOEVENT_MAX_LEN) into the ioBuffer (designed to be called from IRQ), returns true on success, Calls jshHadEvent();
187191bool CALLED_FROM_INTERRUPT jshPushEvent (IOEventFlags evt , uint8_t * data , unsigned int length );
192+ /// Push a Custom IO event into the ioBuffer (designed to be called from IRQ), returns true on success, Calls jshHadEvent();
193+ bool CALLED_FROM_INTERRUPT jshPushCustomEvent (IOCustomEventFlags customFlags );
188194/// Add this IO event to the IO event queue. Calls jshHadEvent();
189195void jshPushIOEvent (IOEventFlags channel , JsSysTime time );
190196/// Signal an IO watch event as having happened. Calls jshHadEvent();
@@ -196,7 +202,7 @@ void jshPushIOCharEvents(IOEventFlags channel, char *data, unsigned int count);
196202
197203/// pop an IO event, returns EV_NONE on failure. data must be IOEVENT_MAX_LEN bytes
198204IOEventFlags jshPopIOEvent (uint8_t * data , unsigned int * length );
199- // pop an IO event of type eventType, returns true on success. data must be IOEVENT_MAX_LEN bytes
205+ // pop an IO event of type eventType, returns event type on success,EV_NONE on failure . data must be IOEVENT_MAX_LEN bytes
200206IOEventFlags jshPopIOEventOfType (IOEventFlags eventType , uint8_t * data , unsigned int * length );
201207/// Do we have any events pending? Will jshPopIOEvent return true?
202208bool jshHasEvents ();
0 commit comments