Go to file
Reinhold Gschweicher 7194e3e38e SpiNorFlash: use C++ style struct in C++ only header
`SpiNorFlash.h` is a C++ header, but the `Identification` struct is
created in a C style using `typedef struct`. Clang issues a warining
about this discrepancy:

```
In file included from /home/nero/repos/pinetime/InfiniSim/InfiniTime/src/systemtask/SystemTask.cpp:13:
/home/nero/repos/pinetime/InfiniSim/sim/drivers/SpiNorFlash.h:16:21: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
      typedef struct __attribute__((packed)) {
                    ^
                     Identification
/home/nero/repos/pinetime/InfiniSim/sim/drivers/SpiNorFlash.h:17:9: note: type is not C-compatible due to this default member initializer
        uint8_t manufacturer = 0;
        ^~~~~~~~~~~~~~~~~~~~
/home/nero/repos/pinetime/InfiniSim/sim/drivers/SpiNorFlash.h:20:9: note: type is given name 'Identification' for linkage purposes by this typedef declaration
      } Identification;
        ^
1 warning generated.
```

The easy fix is to use a C++ style struct.

Same fix as in: https://github.com/InfiniTimeOrg/InfiniTime/pull/1046
2022-04-24 19:13:56 +02:00
.github/workflows Initial InfiniSim project 2022-02-17 22:57:08 +01:00
cmake Initial InfiniSim project 2022-02-17 22:57:08 +01:00
InfiniTime@b498e1d633 Update InfiniTime to 1.9.0 development branch 2022-04-02 17:56:09 +02:00
libpng@a37d483651 main: implement saveScreenshot() writing bmp/png from SDL window buffer 2022-03-08 21:39:16 +01:00
lv_drivers@8c96359f41 Initial InfiniSim project 2022-02-17 22:57:08 +01:00
sim SpiNorFlash: use C++ style struct in C++ only header 2022-04-24 19:13:56 +02:00
.gitignore init 2022-02-16 21:19:37 +01:00
.gitmodules Use relative path for libpng submodule, don't force ssh/http 2022-03-08 21:48:55 +01:00
CMakeLists.txt cmake: create QCBOR target and link to InfiniSim 2022-04-08 11:26:30 +02:00
LICENSE Initial InfiniSim project 2022-02-17 22:57:08 +01:00
lv_drv_conf.h fix compile error by removing static_assert 2022-03-30 22:13:58 +02:00
main.cpp Fix libpng submodule usage 2022-04-03 21:35:09 +02:00
README.md doc: add fedora required packages 2022-04-02 23:12:02 +02:00

InfiniSim

Build InfiniSim LVGL Simulator

Simulator for InfiniTime project.

Experience the InfiniTime user interface directly on your PC, to shorten the time until you get your hands on a real PineTime smartwatch. Or use it to develop new Watchfaces, new Screens, or quickly iterate on the user interface.

For a history on how this simulator started and the challenges on its way visit the original PR.

Build dependencies

  • CMake
  • SDL2 (provides the simulator window, handles mouse and keyboard input)
  • Compiler (g++ or clang++)

On Ubuntu/Debian install the following packages:

sudo apt install -y cmake libsdl2-dev g++

On Arch Linux the following packages are needed:

sudo pacman -S cmake sdl2 gcc

On Fedora the following packages are needed:

sudo dnf install cmake SDL2-devel gcc

Get the Sources

Clone this repository and tell git to recursively download the submodules as well

git clone --recursive https://github.com/InfiniTimeOrg/InfiniSim.git

If you've already cloned the repository without the submodules (or you want to update them to the latest checked in version) run the following command:

git submodule update --init --recursive

Configure and Build

In the most basic configuration tell cmake to configure the project and build it with the following two commands:

cmake -S . -B build
cmake --build build -j4

The following configuration settings can be added to the first cmake -S . -B build call

  • -DInfiniTime_DIR=InfiniTime: a full path to an existing InfiniTime repository checked out. Inside that directory the src/libs/lvgl submodule must be checked out as well. The default value points to the InfiniTime submodule in this repository.
  • -DMONITOR_ZOOM=1: scale simulator window by this factor

Run Simulator

When the build was successful the simulator binary can be started with

./build/infinisim

Running Simulator

To hide the second simulator-status-window start the binary with the --hide-status option

./build/infinisim --hide-status
  • Left mouse button: simulates your finger, just click to tap, click and drag to swipe
  • Right mouse button: simulates the hardware button (for example turn the screen off or on again)

Using the keyboard the following events can be triggered:

  • r ... enable ringing
  • R ... disable ringing
  • m ... let motor run for 100 ms
  • M ... let motor run for 255 ms
  • n ... send notification
  • N ... clear all notifications
  • b ... connect Bluetooth
  • B ... disconnect Bluetooth
  • v ... increase battery voltage and percentage
  • V ... decrease battery voltage and percentage
  • c ... charging,
  • C ... not charging
  • l ... increase brightness level
  • L ... lower brightness level
  • p ... enable print lvgl memory usage to terminal
  • P ... disable print memory usage
  • s ... increase step count by 500 steps
  • S ... decrease step count by 500 steps
  • h ... set heartrate running, and on further presses increase by 10 bpm
  • H ... stop heartrate
  • i ... take screenshot

Licenses

This project is released under the GNU General Public License version 3 or, at your option, any later version. The same license as InfiniTime.

The simulator is based on lv_sim_eclipse_sdl project under the MIT license.