Skip to content

Commit 40765f1

Browse files
authored
Merge branch 'develop' into disable_notif_only
2 parents 3ee4876 + b0bdd2b commit 40765f1

28 files changed

Lines changed: 177 additions & 162 deletions

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ if(BUILD_DFU)
5151
set(BUILD_DFU true)
5252
endif()
5353

54+
option(WATCH_COLMI_P8 "Build for the Colmi P8" OFF)
55+
set(TARGET_DEVICE "PineTime")
56+
57+
if(WATCH_COLMI_P8)
58+
set(TARGET_DEVICE "Colmi P8")
59+
add_definitions(-DWATCH_P8)
60+
endif()
61+
5462
set(PROJECT_GIT_COMMIT_HASH "")
5563

5664
execute_process(COMMAND git rev-parse --short HEAD
@@ -68,6 +76,7 @@ message(" * Version : " ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${P
6876
message(" * Toolchain : " ${ARM_NONE_EABI_TOOLCHAIN_PATH})
6977
message(" * GitRef(S) : " ${PROJECT_GIT_COMMIT_HASH})
7078
message(" * NRF52 SDK : " ${NRF5_SDK_PATH})
79+
message(" * Target device : " ${TARGET_DEVICE})
7180
set(PROGRAMMER "???")
7281
if(USE_JLINK)
7382
message(" * Programmer/debugger : JLINK")

README.md

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
1-
# PineTime
1+
# InfiniTime
22

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

5-
> 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.
6-
7-
> We envision the PineTime as a companion for not only your PinePhone but also for your favorite devices — any phone, tablet, or even PC.
8-
9-
*https://www.pine64.org/pinetime/*
10-
11-
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.
12-
13-
# InfiniTime
14-
155
![InfiniTime logo](images/infinitime-logo.jpg "InfiniTime Logo")
166

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

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

15+
## New to InfiniTime?
16+
17+
- [Getting started with InfiniTime 1.0 (quick user guide, update bootloader and InfiniTime,...)](doc/gettingStarted/gettingStarted-1.0.md)
18+
- [Flash, upgrade (OTA), time synchronization,...](doc/gettingStarted/ota-gadgetbridge-nrfconnect.md)
19+
2520
## Overview
2621

2722
![Pinetime screens](images/1.0.0/collage.png "PinetimeScreens")
@@ -76,11 +71,6 @@ As of now, here is the list of achievements of this project:
7671

7772
## Documentation
7873

79-
### Getting started
80-
81-
- [Getting started with InfiniTime 1.0 (quick user guide, update bootloader and InfiniTime,...)](doc/gettingStarted/gettingStarted-1.0.md)
82-
- [Flash, upgrade (OTA), time synchronization,...](doc/gettingStarted/ota-gadgetbridge-nrfconnect.md)
83-
8474
### Develop
8575

8676
- [Generate the fonts and symbols](src/displayapp/fonts/README.md)

cmake-nRF5x/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ The script makes use of the following tools:
9898

9999
After setup you can use cmake as usual:
100100

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

103103
```commandline
104104
cmake -H. -B"cmake-build" -G "Unix Makefiles"

doc/buildAndProgram.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ CMake configures the project according to variables you specify the command line
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`
3030
**BUILD_DFU (\*\*)**|Build DFU files while building (needs [adafruit-nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil)).|`-DBUILD_DFU=1`
31+
**WATCH_COLMI_P8**|Use pin configuration for Colmi P8 watch|`-DWATCH_COLMI_P8=1`
3132

3233
####(**) Note about **CMAKE_BUILD_TYPE**:
3334
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.

doc/gettingStarted/ota-gadgetbridge-nrfconnect.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ Read carefully the warning and tap **Install**:
4747

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

50+
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.
51+
5052
![Gadgetbridge 5](gadgetbridge5.jpg)
5153

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

6567
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!
6668

69+
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.
70+
6771
![NRFConnect 3](nrfconnect3.jpg)
6872

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

95+
### Using any Chromium-based web browser
96+
You can use it from your PC, Mac, Android. Browsers now have BLE support.
97+
https://hubmartin.github.io/WebBLEWatch/
98+
9199
### Using NRFConnect
92100
You must enable the **CTS** *GATT server* into NRFConnect so that InfiniTime can synchronize the time with your smartphone.
93101

doc/versioning.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ The versioning of this project is based on [Semantic versionning](https://semver
33

44
- The **patch** is incremented when we fix a bug on a **released** version (most of the time using a **hotfix** branch).
55
- The **minor** is incremented when we release a new version with new features. It corresponds to a merge of **develop** into **master**.
6-
- 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.
6+
- 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.

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,7 @@ set(INCLUDE_FILES
621621
drivers/DebugPins.h
622622
drivers/InternalFlash.h
623623
drivers/Hrs3300.h
624+
drivers/PinMap.h
624625
drivers/Bma421.h
625626
drivers/Bma421_C/bma4.c
626627
drivers/Bma421_C/bma423.c

src/components/battery/BatteryController.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "BatteryController.h"
2+
#include "drivers/PinMap.h"
23
#include <hal/nrf_gpio.h>
34
#include <nrfx_saadc.h>
45
#include <algorithm>
@@ -9,15 +10,12 @@ Battery* Battery::instance = nullptr;
910

1011
Battery::Battery() {
1112
instance = this;
12-
}
13-
14-
void Battery::Init() {
15-
nrf_gpio_cfg_input(chargingPin, static_cast<nrf_gpio_pin_pull_t> GPIO_PIN_CNF_PULL_Pullup);
13+
nrf_gpio_cfg_input(PinMap::Charging, static_cast<nrf_gpio_pin_pull_t> GPIO_PIN_CNF_PULL_Disabled);
1614
}
1715

1816
void Battery::Update() {
19-
isCharging = !nrf_gpio_pin_read(chargingPin);
20-
isPowerPresent = !nrf_gpio_pin_read(powerPresentPin);
17+
isCharging = !nrf_gpio_pin_read(PinMap::Charging);
18+
isPowerPresent = !nrf_gpio_pin_read(PinMap::PowerPresent);
2119

2220
if (isReading) {
2321
return;
@@ -75,5 +73,11 @@ void Battery::SaadcEventHandler(nrfx_saadc_evt_t const* p_event) {
7573

7674
nrfx_saadc_uninit();
7775
isReading = false;
76+
77+
systemTask->PushMessage(System::Messages::BatteryMeasurementDone);
7878
}
7979
}
80+
81+
void Battery::Register(Pinetime::System::SystemTask* systemTask) {
82+
this->systemTask = systemTask;
83+
}

src/components/battery/BatteryController.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#pragma once
22
#include <cstdint>
33
#include <drivers/include/nrfx_saadc.h>
4-
#include <array>
5-
#include <numeric>
4+
#include <systemtask/SystemTask.h>
65

76
namespace Pinetime {
87
namespace Controllers {
@@ -11,8 +10,8 @@ namespace Pinetime {
1110
public:
1211
Battery();
1312

14-
void Init();
1513
void Update();
14+
void Register(System::SystemTask* systemTask);
1615

1716
uint8_t PercentRemaining() const {
1817
return percentRemaining;
@@ -34,8 +33,6 @@ namespace Pinetime {
3433
static Battery* instance;
3534
nrf_saadc_value_t saadc_value;
3635

37-
static constexpr uint32_t chargingPin = 12;
38-
static constexpr uint32_t powerPresentPin = 19;
3936
static constexpr nrf_saadc_input_t batteryVoltageAdcInput = NRF_SAADC_INPUT_AIN7;
4037
uint16_t voltage = 0;
4138
uint8_t percentRemaining = 0;
@@ -49,6 +46,8 @@ namespace Pinetime {
4946
static void AdcCallbackStatic(nrfx_saadc_evt_t const* event);
5047

5148
bool isReading = false;
49+
50+
Pinetime::System::SystemTask* systemTask = nullptr;
5251
};
5352
}
5453
}

src/components/ble/NimbleController.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ void NimbleController::StartAdvertising() {
126126
// ASSERT(res == 0);// TODO I've disabled these ASSERT as they sometime asserts and reset the mcu.
127127
// For now, the advertising is restarted as soon as it ends. There may be a race condition
128128
// that prevent the advertising from restarting reliably.
129-
// I remove the assert to prevent this uncesseray crash, but in the long term, the management of
129+
// I remove the assert to prevent this unnecessary crash, but in the long term, the management of
130130
// the advertising should be improve (better error handling, and advertise for 3 minutes after
131131
// the application has been woken up, for example.
132132
}

0 commit comments

Comments
 (0)