-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from brainelectronics/feature/initial-implement…
…ation Initial implementation
- Loading branch information
Showing
42 changed files
with
2,654 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[flake8] | ||
ignore = | ||
E501 | ||
W504 | ||
exclude = | ||
.git, | ||
.venv, | ||
__pycache__, | ||
docs/source/conf.py, | ||
old, | ||
build, | ||
dist, | ||
modules, | ||
setup, | ||
thinking |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
# custom, package specific ignores | ||
.DS_Store | ||
.DS_Store? | ||
pymakr.conf | ||
tests/ | ||
config/config*.py | ||
thinking/ | ||
*.bin | ||
.idea | ||
*.bak | ||
|
||
*.o | ||
|
||
.vagrant/ | ||
|
||
# meson files under development | ||
untitled.meson.build | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
# micropython libs are stored in lib/ | ||
# lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
*.sqlite3 | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
.pybuilder/ | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
# For a library or package, you might want to ignore these files since the code is | ||
# intended to run in multiple environments; otherwise, check them in: | ||
# .python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,124 @@ | ||
# micropython-nextion | ||
Control Nextion displays using Micropython | ||
# MicroPython Nextion library | ||
|
||
[![Downloads](https://pepy.tech/badge/micropython-nextion)](https://pepy.tech/project/micropython-nextion) | ||
![Release](https://img.shields.io/github/v/release/brainelectronics/micropython-nextion?include_prereleases&color=success) | ||
![MicroPython](https://img.shields.io/badge/micropython-Ok-green.svg) | ||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) | ||
|
||
MicroPython Nextion library | ||
|
||
--------------- | ||
|
||
## General | ||
|
||
Ported library to interact with [Nextion serial displays][ref-nextion-wiki], | ||
based on the [ITEAD Arduino Nextion][ref-itead-nextion-github] library. | ||
|
||
## Installation | ||
|
||
### Install required tools | ||
|
||
Python3 must be installed on your system. Check the current Python version | ||
with the following command | ||
|
||
```bash | ||
python --version | ||
python3 --version | ||
``` | ||
|
||
Depending on which command `Python 3.x.y` (with x.y as some numbers) is | ||
returned, use that command to proceed. | ||
|
||
```bash | ||
python3 -m venv .venv | ||
source .venv/bin/activate | ||
|
||
pip install -r requirements.txt | ||
``` | ||
|
||
## Setup | ||
|
||
### Install package with upip | ||
|
||
Connect the MicroPython device to a network (if possible) | ||
|
||
```python | ||
import network | ||
station = network.WLAN(network.STA_IF) | ||
station.connect('SSID', 'PASSWORD') | ||
station.isconnected() | ||
``` | ||
|
||
and install this lib on the MicroPython device like this | ||
|
||
```python | ||
import upip | ||
upip.install('micropython-nextion') | ||
``` | ||
|
||
### Manually | ||
|
||
#### Upload files to board | ||
|
||
Copy the module to the MicroPython board and import them as shown below | ||
using [Remote MicroPython shell][ref-remote-upy-shell] | ||
|
||
Open the remote shell with the following command. Additionally use `-b 115200` | ||
in case no CP210x is used but a CH34x. | ||
|
||
```bash | ||
rshell --port /dev/tty.SLAB_USBtoUART --editor nano | ||
``` | ||
|
||
Perform the following command to copy all files and folders to the device | ||
|
||
```bash | ||
mkdir /pyboard/lib | ||
mkdir /pyboard/lib/nextion | ||
|
||
cp nextion/* /pyboard/lib/nextion | ||
|
||
cp examples/main.py /pyboard | ||
cp examples/boot.py /pyboard | ||
``` | ||
|
||
### Install additional MicroPython packages | ||
|
||
To use this package with the provided [`boot.py`](examples/boot.py) and one of | ||
the `main.py` files of an [example subfolder](examples/), the additional | ||
module `ulogging` is required. | ||
|
||
Either install the required package(s) using `upip` as follows after | ||
connecting to a WiFi network: | ||
|
||
```python | ||
# network connection already established | ||
|
||
import upip | ||
upip.install('micropython-ulogging') | ||
``` | ||
|
||
or copy it manually to the MicroPython board using e.g. `rshell`: | ||
|
||
```bash | ||
mkdir /pyboard/lib | ||
|
||
cp -r libs_external/* /pyboard/lib | ||
``` | ||
|
||
## Usage | ||
|
||
Use one of the [examples](examples/) to get started. Read also the | ||
[examples README](examples/README.md) to find all supported elements | ||
|
||
## Credits | ||
|
||
Big thank you to [ITEAD Studio][ref-itead-github] for the implementation | ||
of the Arduino library. | ||
|
||
<!-- Links --> | ||
[ref-nextion-wiki]: https://wiki.iteadstudio.com/Nextion_HMI_Solution | ||
[ref-itead-nextion-github]: https://github.com/itead/ITEADLIB_Arduino_Nextion | ||
[ref-remote-upy-shell]: https://github.com/dhylands/rshell | ||
[ref-github-be-mircopython-modules]: https://github.com/brainelectronics/micropython-modules | ||
[ref-itead-github]: https://github.com/itead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
<!-- | ||
## [x.y.z] - yyyy-mm-dd | ||
### Added | ||
### Changed | ||
### Removed | ||
### Fixed | ||
--> | ||
|
||
## Released | ||
## [0.1.0] - 2022-07-21 | ||
### Added | ||
- This changelog file | ||
- [`.gitignore`](.gitignore) file | ||
- [`.flake8`](.flake8) file | ||
- [`setup.py`](setup.py) and [`sdist_upip.py`](sdist_upip.py) files for PyPi | ||
package creation and deploy | ||
- [`LICENSE`](LICENSE) file | ||
- [`requirements.txt`](requirements.txt) file to setup tools for board | ||
interactions | ||
- [`README`](README.md) file with usage instructions | ||
- Initial [`nextion`](nextion) library with basic element function support | ||
- Example [`boot.py`](examples/boot.py) and | ||
[`boot_wifi.py`](examples/boot_wifi.py) files | ||
- [Examples](examples) for all [supported Nextion elements](examples/README.md) | ||
- [Example HMI file](examples/everything.HMI) to be used for all examples | ||
|
||
<!-- Links --> | ||
[Unreleased]: https://github.com/brainelectronics/micropython-nextion/compare/0.1.0...develop | ||
|
||
[0.1.0]: https://github.com/brainelectronics/micropython-nextion/tree/0.1.0 | ||
|
||
<!-- | ||
[ref-issue-1]: https://github.com/brainelectronics/micropython-nextion/issues/1 | ||
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
## Examples Overview | ||
|
||
| Example | Nextion name | Supported | | ||
| ------------------------- | ------------- | ------------------ | | ||
| [Button](button) | NexButton | :heavy_check_mark: | | ||
| [Checkbox](checkbox) | NexCheckbox | :heavy_check_mark: | | ||
| [Crop](crop) | NexCrop | :x: | | ||
| [DualButton](dual_button) | NexDual | :heavy_check_mark: | | ||
| [Gauge](gauge) | NexGauge | :heavy_check_mark: | | ||
| [Gpio](gpio) | NexGpio | :x: | | ||
| [Hardware](hardware) | NexHardware | :heavy_check_mark: | | ||
| [Hotspot](hotspot) | NexHotspot | :x: | | ||
| [Number](number) | NexNumber | :heavy_check_mark: | | ||
| [Page](page) | NexPage | :heavy_check_mark: | | ||
| [Picture](picture) | NexPicture | :x: | | ||
| [Progress](progress) | NexProgress | :heavy_check_mark: | | ||
| [Radio](radio) | NexRadio | :heavy_check_mark: | | ||
| [Rtc](rtc) | NexRtc | :x: | | ||
| [Scrolltext](scrolltext) | NexScrolltext | :x: | | ||
| [Slider](slider) | NexSlider | :heavy_check_mark: | | ||
| [Text](text) | NexText | :heavy_check_mark: | | ||
| [Timer](timer) | NexTimer | :x: | | ||
| [Touch](touch) | NexTouch | :x: | | ||
| [Upload](upload) | NexUpload | :x: | | ||
| [Variable](variable) | NexVariable | :x: | | ||
| [waveform](waveform) | NexWaveform | :heavy_check_mark: | | ||
|
||
<!-- https://www.webfx.com/tools/emoji-cheat-sheet/ --> | ||
|
||
## Basic example | ||
|
||
The [basic example](basic/main.py) shows the usage of all supported Nextion | ||
elements by simple UART command calls. |
Oops, something went wrong.