mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[python] Restore the should_interrupt routine
This commit is contained in:
@@ -182,7 +182,7 @@ python/src/extmod/modurandom.o: SFLAGS += -DMP_QSTR_urandom="MP_QSTR_random"
|
||||
port_objs += $(addprefix python/port/,\
|
||||
port.o \
|
||||
builtins.o\
|
||||
interrupt_helper.o \
|
||||
helpers.o \
|
||||
modkandinsky.o \
|
||||
modkandinsky_impl.o \
|
||||
mphalport.o \
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "interrupt_helper.h"
|
||||
#include "helpers.h"
|
||||
#include <ion.h>
|
||||
extern "C" {
|
||||
#include "mphalport.h"
|
||||
}
|
||||
|
||||
void shouldInterrupt() {
|
||||
void micropython_port_should_interrupt() {
|
||||
static int c = 0;
|
||||
c++;
|
||||
if (c%20000 != 0) {
|
||||
16
python/port/helpers.h
Normal file
16
python/port/helpers.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef PYTHON_PORT_HELPERS_H
|
||||
#define PYTHON_PORT_HELPERS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* should_interrupt effectively does something once every 20000 calls. It checks
|
||||
* if a key is down to raise an interruption flag. */
|
||||
void micropython_port_should_interrupt();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,17 +0,0 @@
|
||||
#ifndef PYTHON_INTERRUPT_HELPER_H
|
||||
#define PYTHON_INTERRUPT_HELPER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* shouldInterrupt effectively does something once every 20000 calls. It checks
|
||||
* if a key is down to raise an interruption flag. */
|
||||
|
||||
void shouldInterrupt();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <stdint.h>
|
||||
#include "helpers.h"
|
||||
|
||||
// options to control how Micro Python is built
|
||||
|
||||
@@ -55,6 +56,8 @@
|
||||
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
|
||||
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
|
||||
|
||||
#define MICROPY_VM_HOOK_LOOP micropython_port_should_interrupt();
|
||||
|
||||
// type definitions for the specific machine
|
||||
|
||||
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p) | 1))
|
||||
|
||||
Reference in New Issue
Block a user