Skip to content

semitov/SemiTOV-MCL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SemiTO-V MicroPython Compatibility Layer

"MCL" (MicroPython Compatibility Layer) library allowing inclusion of MicroPython code targeting MCUs within CPython. Made for RISC-V based RP2350 GPIO Expansion Card for Framework Laptops. Works well with any MCU that supports MicroPython connected to RISC-V, ARM and X86 PCs.

Requirements

How to build

Clone the repository:

git clone https://github.com/semitov/SemiTOV-MCL.git

Sync the project (creates virtual environment and installs dependencies):

cd SemiTOV-MCL
uv sync

Install the package:

uv pip install -e .

How to run

uv run examples/<script_name.py>

How to use

from mcl import Board

Add a module

board = Board("/dev/ttyACM0", baudrate=115200)
board.add_import("machine")
board.add_import("Pin", from_module="machine")

Set a variable

After creating (or setting) a variable you will be able to use it as a normal one.

led = board.set_variable("led", "Pin(10, Pin.OUT)")
led.value(1)

See more examples here.

Development

Run tests:

uv run pytest

Serial Port Permissions (Linux)

If you encounter a "Permission denied" error when accessing /dev/ttyACM0, add your user to the dialout group:

sudo usermod -a -G dialout $USER

Important: You must log out and log back in (or reboot) for the changes to take effect.

To verify the change:

groups $USER

How to contribute

In order to contribute, first check the opened issues and choose one.

All the new code that fixes something or implements a new feature must be pushed on a new branch with the name of the issue that is fixing.

Only after it will be merged into the main branch.

If you want to push new code and no issue match with it, create a new one first.

About

A compatibility layer between MicroPython and Python.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages