kopia lustrzana https://github.com/micropython/micropython
Porównaj commity
4 Commity
e411716379
...
738e4d043c
Autor | SHA1 | Data |
---|---|---|
Engineer_Will | 738e4d043c | |
Damien George | 9c7f0659e2 | |
Damien George | 45848f77ca | |
EngWill | 3946cf52b5 |
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"deploy": [
|
||||
"../deploy.md"
|
||||
],
|
||||
"docs": "",
|
||||
"features": [
|
||||
"Dual-core",
|
||||
"Battery Charging",
|
||||
"External Flash",
|
||||
"Display",
|
||||
"USB-C"
|
||||
],
|
||||
"images": [
|
||||
"rp2040-lcd-0.96-1.jpg"
|
||||
],
|
||||
"mcu": "rp2040",
|
||||
"product": "Waveshare RP2040-LCD-0.96",
|
||||
"thumbnail": "",
|
||||
"url": "https://www.waveshare.com/product/rp2040-lcd-0.96.htm",
|
||||
"vendor": "Waveshare"
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
# cmake file for Waveshare RP2040-LCD-0.96
|
||||
set(PICO_BOARD waveshare_rp2040_lcd_0.96)
|
|
@ -0,0 +1,12 @@
|
|||
// url : https://www.waveshare.com/product/rp2040-lcd-0.96.htm
|
||||
// wiki : https://www.waveshare.com/wiki/RP2040-LCD-0.96
|
||||
// Board and hardware specific configuration
|
||||
#define MICROPY_HW_BOARD_NAME "Waveshare RP2040-LCD-0.96"
|
||||
#define MICROPY_HW_FLASH_STORAGE_BYTES (1408 * 1024)
|
||||
|
||||
#define MICROPY_HW_USB_VID (0x2E8A)
|
||||
#define MICROPY_HW_USB_PID (0x1021)
|
||||
|
||||
#define MICROPY_HW_SPI1_SCK (10u)
|
||||
#define MICROPY_HW_SPI1_MOSI (11u)
|
||||
#define MICROPY_HW_SPI1_MISO (8u)
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"deploy": [
|
||||
"../deploy.md"
|
||||
],
|
||||
"docs": "",
|
||||
"features": [
|
||||
"Dual-core",
|
||||
"Battery Charging",
|
||||
"External Flash",
|
||||
"USB-C"
|
||||
],
|
||||
"images": [
|
||||
"rp2040-plus-1.jpg"
|
||||
],
|
||||
"mcu": "rp2040",
|
||||
"product": "Waveshare RP2040-Plus",
|
||||
"thumbnail": "",
|
||||
"url": "https://www.waveshare.com/rp2040-plus.htm",
|
||||
"vendor": "Waveshare"
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
# cmake file for Waveshar RP2040-Plus
|
||||
set(PICO_BOARD waveshare_rp2040_plus_16mb)
|
|
@ -0,0 +1,8 @@
|
|||
// url : https://www.waveshare.com/product/rp2040-plus.htm
|
||||
// wiki : https://www.waveshare.com/wiki/RP2040-Plus
|
||||
// Board and hardware specific configuration
|
||||
#define MICROPY_HW_BOARD_NAME "Waveshare RP2040-Plus"
|
||||
#define MICROPY_HW_FLASH_STORAGE_BYTES (15 * 1024 * 1024)
|
||||
|
||||
#define MICROPY_HW_USB_VID (0x2E8A)
|
||||
#define MICROPY_HW_USB_PID (0x1020)
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"deploy": [
|
||||
"../deploy.md"
|
||||
],
|
||||
"docs": "",
|
||||
"features": [
|
||||
"Dual-core",
|
||||
"Battery Charging",
|
||||
"External Flash",
|
||||
"USB-C"
|
||||
],
|
||||
"images": [
|
||||
"rp2040-plus-1.jpg"
|
||||
],
|
||||
"mcu": "rp2040",
|
||||
"product": "Waveshare RP2040-Plus",
|
||||
"thumbnail": "",
|
||||
"url": "https://www.waveshare.com/rp2040-plus.htm",
|
||||
"vendor": "Waveshare"
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
# cmake file for Waveshar RP2040-Plus
|
||||
set(PICO_BOARD waveshare_rp2040_plus_4mb)
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// url : https://www.waveshare.com/product/rp2040-plus.htm
|
||||
// wiki : https://www.waveshare.com/wiki/RP2040-Plus
|
||||
// Board and hardware specific configuration
|
||||
#define MICROPY_HW_BOARD_NAME "Waveshare RP2040-Plus"
|
||||
#define MICROPY_HW_FLASH_STORAGE_BYTES (3 * 1024 * 1024)
|
||||
|
||||
#define MICROPY_HW_USB_VID (0x2E8A)
|
||||
#define MICROPY_HW_USB_PID (0x1020)
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"deploy": [
|
||||
"../deploy.md"
|
||||
],
|
||||
"docs": "",
|
||||
"features": [
|
||||
"Dual-core",
|
||||
"External Flash",
|
||||
"USB-C"
|
||||
],
|
||||
"images": [
|
||||
"rp2040-zero-1.jpg"
|
||||
],
|
||||
"mcu": "rp2040",
|
||||
"product": "Waveshare RP2040-Zero",
|
||||
"thumbnail": "",
|
||||
"url": "https://www.waveshare.com/product/rp2040-zero.htm",
|
||||
"vendor": "Waveshare"
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
# cmake file for Waveshar RP2040-Zero
|
||||
set(PICO_BOARD waveshare_rp2040_zero)
|
|
@ -0,0 +1,8 @@
|
|||
// url : https://www.waveshare.com/product/rp2040-zero.htm
|
||||
// wiki : http://www.waveshare.com/wiki/RP2040-Zero
|
||||
// Board and hardware specific configuration
|
||||
#define MICROPY_HW_BOARD_NAME "Waveshare RP2040-Zero"
|
||||
#define MICROPY_HW_FLASH_STORAGE_BYTES (1408 * 1024)
|
||||
|
||||
#define MICROPY_HW_USB_VID (0x2E8A)
|
||||
#define MICROPY_HW_USB_PID (0x101F)
|
|
@ -38,7 +38,7 @@ export async function loadMicroPython(options) {
|
|||
{ heapsize: 1024 * 1024, linebuffer: true },
|
||||
options,
|
||||
);
|
||||
const Module = {};
|
||||
let Module = {};
|
||||
Module.locateFile = (path, scriptDirectory) =>
|
||||
url || scriptDirectory + path;
|
||||
Module._textDecoder = new TextDecoder();
|
||||
|
@ -83,11 +83,7 @@ export async function loadMicroPython(options) {
|
|||
Module.stderr = (c) => stderr(new Uint8Array([c]));
|
||||
}
|
||||
}
|
||||
const moduleLoaded = new Promise((r) => {
|
||||
Module.postRun = r;
|
||||
});
|
||||
_createMicroPythonModule(Module);
|
||||
await moduleLoaded;
|
||||
Module = await _createMicroPythonModule(Module);
|
||||
globalThis.Module = Module;
|
||||
proxy_js_init();
|
||||
const pyimport = (name) => {
|
||||
|
@ -131,23 +127,31 @@ export async function loadMicroPython(options) {
|
|||
},
|
||||
pyimport: pyimport,
|
||||
runPython(code) {
|
||||
const len = Module.lengthBytesUTF8(code);
|
||||
const buf = Module._malloc(len + 1);
|
||||
Module.stringToUTF8(code, buf, len + 1);
|
||||
const value = Module._malloc(3 * 4);
|
||||
Module.ccall(
|
||||
"mp_js_do_exec",
|
||||
"number",
|
||||
["string", "pointer"],
|
||||
[code, value],
|
||||
["pointer", "number", "pointer"],
|
||||
[buf, len, value],
|
||||
);
|
||||
Module._free(buf);
|
||||
return proxy_convert_mp_to_js_obj_jsside_with_free(value);
|
||||
},
|
||||
runPythonAsync(code) {
|
||||
const len = Module.lengthBytesUTF8(code);
|
||||
const buf = Module._malloc(len + 1);
|
||||
Module.stringToUTF8(code, buf, len + 1);
|
||||
const value = Module._malloc(3 * 4);
|
||||
Module.ccall(
|
||||
"mp_js_do_exec_async",
|
||||
"number",
|
||||
["string", "pointer"],
|
||||
[code, value],
|
||||
["pointer", "number", "pointer"],
|
||||
[buf, len, value],
|
||||
);
|
||||
Module._free(buf);
|
||||
return proxy_convert_mp_to_js_obj_jsside_with_free(value);
|
||||
},
|
||||
replInit() {
|
||||
|
|
|
@ -104,7 +104,7 @@ void mp_js_do_import(const char *name, uint32_t *out) {
|
|||
}
|
||||
}
|
||||
|
||||
void mp_js_do_exec(const char *src, uint32_t *out) {
|
||||
void mp_js_do_exec(const char *src, size_t len, uint32_t *out) {
|
||||
// Collect at the top-level, where there are no root pointers from stack/registers.
|
||||
gc_collect_start();
|
||||
gc_collect_end();
|
||||
|
@ -112,7 +112,7 @@ void mp_js_do_exec(const char *src, uint32_t *out) {
|
|||
mp_parse_input_kind_t input_kind = MP_PARSE_FILE_INPUT;
|
||||
nlr_buf_t nlr;
|
||||
if (nlr_push(&nlr) == 0) {
|
||||
mp_lexer_t *lex = mp_lexer_new_from_str_len_dedent(MP_QSTR__lt_stdin_gt_, src, strlen(src), 0);
|
||||
mp_lexer_t *lex = mp_lexer_new_from_str_len_dedent(MP_QSTR__lt_stdin_gt_, src, len, 0);
|
||||
qstr source_name = lex->source_name;
|
||||
mp_parse_tree_t parse_tree = mp_parse(lex, input_kind);
|
||||
mp_obj_t module_fun = mp_compile(&parse_tree, source_name, false);
|
||||
|
@ -125,9 +125,9 @@ void mp_js_do_exec(const char *src, uint32_t *out) {
|
|||
}
|
||||
}
|
||||
|
||||
void mp_js_do_exec_async(const char *src, uint32_t *out) {
|
||||
void mp_js_do_exec_async(const char *src, size_t len, uint32_t *out) {
|
||||
mp_compile_allow_top_level_await = true;
|
||||
mp_js_do_exec(src, out);
|
||||
mp_js_do_exec(src, len, out);
|
||||
mp_compile_allow_top_level_await = false;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue