Skip to content

Commit

Permalink
Merge branch 'develop' into del_dispapp_lcd
Browse files Browse the repository at this point in the history
  • Loading branch information
Riksu9000 committed Sep 18, 2021
2 parents a825fcb + 5855906 commit de7cc1f
Show file tree
Hide file tree
Showing 46 changed files with 940 additions and 242 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ name: Build PineTime Firmware
# When to run this Workflow...
on:

# Run this Workflow when files are updated (Pushed) in the "master" Branch
# Run this Workflow when files are updated (Pushed) in the "master" and "develop" Branch
push:
branches: [ master ]
branches: [ master, develop ]

# Also run this Workflow when a Pull Request is created or updated in the "master" Branch
# Also run this Workflow when a Pull Request is created or updated in the "master" and "develop" Branch
pull_request:
branches: [ master ]
branches: [ master, develop ]

# Steps to run for the Workflow
jobs:
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@ Testing/Temporary/
**/.DS_Store

# Windows
**/thumbs.db
**/thumbs.db

#VSCODE
.vscode/.cortex-debug.registers.state.json
.vscode/.cortex-debug.peripherals.state.json
52 changes: 51 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,55 @@
"-DNRF5_SDK_PATH=${env:NRF5_SDK_PATH}",
],
"cmake.generator": "Unix Makefiles",
"clang-tidy.buildPath": "build/compile_commands.json"
"clang-tidy.buildPath": "build/compile_commands.json",
"files.associations": {
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iosfwd": "cpp",
"istream": "cpp",
"limits": "cpp",
"new": "cpp",
"ostream": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"cinttypes": "cpp",
"typeinfo": "cpp"
}
}
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ if(BUILD_DFU)
set(BUILD_DFU true)
endif()

option(WATCH_COLMI_P8 "Build for the Colmi P8" OFF)
set(TARGET_DEVICE "PineTime")

if(WATCH_COLMI_P8)
set(TARGET_DEVICE "Colmi P8")
add_definitions(-DWATCH_P8)
endif()

set(PROJECT_GIT_COMMIT_HASH "")

execute_process(COMMAND git rev-parse --short HEAD
Expand All @@ -68,6 +76,7 @@ message(" * Version : " ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${P
message(" * Toolchain : " ${ARM_NONE_EABI_TOOLCHAIN_PATH})
message(" * GitRef(S) : " ${PROJECT_GIT_COMMIT_HASH})
message(" * NRF52 SDK : " ${NRF5_SDK_PATH})
message(" * Target device : " ${TARGET_DEVICE})
set(PROGRAMMER "???")
if(USE_JLINK)
message(" * Programmer/debugger : JLINK")
Expand Down
25 changes: 8 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
# PineTime
# InfiniTime

[![Build PineTime Firmware](https://github.com/JF002/InfiniTime/workflows/Build%20PineTime%20Firmware/badge.svg?branch=master)](https://github.com/JF002/InfiniTime/actions)

> The PineTime is a free and open source smartwatch capable of running custom-built open operating systems. Some of the notable features include a heart rate monitor, a week-long battery as well as a capacitive touch IPS display that is legible in direct sunlight. It is a fully community driven side-project, which means that it will ultimately be up to the developers and end-users to determine when they deem the PineTime ready to ship.
> We envision the PineTime as a companion for not only your PinePhone but also for your favorite devices — any phone, tablet, or even PC.
*https://www.pine64.org/pinetime/*

The **Pinetime** smartwatch is built around the NRF52832 MCU (512KB Flash, 64KB RAM), a 240*240 LCD display driven by the ST7789 controller, an accelerometer, a heart rate sensor, and a vibration motor.

# InfiniTime

![InfiniTime logo](images/infinitime-logo.jpg "InfiniTime Logo")

The goal of this project is to design an open-source firmware for the Pinetime smartwatch :
The goal of this project is to design an open-source firmware for the [Pinetime smartwatch](https://www.pine64.org/pinetime/) :

- Code written in **modern C++**;
- Build system based on **CMake**;
- Based on **[FreeRTOS 10.0.0](https://freertos.org)** real-time OS.
- Using **[LittleVGL/LVGL 7](https://lvgl.io/)** as UI library...
- ... and **[NimBLE 1.3.0](https://github.com/apache/mynewt-nimble)** as BLE stack.

## New to InfiniTime?

- [Getting started with InfiniTime 1.0 (quick user guide, update bootloader and InfiniTime,...)](doc/gettingStarted/gettingStarted-1.0.md)
- [Flash, upgrade (OTA), time synchronization,...](doc/gettingStarted/ota-gadgetbridge-nrfconnect.md)

## Overview

![Pinetime screens](images/1.0.0/collage.png "PinetimeScreens")
Expand Down Expand Up @@ -70,16 +65,12 @@ As of now, here is the list of achievements of this project:
* [Amazfish](https://openrepos.net/content/piggz/amazfish) (on SailfishOS and Linux)
* [Siglo](https://github.com/alexr4535/siglo) (on Linux)
* **[Experimental]** [WebBLEWatch](https://hubmartin.github.io/WebBLEWatch/) Synchronize time directly from your web browser. [video](https://youtu.be/IakiuhVDdrY)
* **[Experimental]** [Infini-iOS](https://github.com/xan-m/Infini-iOS) (on iOS)
- OTA (Over-the-air) update via BLE
- [Bootloader](https://github.com/JF002/pinetime-mcuboot-bootloader) based on [MCUBoot](https://juullabs-oss.github.io/mcuboot/)

## Documentation

### Getting started

- [Getting started with InfiniTime 1.0 (quick user guide, update bootloader and InfiniTime,...)](doc/gettingStarted/gettingStarted-1.0.md)
- [Flash, upgrade (OTA), time synchronization,...](doc/gettingStarted/ota-gadgetbridge-nrfconnect.md)

### Develop

- [Generate the fonts and symbols](src/displayapp/fonts/README.md)
Expand Down
2 changes: 1 addition & 1 deletion cmake-nRF5x/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ The script makes use of the following tools:

After setup you can use cmake as usual:

1. Generate the actual build files (out-of-source builds are strongly recomended):
1. Generate the actual build files (out-of-source builds are strongly recommended):

```commandline
cmake -H. -B"cmake-build" -G "Unix Makefiles"
Expand Down
1 change: 1 addition & 0 deletions doc/buildAndProgram.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ CMake configures the project according to variables you specify the command line
**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`
**GDB_CLIENT_TARGET_REMOTE**|Target remote connection string. Used only if `USE_GDB_CLIENT` is 1.|`-DGDB_CLIENT_TARGET_REMOTE=/dev/ttyACM0`
**BUILD_DFU (\*\*)**|Build DFU files while building (needs [adafruit-nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil)).|`-DBUILD_DFU=1`
**WATCH_COLMI_P8**|Use pin configuration for Colmi P8 watch|`-DWATCH_COLMI_P8=1`

####(**) Note about **CMAKE_BUILD_TYPE**:
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.
Expand Down
8 changes: 8 additions & 0 deletions doc/gettingStarted/ota-gadgetbridge-nrfconnect.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Read carefully the warning and tap **Install**:

Wait for the transfer to finish. Your PineTime should reset and reboot with the new version of InfiniTime!

Don't forget to **validate** your firmware. In the InfiniTime go to the settings (swipe right, select gear icon) and Firmware option and click **validate**. Otherwise after reboot the previous firmware will be used.

![Gadgetbridge 5](gadgetbridge5.jpg)

### Using NRFConnect
Expand All @@ -64,6 +66,8 @@ Select **Distribution packet (ZIP)**:

Browse to the DFU file you downloaded previously, the DFU transfer will start automatically. When the transfer is finished, your PineTime will reset and restart on the new version of InfiniTime!

Don't forget to **validate** your firmware. In the InfiniTime go to the settings (swipe right, select gear icon) and Firmware option and click **validate**. Otherwise after reboot the previous firmware will be used.

![NRFConnect 3](nrfconnect3.jpg)

## How to flash InfiniTime using the SWD interface
Expand All @@ -88,6 +92,10 @@ If you are using OpenOCD with a STLinkV2, you can find more info [on this page](
### Using Gadgetbridge
Good news! Gadgetbridge **automatically** synchronizes the time when connecting to your PineTime!

### Using any Chromium-based web browser
You can use it from your PC, Mac, Android. Browsers now have BLE support.
https://hubmartin.github.io/WebBLEWatch/

### Using NRFConnect
You must enable the **CTS** *GATT server* into NRFConnect so that InfiniTime can synchronize the time with your smartphone.

Expand Down
2 changes: 1 addition & 1 deletion doc/versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ The versioning of this project is based on [Semantic versionning](https://semver

- The **patch** is incremented when we fix a bug on a **released** version (most of the time using a **hotfix** branch).
- The **minor** is incremented when we release a new version with new features. It corresponds to a merge of **develop** into **master**.
- The **major** should be incremented when a breaking change is made to the application. We still have to define what is a breaking change in the context of this project. For now, I suggest that it stays **0** until we have a fully functionning firmware suited for the final user.
- The **major** should be incremented when a breaking change is made to the application. We still have to define what is a breaking change in the context of this project. For now, I suggest that it stays **0** until we have a fully functioning firmware suited for the final user.
10 changes: 8 additions & 2 deletions gcc_nrf52-mcuboot.ld
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ GROUP(-lgcc -lc -lnosys)
MEMORY
{
FLASH (rx) : ORIGIN = 0x08020, LENGTH = 0x78000
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x10000
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
}

SECTIONS
{
}
.noinit(NOLOAD):
{
PROVIDE(__start_noinit_data = .);
*(.noinit)
PROVIDE(__stop_noinit_data = .);
} > RAM
} INSERT AFTER .bss

SECTIONS
{
Expand Down
11 changes: 9 additions & 2 deletions gcc_nrf52.ld
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ GROUP(-lgcc -lc -lnosys)
MEMORY
{
FLASH (rx) : ORIGIN = 0x00000, LENGTH = 0x78000
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x10000
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
}

SECTIONS
{
}
.noinit(NOLOAD):
{
PROVIDE(__start_noinit_data = .);
*(.noinit)
PROVIDE(__stop_noinit_data = .);
} > RAM
} INSERT AFTER .bss

SECTIONS
{
Expand Down Expand Up @@ -44,6 +50,7 @@ SECTIONS
PROVIDE(__stop_log_filter_data = .);
} > RAM


} INSERT AFTER .data;

SECTIONS
Expand Down
17 changes: 13 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ set(SDK_SOURCE_FILES
set(TINYCRYPT_SRC
libs/mynewt-nimble/ext/tinycrypt/src/aes_encrypt.c
libs/mynewt-nimble/ext/tinycrypt/src/utils.c
libs/mynewt-nimble/ext/tinycrypt/src/cmac_mode.c
libs/mynewt-nimble/ext/tinycrypt/src/ecc.c
libs/mynewt-nimble/ext/tinycrypt/src/ecc_dh.c
)

set(NIMBLE_SRC
Expand All @@ -104,6 +107,10 @@ set(NIMBLE_SRC
libs/mynewt-nimble/nimble/host/src/ble_l2cap.c
libs/mynewt-nimble/nimble/host/src/ble_hs_mbuf.c
libs/mynewt-nimble/nimble/host/src/ble_sm.c
libs/mynewt-nimble/nimble/host/src/ble_sm_cmd.c
libs/mynewt-nimble/nimble/host/src/ble_sm_lgcy.c
libs/mynewt-nimble/nimble/host/src/ble_sm_alg.c
libs/mynewt-nimble/nimble/host/src/ble_sm_sc.c
libs/mynewt-nimble/nimble/host/src/ble_gap.c
libs/mynewt-nimble/nimble/host/src/ble_gatts.c
libs/mynewt-nimble/nimble/host/src/ble_gattc.c
Expand All @@ -127,10 +134,6 @@ set(NIMBLE_SRC
libs/mynewt-nimble/nimble/host/src/ble_hs_atomic.c
libs/mynewt-nimble/nimble/host/src/ble_hs_adv.c
libs/mynewt-nimble/nimble/host/src/ble_hs_flow.c
libs/mynewt-nimble/nimble/host/src/ble_sm.c
libs/mynewt-nimble/nimble/host/src/ble_sm_cmd.c
libs/mynewt-nimble/nimble/host/src/ble_sm_lgcy.c
libs/mynewt-nimble/nimble/host/src/ble_sm_alg.c
libs/mynewt-nimble/nimble/host/src/ble_hs_mqueue.c
libs/mynewt-nimble/nimble/host/src/ble_hs_stop.c
libs/mynewt-nimble/nimble/host/src/ble_hs_startup.c
Expand Down Expand Up @@ -418,6 +421,7 @@ list(APPEND SOURCE_FILES
displayapp/screens/BatteryInfo.cpp
displayapp/screens/Steps.cpp
displayapp/screens/Timer.cpp
displayapp/screens/Alarm.cpp
displayapp/Colors.cpp

## Settings
Expand Down Expand Up @@ -474,6 +478,7 @@ list(APPEND SOURCE_FILES
components/motor/MotorController.cpp
components/settings/Settings.cpp
components/timer/TimerController.cpp
components/alarm/AlarmController.cpp
components/fs/FS.cpp
drivers/Cst816s.cpp
FreeRTOS/port.c
Expand Down Expand Up @@ -540,6 +545,7 @@ list(APPEND RECOVERY_SOURCE_FILES
components/firmwarevalidator/FirmwareValidator.cpp
components/settings/Settings.cpp
components/timer/TimerController.cpp
components/alarm/AlarmController.cpp
drivers/Cst816s.cpp
FreeRTOS/port.c
FreeRTOS/port_cmsis_systick.c
Expand Down Expand Up @@ -612,6 +618,7 @@ set(INCLUDE_FILES
displayapp/screens/Metronome.h
displayapp/screens/Motion.h
displayapp/screens/Timer.h
displayapp/screens/Alarm.h
displayapp/Colors.h
drivers/St7789.h
drivers/SpiNorFlash.h
Expand All @@ -621,6 +628,7 @@ set(INCLUDE_FILES
drivers/DebugPins.h
drivers/InternalFlash.h
drivers/Hrs3300.h
drivers/PinMap.h
drivers/Bma421.h
drivers/Bma421_C/bma4.c
drivers/Bma421_C/bma423.c
Expand All @@ -643,6 +651,7 @@ set(INCLUDE_FILES
components/ble/HeartRateService.h
components/settings/Settings.h
components/timer/TimerController.h
components/alarm/AlarmController.h
drivers/Cst816s.h
FreeRTOS/portmacro.h
FreeRTOS/portmacro_cmsis.h
Expand Down
Loading

0 comments on commit de7cc1f

Please sign in to comment.