This is the sdk branch that integrates uLisp with BL602 IoT SDK. Read the article...
We expose a C function from BL602 IoT SDK like so: ulisp.c
// Expose the C function `bl_gpio_output_set` to uLisp:
// `int bl_gpio_output_set(uint8_t pin, uint8_t value)`
object *fn_bl_gpio_output_set(object *args, object *env) {
// Fetch the `pin` parameter from uLisp
assert(args != NULL);
int pin = checkinteger(BL_GPIO_OUTPUT_SET, car(args));
args = cdr(args);
// Fetch the `value` parameter from uLisp
assert(args != NULL);
int value = checkinteger(BL_GPIO_OUTPUT_SET, car(args));
args = cdr(args);
// No more parameters
assert(args == NULL);
// Call the C function `bl_gpio_output_set`
int result = bl_gpio_output_set(pin, value);
// Return the result to uLisp
return number(result);
}Which will be called from uLisp like so...
( bl_gpio_output_set 11 0 )
What if we...
-
Compile the uLisp Interpreter to WebAssembly...
-
Use the WebAssembly version of uLisp to simulate BL602 in a Web Browser...
(Including GPIO, I2C, SPI, Display Controller, Touch Controller, LoRaWAN... Similar to this)
-
Integrate the BL602 Emulator with Blockly...
-
To allow embedded developers to preview their BL602 Blockly Apps in the Web Browser?
Let's try this out here with the wasm branch of ulisp-bl602
The BL602 Simulator also works with Blockly to preview for dragged-and-dropped uLisp Blockly Apps...
Check this Twitter Thread for updates...
-
src/ulisp.c: uLisp Interpreter for BL602 and WebAssembly, ported from uLisp for ESP32 -
wasm/wasm.c: WebAssembly integration for uLisp (JSON Stream for Simulation Events) -
docs/ulisp.html: HTML file with JavaScript that invokes uLisp WebAssembly for REPL -
wasm.mk: Build uLisp WebAssembly with Emscripten
To build uLisp for WebAssembly with Emscripten...
make -f wasm.mkThe compiled files ulisp.js and ulisp.wasm will be copied to docs.
To test, run a local web server and browse to docs/ulisp.html.
(WebAssembly requires a local web server, it won't run from the local filesystem)
A version of the Lisp programming language for BL602 RISC-V boards.
Read the article...
uLisp was ported to BL602 from ESP32 Arduino...
https://github.com/technoblogy/ulisp-esp
BL602 uLisp Firmware sdk_app_ulisp is located here...
https://github.com/lupyuen/bl_iot_sdk/tree/ulisp/customer_app/sdk_app_ulisp
For more information about uLisp...

