We use pre-commit
and clang-format
to maintain code style.
Use pip install pre-commit
to install pre-commit
in your Python environment.
Run pre-commit install
in the project root directory to initialize the hook. This prepares you an independent clang-format
to use.
After you stage the changes and before you issue a commit:
- Run
pre-commit run clang-format
to check the code style. - Files not conforming to the style will be changed (you will see a FAIL). Please check and stage these new changes.
- Now you can issue the commit. Please adhere to the message format.
When making commits, try to use commitizen or its other implementations (e.g., vsc-commitizen in VS Code).
Or, if you make commits manually, try to adhere to the format of <TYPE>(<SCOPE>): <SHORT and IMPERATIVE summary, lower case, no period>
<TYPE>
is one of the following describing the nature of the commit:
<SCOPE>
is optional but highly recommended for feat
! Some scopes you would expect in this project are:
core
: core logic, HAL stuff, interrupts, peripherals, utilities, etc.display
: LCD driver, lvgl library, etc.home
: home screenchat
: chat componentcalc
: calculator componentalbum
: album component
Good examples are:
feat(display): optimize LCD flush
feat(calc): add calculator app
build: add define for lvgl
We utilize AT24C02 EEPROM to store the calibration data. The calibration will be called up when
- EEPROM does not contain history calibration data.
KEY0
is pressed when the board starts.
The calibration result will be stored back to EEPROM.
The UI designer is powered by SquareLine Studio.
The UI project is located at ./SquareLine
. Please use SquareLine Studio to open the project through watch_ui.spj
.
Configure the export path in File -> Project Settings
. Set both Project Export Root
and UI File Export Root
to the SquareLine/export
directory. This is where the UI files are generated.
Please make sure to click Export -> Export UI Files
to export all UI files if:
- This is the first time you configure the project.
- UI has been updated inside
SquareLine Studio
.
The STM32 project build system will automatically import these files. The import script ./SquareLine/install_ui.py
is run in STM32 build system using executable named python
in default system path.
- On Windows you need to add
python.exe
to the system path. - On Unix system you need to ensure the default
$PATH
(not the one you customize for you shell) containspython
. You may need to add a soft link ofpython3
in/usr/local/bin
.
Implement callback functions and interaction with UIs in Core/Src/port/sl_ui.c
If you encounter "Build Error" after git pull
that updates the STM32 project, consider Close Project
then Open Project
, then retry it.