mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
Revert to micropython_port_should_interrupt
This commit is contained in:
@@ -4,15 +4,13 @@ extern "C" {
|
||||
#include "mphalport.h"
|
||||
}
|
||||
|
||||
bool micropython_port_should_interrupt(bool force) {
|
||||
bool micropython_port_should_interrupt() {
|
||||
static int c = 0;
|
||||
if(!force) {
|
||||
c++;
|
||||
if (c%20000 != 0) {
|
||||
return false;
|
||||
}
|
||||
c = 0;
|
||||
c++;
|
||||
if (c%20000 != 0) {
|
||||
return false;
|
||||
}
|
||||
c = 0;
|
||||
Ion::Keyboard::State scan = Ion::Keyboard::scan();
|
||||
if (scan.keyDown((Ion::Keyboard::Key)mp_interrupt_char)) {
|
||||
mp_keyboard_interrupt();
|
||||
|
||||
@@ -8,7 +8,7 @@ extern "C" {
|
||||
|
||||
/* should_interrupt effectively does something once every 20000 calls. It checks
|
||||
* if a key is down to raise an interruption flag. */
|
||||
bool micropython_port_should_interrupt(bool);
|
||||
bool micropython_port_should_interrupt();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
// (This scheme won't work if we want to mix Thumb and normal ARM code.)
|
||||
#define MICROPY_MAKE_POINTER_CALLABLE(p) (p)
|
||||
|
||||
#define MICROPY_VM_HOOK_LOOP micropython_port_should_interrupt(false);
|
||||
#define MICROPY_VM_HOOK_LOOP micropython_port_should_interrupt();
|
||||
|
||||
typedef intptr_t mp_int_t; // must be pointer size
|
||||
typedef uintptr_t mp_uint_t; // must be pointer size
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
void delay_ms(mp_uint_t delay) {
|
||||
uint32_t start = millis();
|
||||
while (millis() - start < delay && !micropython_port_should_interrupt(true)) {
|
||||
while (millis() - start < delay && !micropython_port_should_interrupt()) {
|
||||
msleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user