![](https://github.com/freewili/freewili-python/raw/master/logo.png)
# FreeWili
FreeWili is a Python library for controlling and communicating with FreeWili boards.
## Installation
You can install freewili using pip by running the following command:
```
pip install freewili
```
## Python script example
### Toggle LED 25:
```python
import time
import freewili
devices = freewili.find_all()
device = devices[0]
led_state: bool = True
device.stay_open = True
for _ in range(100):
device.set_io(25, led_state)
led_state ^= True
time.sleep(0.1)
```
### Poll I2C:
```python
import freewili
devices = freewili.find_all()
device = devices[0]
print(device.poll_i2c())
```
```bash
Ok([1, 2])
```
## fwi-serial command line usage
```
usage: fwi-serial [-h] [-l] [-i INDEX] [-di DISPLAY_INDEX] [-mi MAIN_INDEX] [-s SEND_FILE] [-fn FILE_NAME] [-u GET_FILE GET_FILE] [-w [RUN_SCRIPT]] [-io SET_IO SET_IO] [--version]
options:
-h, --help show this help message and exit
-l, --list List all FreeWili connected to the computer.
-i INDEX, --index INDEX
Select a specific FreeWili by index. The first FreeWili is 1.
-di DISPLAY_INDEX, --display_index DISPLAY_INDEX
Select a specific FreeWili display processor by index. The first FreeWili is 1.
-mi MAIN_INDEX, --main_index MAIN_INDEX
Select a specific FreeWili main processor by index. The first FreeWili is 1.
-s SEND_FILE, --send_file SEND_FILE
send a file to the FreeWili. Argument should be in the form of: <source_file>
-fn FILE_NAME, --file_name FILE_NAME
Set the name of the file in the FreeWili. Argument should be in the form of: <file_name>
-u GET_FILE GET_FILE, --get_file GET_FILE GET_FILE
Get a file from the FreeWili. Argument should be in the form of: <source_file> <target_name>
-w [RUN_SCRIPT], --run_script [RUN_SCRIPT]
Run a script on the FreeWili. If no argument is provided, -fn will be used.
-io SET_IO SET_IO, --set_io SET_IO SET_IO
Toggle IO pin to high. Argument should be in the form of: <io_pin> <high/low>
--version show program's version number and exit
```
### Send file from host to freewili:
```bash
$ fwi-serial -d /path/to/bin.wasm /scripts/bin.wasm
```
### Run script on the freewili:
```bash
$ fwi-serial -w bin.wasm
```
### Set IO on the freewili:
```bash
$ fwi-serial -io 25 high
```
### Convert JPEG or PNG file to FWI
```bash
$ fwi-convert -i ~/Downloads/mypicture.png -o mypicture.fwi
bytearray(b'FW01IMG\x00')
png or JPG file "/home/drebbe/Downloads/mypicture.png" converted to FreeWili image file "mypicture.fwi
$ fwi-serial -di 1 -s mypicture.fwi -fn /images/mypicture.fwi
Downloading mypicture.fwi (81816 bytes) as /images/mypicture.fwi on Display v28 /dev/ttyACM1 @ 1-2.2:1.0
Downloaded mypicture.fwi (81816 bytes) as /images/mypicture.fwi to Display v28 /dev/ttyACM1 @ 1-2.2:1.0
```
## Development
```
pip install poetry
poetry self add "poetry-dynamic-versioning[plugin]"
poetry install
poetry run fwi-serial --help
pre-commit install
```
### Dependencies
#### Installing Python 3.10+
If you don't already have Python 3.10+ installed, you can download it from the official Python website: <https://www.python.org/downloads/>. Follow the installation instructions for your operating system.
#### Installing Poetry
Poetry is a package manager for Python that makes it easy to install and manage the dependencies needed for FreeWili. To install Poetry, follow the instructions at <https://python-poetry.org/docs/#installation>.
#### Installing VSCode
To install VSCode, follow the instructions at <https://code.visualstudio.com/docs/setup/setup-overview>.
#### Installing recommended extensions in VSCode
See https://code.visualstudio.com/docs/editor/extension-marketplace#_recommended-extensions
## License
FreeWili is licensed under the [MIT License](https://opensource.org/licenses/MIT).
Raw data
{
"_id": null,
"home_page": "https://freewili.com/",
"name": "freewili",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "freewili",
"author": "David Rebbe",
"author_email": "drebbe@intrepidcs.com",
"download_url": "https://files.pythonhosted.org/packages/cd/15/966b3b6ea56340d1c0487ca948c85f338529ff0bd67c97ea1b75efebd9b7/freewili-0.0.14.tar.gz",
"platform": null,
"description": "![](https://github.com/freewili/freewili-python/raw/master/logo.png)\n# FreeWili\n\nFreeWili is a Python library for controlling and communicating with FreeWili boards.\n\n## Installation\n\nYou can install freewili using pip by running the following command:\n```\npip install freewili\n```\n## Python script example\n\n### Toggle LED 25:\n```python\n\nimport time\nimport freewili\n\ndevices = freewili.find_all()\ndevice = devices[0]\n\nled_state: bool = True\ndevice.stay_open = True\nfor _ in range(100):\n device.set_io(25, led_state)\n led_state ^= True\n time.sleep(0.1)\n```\n\n### Poll I2C:\n```python\n\nimport freewili\n\ndevices = freewili.find_all()\ndevice = devices[0]\nprint(device.poll_i2c())\n```\n\n```bash\nOk([1, 2])\n```\n\n## fwi-serial command line usage\n\n```\nusage: fwi-serial [-h] [-l] [-i INDEX] [-di DISPLAY_INDEX] [-mi MAIN_INDEX] [-s SEND_FILE] [-fn FILE_NAME] [-u GET_FILE GET_FILE] [-w [RUN_SCRIPT]] [-io SET_IO SET_IO] [--version]\n\noptions:\n -h, --help show this help message and exit\n -l, --list List all FreeWili connected to the computer.\n -i INDEX, --index INDEX\n Select a specific FreeWili by index. The first FreeWili is 1.\n -di DISPLAY_INDEX, --display_index DISPLAY_INDEX\n Select a specific FreeWili display processor by index. The first FreeWili is 1.\n -mi MAIN_INDEX, --main_index MAIN_INDEX\n Select a specific FreeWili main processor by index. The first FreeWili is 1.\n -s SEND_FILE, --send_file SEND_FILE\n send a file to the FreeWili. Argument should be in the form of: <source_file>\n -fn FILE_NAME, --file_name FILE_NAME\n Set the name of the file in the FreeWili. Argument should be in the form of: <file_name>\n -u GET_FILE GET_FILE, --get_file GET_FILE GET_FILE\n Get a file from the FreeWili. Argument should be in the form of: <source_file> <target_name>\n -w [RUN_SCRIPT], --run_script [RUN_SCRIPT]\n Run a script on the FreeWili. If no argument is provided, -fn will be used.\n -io SET_IO SET_IO, --set_io SET_IO SET_IO\n Toggle IO pin to high. Argument should be in the form of: <io_pin> <high/low>\n --version show program's version number and exit\n```\n\n### Send file from host to freewili:\n\n```bash\n$ fwi-serial -d /path/to/bin.wasm /scripts/bin.wasm\n```\n\n### Run script on the freewili:\n\n```bash\n$ fwi-serial -w bin.wasm\n```\n\n### Set IO on the freewili:\n\n```bash\n$ fwi-serial -io 25 high\n```\n\n### Convert JPEG or PNG file to FWI\n```bash\n$ fwi-convert -i ~/Downloads/mypicture.png -o mypicture.fwi\nbytearray(b'FW01IMG\\x00')\npng or JPG file \"/home/drebbe/Downloads/mypicture.png\" converted to FreeWili image file \"mypicture.fwi\n\n$ fwi-serial -di 1 -s mypicture.fwi -fn /images/mypicture.fwi\nDownloading mypicture.fwi (81816 bytes) as /images/mypicture.fwi on Display v28 /dev/ttyACM1 @ 1-2.2:1.0\nDownloaded mypicture.fwi (81816 bytes) as /images/mypicture.fwi to Display v28 /dev/ttyACM1 @ 1-2.2:1.0\n```\n## Development\n\n```\npip install poetry\npoetry self add \"poetry-dynamic-versioning[plugin]\"\npoetry install\npoetry run fwi-serial --help\n\npre-commit install\n```\n\n### Dependencies\n#### Installing Python 3.10+\n\nIf you don't already have Python 3.10+ installed, you can download it from the official Python website: <https://www.python.org/downloads/>. Follow the installation instructions for your operating system.\n\n#### Installing Poetry\n\nPoetry is a package manager for Python that makes it easy to install and manage the dependencies needed for FreeWili. To install Poetry, follow the instructions at <https://python-poetry.org/docs/#installation>.\n\n#### Installing VSCode\n\nTo install VSCode, follow the instructions at <https://code.visualstudio.com/docs/setup/setup-overview>.\n\n\n#### Installing recommended extensions in VSCode\n\nSee https://code.visualstudio.com/docs/editor/extension-marketplace#_recommended-extensions\n\n\n\n## License\nFreeWili is licensed under the [MIT License](https://opensource.org/licenses/MIT).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": null,
"version": "0.0.14",
"project_urls": {
"Homepage": "https://freewili.com/",
"Repository": "https://github.com/freewili/freewili-python"
},
"split_keywords": [
"freewili"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cfd6a746f01d49e7ef4b0f50897879f85455e7ffc6883fd5ac6deb99e3c9a010",
"md5": "43803ae235ef04054f10bf87f12897e6",
"sha256": "a6f1d2af288ae117a2515b16202e65d9f7bb89bdcdc550c4b1c2fcc192613b02"
},
"downloads": -1,
"filename": "freewili-0.0.14-py3-none-any.whl",
"has_sig": false,
"md5_digest": "43803ae235ef04054f10bf87f12897e6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 11650,
"upload_time": "2024-08-28T14:52:39",
"upload_time_iso_8601": "2024-08-28T14:52:39.398327Z",
"url": "https://files.pythonhosted.org/packages/cf/d6/a746f01d49e7ef4b0f50897879f85455e7ffc6883fd5ac6deb99e3c9a010/freewili-0.0.14-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cd15966b3b6ea56340d1c0487ca948c85f338529ff0bd67c97ea1b75efebd9b7",
"md5": "1f760a9530e716f325b69b879caec51e",
"sha256": "494bf2b13101e292525f04c932430b140b0801f6a393bc6590b8eb4890980b4c"
},
"downloads": -1,
"filename": "freewili-0.0.14.tar.gz",
"has_sig": false,
"md5_digest": "1f760a9530e716f325b69b879caec51e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 10704,
"upload_time": "2024-08-28T14:52:40",
"upload_time_iso_8601": "2024-08-28T14:52:40.509761Z",
"url": "https://files.pythonhosted.org/packages/cd/15/966b3b6ea56340d1c0487ca948c85f338529ff0bd67c97ea1b75efebd9b7/freewili-0.0.14.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-28 14:52:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "freewili",
"github_project": "freewili-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "freewili"
}