Skip to content

Commit db6a701

Browse files
JF002Gitea
authored andcommitted
Merge branch 'develop' of JF/PineTime into master
2 parents d96395c + d6cccc2 commit db6a701

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2952
-996
lines changed

.clang-tidy

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Checks: '*,
2+
-altera-unroll-loops,
23
-llvmlibc-callee-namespace,
34
-llvm-header-guard,
45
-llvm-namespace-comment,
@@ -14,17 +15,20 @@ Checks: '*,
1415
-cppcoreguidelines-avoid-magic-numbers,
1516
-cppcoreguidelines-avoid-non-const-global-variables,
1617
-cppcoreguidelines-avoid-c-arrays,
18+
-cppcoreguidelines-special-member-functions,
1719
-readability-magic-numbers,
1820
-readability-uppercase-literal-suffix,
1921
-modernize-use-trailing-return-type,
2022
-modernize-avoid-c-arrays,
21-
-hicpp-signed-bitwise,
22-
-hicpp-no-assembler,
2323
-hicpp-avoid-c-arrays,
2424
-hicpp-uppercase-literal-suffix,
25+
-hicpp-vararg,
26+
-hicpp-no-assembler,
2527
-hicpp-no-array-decay,
28+
-hicpp-signed-bitwise,
29+
-hicpp-special-member-functions,
2630
-cert-err58-cpp,
2731
-cert-err60-cpp'
2832
CheckOptions:
2933
- key: readability-function-cognitive-complexity.Threshold
30-
value: 100
34+
value: 100

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "src/libs/lvgl"]
22
path = src/libs/lvgl
33
url = https://github.com/joaquimorg/lvgl.git
4+
[submodule "src/libs/littlefs"]
5+
path = src/libs/littlefs
6+
url = https://github.com/littlefs-project/littlefs.git

.idea/codeStyles/Project.xml

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.10)
2-
project(pinetime VERSION 1.2.0 LANGUAGES C CXX ASM)
2+
project(pinetime VERSION 1.3.0 LANGUAGES C CXX ASM)
33

44
set(CMAKE_C_STANDARD 99)
55
set(CMAKE_CXX_STANDARD 14)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ As of now, here is the list of achievements of this project:
5353
* Two (2048 clone game)
5454
* Stopwatch (with all the necessary functions such as play, pause, lap, stop)
5555
* Motion sensor and step counter (displays the number of steps and the state of the motion sensor in real-time)
56+
* Metronome (vibrates to a given bpm with a customizable beats per bar)
5657
- User settings:
5758
* Display timeout
5859
* Wake-up condition

doc/buildAndProgram.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ CMake configures the project according to variables you specify the command line
2727
**NRFJPROG**|Path to the NRFJProg executable. Used only if `USE_JLINK` is 1.|`-DNRFJPROG=/opt/nrfjprog/nrfjprog`
2828
**GDB_CLIENT_BIN_PATH**|Path to arm-none-eabi-gdb executable. Used only if `USE_GDB_CLIENT` is 1.|`-DGDB_CLIENT_BIN_PATH=/home/jf/nrf52/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gdb`
2929
**GDB_CLIENT_TARGET_REMOTE**|Target remote connection string. Used only if `USE_GDB_CLIENT` is 1.|`-DGDB_CLIENT_TARGET_REMOTE=/dev/ttyACM0`
30-
**BUILD_DFU (\*\*)**|Build DFU files while building (needs [adafruit-nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil)).|`-BUILD_DFU=1`
30+
**BUILD_DFU (\*\*)**|Build DFU files while building (needs [adafruit-nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil)).|`-DBUILD_DFU=1`
3131

3232
####(**) Note about **CMAKE_BUILD_TYPE**:
3333
By default, this variable is set to *Release*. It compiles the code with size and speed optimizations. We use this value for all the binaries we publish when we [release](https://github.com/JF002/InfiniTime/releases) new versions of InfiniTime.

src/BootloaderVersion.cpp

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,36 @@
11
#include <cstdint>
2+
#include <cstdio>
23
#include "BootloaderVersion.h"
34

45
using namespace Pinetime;
56

6-
// NOTE : current bootloader does not export its version to the application firmware.
7+
// NOTE : version < 1.0.0 of bootloader does not export its version to the application firmware.
78

8-
uint32_t BootloaderVersion::Major() {
9-
return 0;
9+
uint32_t BootloaderVersion::version = 0;
10+
char BootloaderVersion::versionString[BootloaderVersion::VERSION_STR_LEN] = "0.0.0";
11+
12+
const uint32_t BootloaderVersion::Major() {
13+
return (BootloaderVersion::version >> 16u) & 0xff;
1014
}
1115

12-
uint32_t BootloaderVersion::Minor() {
13-
return 0;
16+
const uint32_t BootloaderVersion::Minor() {
17+
return (BootloaderVersion::version >> 8u) & 0xff;
1418
}
1519

16-
uint32_t BootloaderVersion::Patch() {
17-
return 0;
20+
const uint32_t BootloaderVersion::Patch() {
21+
return BootloaderVersion::version & 0xff;
1822
}
1923

2024
const char* BootloaderVersion::VersionString() {
21-
return "0.0.0";
25+
return BootloaderVersion::versionString;
26+
}
27+
28+
const bool BootloaderVersion::IsValid() {
29+
return BootloaderVersion::version >= 0x00010000;
2230
}
2331

24-
bool BootloaderVersion::IsValid() {
25-
return false;
32+
void BootloaderVersion::SetVersion(uint32_t v) {
33+
BootloaderVersion::version = v;
34+
snprintf(BootloaderVersion::versionString, BootloaderVersion::VERSION_STR_LEN, "%ld.%ld.%ld",
35+
BootloaderVersion::Major(), BootloaderVersion::Minor(), BootloaderVersion::Patch());
2636
}

src/BootloaderVersion.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@
33
namespace Pinetime {
44
class BootloaderVersion {
55
public:
6-
static uint32_t Major();
7-
static uint32_t Minor();
8-
static uint32_t Patch();
6+
static const uint32_t Major();
7+
static const uint32_t Minor();
8+
static const uint32_t Patch();
99
static const char* VersionString();
10-
static bool IsValid();
10+
static const bool IsValid();
11+
static void SetVersion(uint32_t v);
12+
private:
13+
static uint32_t version;
14+
static constexpr size_t VERSION_STR_LEN = 12;
15+
static char versionString[VERSION_STR_LEN];
1116
};
12-
}
17+
}

src/CMakeLists.txt

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,13 @@ set(NIMBLE_SRC
166166
libs/mynewt-nimble/nimble/host/util/src/addr.c
167167
)
168168

169+
set(LITTLEFS_SRC
170+
libs/littlefs/lfs_util.h
171+
libs/littlefs/lfs.h
172+
libs/littlefs/lfs_util.c
173+
libs/littlefs/lfs.c
174+
)
175+
169176
set(LVGL_SRC
170177
libs/lv_conf.h
171178
libs/lvgl/lvgl.h
@@ -235,6 +242,7 @@ set(LVGL_SRC
235242
libs/lvgl/src/lv_widgets/lv_cont.h
236243
libs/lvgl/src/lv_widgets/lv_cpicker.h
237244
libs/lvgl/src/lv_widgets/lv_dropdown.h
245+
libs/lvgl/src/lv_widgets/lv_gauge.h
238246
libs/lvgl/src/lv_widgets/lv_img.h
239247
libs/lvgl/src/lv_widgets/lv_imgbtn.h
240248
libs/lvgl/src/lv_widgets/lv_keyboard.h
@@ -321,6 +329,7 @@ set(LVGL_SRC
321329
libs/lvgl/src/lv_widgets/lv_cont.c
322330
libs/lvgl/src/lv_widgets/lv_cpicker.c
323331
libs/lvgl/src/lv_widgets/lv_dropdown.c
332+
libs/lvgl/src/lv_widgets/lv_gauge.c
324333
libs/lvgl/src/lv_widgets/lv_img.c
325334
libs/lvgl/src/lv_widgets/lv_imgbtn.c
326335
libs/lvgl/src/lv_widgets/lv_keyboard.c
@@ -423,6 +432,7 @@ list(APPEND SOURCE_FILES
423432
displayapp/icons/bg_clock.c
424433
displayapp/screens/WatchFaceAnalog.cpp
425434
displayapp/screens/WatchFaceDigital.cpp
435+
displayapp/screens/PineTimeStyle.cpp
426436

427437
##
428438

@@ -462,6 +472,7 @@ list(APPEND SOURCE_FILES
462472
components/motor/MotorController.cpp
463473
components/settings/Settings.cpp
464474
components/timer/TimerController.cpp
475+
components/fs/FS.cpp
465476
drivers/Cst816s.cpp
466477
FreeRTOS/port.c
467478
FreeRTOS/port_cmsis_systick.c
@@ -473,6 +484,7 @@ list(APPEND SOURCE_FILES
473484
displayapp/fonts/jetbrains_mono_76.c
474485
displayapp/fonts/jetbrains_mono_42.c
475486
displayapp/fonts/lv_font_sys_48.c
487+
displayapp/fonts/open_sans_light.c
476488
displayapp/lv_pinetime_theme.c
477489

478490
systemtask/SystemTask.cpp
@@ -539,6 +551,7 @@ list(APPEND RECOVERY_SOURCE_FILES
539551
components/heartrate/Biquad.cpp
540552
components/heartrate/Ptagc.cpp
541553
components/motor/MotorController.cpp
554+
components/fs/FS.cpp
542555
)
543556

544557
list(APPEND RECOVERYLOADER_SOURCE_FILES
@@ -797,13 +810,25 @@ target_compile_options(lvgl PRIVATE
797810
$<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp>
798811
)
799812

813+
# LITTLEFS_SRC
814+
add_library(littlefs STATIC ${LITTLEFS_SRC})
815+
target_include_directories(littlefs SYSTEM PUBLIC . ../)
816+
target_include_directories(littlefs SYSTEM PUBLIC ${INCLUDES_FROM_LIBS})
817+
target_compile_options(littlefs PRIVATE
818+
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Wno-unused-function -Og -g3>
819+
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Wno-unused-function -Os>
820+
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Wno-unused-function -Og -g3 -fno-rtti>
821+
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Wno-unused-function -Os -fno-rtti>
822+
$<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp>
823+
)
824+
800825
# Build autonomous binary (without support for bootloader)
801826
set(EXECUTABLE_NAME "pinetime-app")
802827
set(EXECUTABLE_FILE_NAME ${EXECUTABLE_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH})
803828
set(NRF5_LINKER_SCRIPT "${CMAKE_SOURCE_DIR}/gcc_nrf52.ld")
804829
add_executable(${EXECUTABLE_NAME} ${SOURCE_FILES})
805830
set_target_properties(${EXECUTABLE_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_FILE_NAME})
806-
target_link_libraries(${EXECUTABLE_NAME} nimble nrf-sdk lvgl)
831+
target_link_libraries(${EXECUTABLE_NAME} nimble nrf-sdk lvgl littlefs)
807832
target_compile_options(${EXECUTABLE_NAME} PUBLIC
808833
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Og -g3>
809834
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Os>
@@ -832,7 +857,7 @@ set(IMAGE_MCUBOOT_FILE_NAME ${EXECUTABLE_MCUBOOT_NAME}-image-${pinetime_VERSION_
832857
set(DFU_MCUBOOT_FILE_NAME ${EXECUTABLE_MCUBOOT_NAME}-dfu-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.zip)
833858
set(NRF5_LINKER_SCRIPT_MCUBOOT "${CMAKE_SOURCE_DIR}/gcc_nrf52-mcuboot.ld")
834859
add_executable(${EXECUTABLE_MCUBOOT_NAME} ${SOURCE_FILES})
835-
target_link_libraries(${EXECUTABLE_MCUBOOT_NAME} nimble nrf-sdk lvgl)
860+
target_link_libraries(${EXECUTABLE_MCUBOOT_NAME} nimble nrf-sdk lvgl littlefs)
836861
set_target_properties(${EXECUTABLE_MCUBOOT_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_MCUBOOT_FILE_NAME})
837862
target_compile_options(${EXECUTABLE_MCUBOOT_NAME} PUBLIC
838863
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Og -g3>
@@ -868,7 +893,7 @@ endif()
868893
set(EXECUTABLE_RECOVERY_NAME "pinetime-recovery")
869894
set(EXECUTABLE_RECOVERY_FILE_NAME ${EXECUTABLE_RECOVERY_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH})
870895
add_executable(${EXECUTABLE_RECOVERY_NAME} ${RECOVERY_SOURCE_FILES})
871-
target_link_libraries(${EXECUTABLE_RECOVERY_NAME} nimble nrf-sdk)
896+
target_link_libraries(${EXECUTABLE_RECOVERY_NAME} nimble nrf-sdk littlefs)
872897
set_target_properties(${EXECUTABLE_RECOVERY_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_RECOVERY_FILE_NAME})
873898
target_compile_definitions(${EXECUTABLE_RECOVERY_NAME} PUBLIC "PINETIME_IS_RECOVERY")
874899
target_compile_options(${EXECUTABLE_RECOVERY_NAME} PUBLIC
@@ -898,7 +923,7 @@ set(EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}-${
898923
set(IMAGE_RECOVERY_MCUBOOT_FILE_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}-image-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.bin)
899924
set(DFU_RECOVERY_MCUBOOT_FILE_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}-dfu-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.zip)
900925
add_executable(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} ${RECOVERY_SOURCE_FILES})
901-
target_link_libraries(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} nimble nrf-sdk)
926+
target_link_libraries(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} nimble nrf-sdk littlefs)
902927
set_target_properties(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME})
903928
target_compile_definitions(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PUBLIC "PINETIME_IS_RECOVERY")
904929
target_compile_options(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PUBLIC

src/FreeRTOSConfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
#define configENABLE_BACKWARD_COMPATIBILITY 1
7878

7979
/* Hook function related definitions. */
80-
#define configUSE_IDLE_HOOK 1
80+
#define configUSE_IDLE_HOOK 0
8181
#define configUSE_TICK_HOOK 0
8282
#define configCHECK_FOR_STACK_OVERFLOW 0
8383
#define configUSE_MALLOC_FAILED_HOOK 0

0 commit comments

Comments
 (0)