Commit graph

133 commits

Author SHA1 Message Date
Jean-François Milants 63e0c4f4ef Application selection at build time
A list of "user applications" is built at compile time. It contains all the info needed to create the application at runtime (ptr to a create() function) and to display the app in the application menu. All applications declare a TypeTrait with these information.
When a new app must be loaded, DisplayApp first check if this app is a System app (in which case it creates it like it did before). If it's not a System app, it looks for the app in the list of User applications and creates it if it found it.
Those changes allow to more easily add new app and to select which app must be built into the firmware.
Switch to C++20 (and fix a few issues in SpiMaster.cpp and Watchdog.cpp.
2023-11-19 21:13:55 +01:00
Jean-François Milants 8fee341b86 ST7789 : do not reconfigure the reset pin to default during sleep. 2023-06-04 17:22:27 +02:00
Jean-François Milants e224263828 Power optimization - Improve SPI sleep mode
Fix formatting issue in St7789.cpp
2023-06-04 17:22:27 +02:00
Jean-François Milants 9bd90c906e Power optimization - Improve SPI sleep mode
ST7789 driver : replace the constant '26' with a named constant to specify the pin number of the reset pin of the LCD controller.
2023-06-04 17:22:27 +02:00
Jean-François Milants 62848b33fb Power optimization - Improve SPI sleep mode
Calls to Spi::Init() are not needed, pin initialization is already done in ctor().
Remove calls to Spi::Sleep()/Spi::Wakeup() to ensure that SPI CS pins are kept high even in sleep mode.
2023-06-04 17:22:27 +02:00
Jean-François Milants 4c0f897953 Power optimization - Improve SPI sleep mode
Ensure that all pins are set to their default configuration during sleep mode.
Disable the workaround for FTPAN58 (SPI freezes when transfering a single byte) at the end of the transfer. This disables the resources needed for the workaround.
Those changes reduce the power usage by 430-490µA.
2023-06-04 17:22:27 +02:00
Jean-François Milants a48d4e0b13 Power optimization - Enable HRS3300 (heart rate sensor) sleep mode.
Put the HRS3300 to sleep mode when InfiniTime is going to sleep. This change reduces the power consumption by 130µA when the heart rate sensor is disabled.
2023-06-04 17:03:22 +02:00
JF 5f19f689f9
Refactor, document and fix the Watchdog driver (#1710)
* Refactor and document the Watchdog driver to make it more readable.

Fix the configuration of the behaviours configuration that was not properly implemented (but it didn't cause any side effect since the correct value was eventually set in NRF_WDT->CONFIG).

Fix the wrong interpretation of the reset reasons caused by implicit conversions of int to bool.
2023-04-30 15:56:13 +02:00
Ceimour c22e30a4a6
Refactored Ppg for frequency based algorithm. (#1486)
New implementation of the heart rate sensor data processing using a frequency based PPG algorithm.
The HRS3300 settings are fine-tuned for better signal to noise at 10Hz.
The measurement delay is now set to 100ms.
Enable and use the ambient light sensor.
FFT implementation based on ArduinoFFT (https://github.com/kosme/arduinoFFT, GPLv3.0).
2023-04-30 15:50:18 +02:00
Riku Isokoski ff34cf196e watchdog: Replace WatchdogView with const Watchdog 2023-02-25 16:57:12 +02:00
Riku Isokoski a3e14c012d src: Enable unused parameter warning
Fix warnings.
Some clang-formatting was necessary.
DebugPins is unused and was removed.
2023-01-24 10:43:17 +02:00
Finlay Davidson 96165a8541 Format header files
In my PR updating clang-format, I forgot to also format the headers.
2023-01-09 21:41:21 +01:00
Finlay Davidson eda96ffadc Update clang-{format,tidy} to 14
Also add configuration options only available in 13 and 14.
Fixes warning about -fstack-usage in clang-tidy check.
2023-01-04 17:15:33 +01:00
izzeho d6aa767bda Add P8B mirrored version definition. 2022-08-15 13:18:23 +02:00
Christoph Honal 8b0559c481 Add basic hardware configuration options for P8
This enables the configuration of the LFCLK source,
as well as the target hardware board pin configuration.
2022-06-27 08:28:48 +03:00
Christoph Honal 977936e8e2 System: Refactor pin and interrupt setup
This should ensure better readability of the pin setup procedure,
as well as allow the configuration of the hardware button enable pin
and the accelerometer interrupt pin via the pin mapping header.
2022-06-05 09:53:22 +03:00
luz paz 03a510bd18 Fix various typos
Found via `codespell -q 3 -S ./src/libs -L ans,doubleclick,trough`
2022-06-05 09:31:23 +03:00
Finlay Davidson 7f45538eb5 Apply clang-format to all C++ files 2022-06-05 09:15:46 +03:00
Finlay Davidson 718fbdab98 Replace C-style casts with static_cast 2022-06-05 09:15:46 +03:00
Riku Isokoski 6dac0a62f4 Remove lcd from DisplayApp 2022-05-08 13:12:37 +02:00
Riku Isokoski 8061822f0c Fix large blacklevel step. Lower 25% of shades are now accessible.
There is a large step in brightness from level zero to level one.
After experimenting with various ST7789 options, I found that
decreasing VDV to 0x10 (-0.4V) fixes this issue.

The gamma change reduced the average error in brightness, but with the
underlying issue fixed, the gamma change has been reverted.
2022-04-29 11:35:22 +03:00
Riku Isokoski aa32159c00 Tweak gamma on ST7789 and match UI colors
This change will increase the color accuracy of the PineTime and make UI
development with the simulator easier.
2022-04-25 15:50:26 +03:00
Reinhold Gschweicher 129dd97b51 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.

Also includes code style fix from Riksu9000

Co-authored-by: Riku Isokoski <riksu9000@gmail.com>
2022-04-24 19:07:46 +03:00
JF 71c895dc71
Merge pull request #531 from hatmajster/heart-rate-gain-setting
Heart rate sensor - HRS gain changed to x8
2022-01-26 21:44:23 +01:00
hatmajster b4e956227e Hrs3300: changed default gain to x8 2022-01-25 17:44:11 +01:00
Yehoshua Pesach Wallach 464b689a03
changed ReadHrs and ReadAls to uint32, and did static_cast instead of hidden cast when using it 2021-12-13 12:47:52 +02:00
Yehoshua Pesach Wallach 4cc95091ab
order ReadHrs, ReadAls bitwise according to bit ordering 2021-12-13 12:39:34 +02:00
Reinhold Gschweicher 241d36471d Move up file header include to top 2021-11-15 22:02:49 +01:00
Reinhold Gschweicher f2918709d9 Add missing standard includes 2021-11-15 22:02:49 +01:00
Reinhold Gschweicher ac7b2da611 Update includes to to be relative to src directory
Don't use relative imports like `../foo.h` as those depend on the
relative position of both files. Rather than that use imports relative
to the `src` directory, which explicitly is part of the include
directories.
2021-11-15 22:02:49 +01:00
Jean-François Milants 9671a8451f Fix unresponsive touch panel after update to 1.7 : don't care if device ids are not the ones we expected (until we know more about these communication and IDs issues). 2021-11-14 20:32:25 +01:00
Jean-François Milants 8d61419836 Fix formatting following the code review. 2021-11-07 16:19:06 +01:00
Jean-François Milants e9c7ab4cfc Add data validity check and retries in CST816S driver. See https://github.com/InfiniTimeOrg/InfiniTime/issues/763#issuecomment-962436976. 2021-11-06 19:01:19 +01:00
JF 9538eb9716
Merge pull request #586 from hubmartin/wake-time
Improve wake-up time
2021-10-23 10:24:27 +02:00
hubmartin 27366bdfdf Merge branch 'develop' into wake-time 2021-09-16 22:04:31 +02:00
Riku Isokoski 8f0771183c Fix Error screen and optimize GetTouchInfo 2021-09-15 12:25:41 +03:00
Riku Isokoski f221f5d744 Merge branch 'develop' into update_touch_driver 2021-09-14 15:34:09 +03:00
hubmartin 8390d0ef72 Merge branch 'develop' into pinmap 2021-08-29 11:43:50 +02:00
Riku Isokoski d2d97319e0 Merge branch 'develop' into update_touch_driver 2021-08-28 17:19:49 +03:00
Jean-François Milants 45e7638fc2 Merge branch 'twimaster_rework' of https://github.com/Riksu9000/InfiniTime into Riksu9000-twimaster_rework
# Conflicts:
#	src/systemtask/SystemTask.cpp
2021-08-28 15:08:50 +02:00
hubmartin db50131ed4 Remove commented commands completely 2021-08-23 15:02:40 +02:00
Riku Isokoski 40392d7b91 Use highest frequency and move mutex creation to Init 2021-08-18 21:40:27 +03:00
Riku Isokoski 780a811f05 Automatic error detection 2021-08-18 15:23:30 +03:00
Riku Isokoski 81a36dc31e Simplify parameters and cleanup 2021-08-16 18:26:10 +03:00
hubmartin 099364e619 Remove LCD reset and more cmds, save over 200ms 2021-08-15 16:48:41 +02:00
hubmartin faed0d4900 Remove unnecessary pin_set, save 50ms 2021-08-15 16:47:41 +02:00
Riku Isokoski 1d341a7aeb Don't reconfigure pins 2021-08-12 14:06:58 +03:00
Riku Isokoski 8a694adb09 Rework TouchHandler into not a task 2021-08-10 22:03:34 +03:00
Riku Isokoski 90ea1071d1 Explicitly disable pullup 2021-08-10 11:52:20 +03:00
Riku Isokoski 2194a339cf Only enable the bus when needed 2021-08-10 11:26:43 +03:00