Files
Upsilon/python/port/helpers.cpp
2018-11-09 01:30:22 +01:00

23 lines
421 B
C++

#include "helpers.h"
#include <ion.h>
extern "C" {
#include "mphalport.h"
}
bool micropython_port_should_interrupt(bool force) {
static int c = 0;
if(!force) {
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();
return true;
}
return false;
}