Merge branch 'PersistantStorage' of git://github.com/geekbozu/InfiniTime into geekbozu-PersistantStorage
# Conflicts: # src/systemtask/SystemTask.cpp
This commit is contained in:
commit
f556003de3
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -39,3 +39,7 @@ Testing/Temporary/
|
||||||
|
|
||||||
# Windows
|
# Windows
|
||||||
**/thumbs.db
|
**/thumbs.db
|
||||||
|
|
||||||
|
#VSCODE
|
||||||
|
.vscode/.cortex-debug.registers.state.json
|
||||||
|
.vscode/.cortex-debug.peripherals.state.json
|
||||||
|
|
52
.vscode/settings.json
vendored
52
.vscode/settings.json
vendored
|
@ -5,5 +5,55 @@
|
||||||
"-DNRF5_SDK_PATH=${env:NRF5_SDK_PATH}",
|
"-DNRF5_SDK_PATH=${env:NRF5_SDK_PATH}",
|
||||||
],
|
],
|
||||||
"cmake.generator": "Unix Makefiles",
|
"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"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,18 @@ GROUP(-lgcc -lc -lnosys)
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
FLASH (rx) : ORIGIN = 0x08020, LENGTH = 0x78000
|
FLASH (rx) : ORIGIN = 0x08020, LENGTH = 0x78000
|
||||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x10000
|
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
}
|
.noinit(NOLOAD):
|
||||||
|
{
|
||||||
|
PROVIDE(__start_noinit_data = .);
|
||||||
|
*(.noinit)
|
||||||
|
PROVIDE(__stop_noinit_data = .);
|
||||||
|
} > RAM
|
||||||
|
} INSERT AFTER .bss
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
|
|
11
gcc_nrf52.ld
11
gcc_nrf52.ld
|
@ -6,12 +6,18 @@ GROUP(-lgcc -lc -lnosys)
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
FLASH (rx) : ORIGIN = 0x00000, LENGTH = 0x78000
|
FLASH (rx) : ORIGIN = 0x00000, LENGTH = 0x78000
|
||||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x10000
|
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
}
|
.noinit(NOLOAD):
|
||||||
|
{
|
||||||
|
PROVIDE(__start_noinit_data = .);
|
||||||
|
*(.noinit)
|
||||||
|
PROVIDE(__stop_noinit_data = .);
|
||||||
|
} > RAM
|
||||||
|
} INSERT AFTER .bss
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
|
@ -44,6 +50,7 @@ SECTIONS
|
||||||
PROVIDE(__stop_log_filter_data = .);
|
PROVIDE(__stop_log_filter_data = .);
|
||||||
} > RAM
|
} > RAM
|
||||||
|
|
||||||
|
|
||||||
} INSERT AFTER .data;
|
} INSERT AFTER .data;
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
|
|
|
@ -5,6 +5,10 @@
|
||||||
|
|
||||||
using namespace Pinetime::Controllers;
|
using namespace Pinetime::Controllers;
|
||||||
|
|
||||||
|
void DateTime::SetCurrentTime(std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> t) {
|
||||||
|
this->currentDateTime = t;
|
||||||
|
}
|
||||||
|
|
||||||
void DateTime::SetTime(
|
void DateTime::SetTime(
|
||||||
uint16_t year, uint8_t month, uint8_t day, uint8_t dayOfWeek, uint8_t hour, uint8_t minute, uint8_t second, uint32_t systickCounter) {
|
uint16_t year, uint8_t month, uint8_t day, uint8_t dayOfWeek, uint8_t hour, uint8_t minute, uint8_t second, uint32_t systickCounter) {
|
||||||
std::tm tm = {
|
std::tm tm = {
|
||||||
|
|
|
@ -74,6 +74,7 @@ namespace Pinetime {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Register(System::SystemTask* systemTask);
|
void Register(System::SystemTask* systemTask);
|
||||||
|
void SetCurrentTime(std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> t);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint16_t year = 0;
|
uint16_t year = 0;
|
||||||
|
|
20
src/main.cpp
20
src/main.cpp
|
@ -115,7 +115,6 @@ Pinetime::Controllers::FS fs {spiNorFlash};
|
||||||
Pinetime::Controllers::Settings settingsController {fs};
|
Pinetime::Controllers::Settings settingsController {fs};
|
||||||
Pinetime::Controllers::MotorController motorController {settingsController};
|
Pinetime::Controllers::MotorController motorController {settingsController};
|
||||||
|
|
||||||
|
|
||||||
Pinetime::Applications::DisplayApp displayApp(lcd,
|
Pinetime::Applications::DisplayApp displayApp(lcd,
|
||||||
lvgl,
|
lvgl,
|
||||||
touchPanel,
|
touchPanel,
|
||||||
|
@ -156,6 +155,16 @@ Pinetime::System::SystemTask systemTask(spi,
|
||||||
fs,
|
fs,
|
||||||
touchHandler);
|
touchHandler);
|
||||||
|
|
||||||
|
/* Variable Declarations for variables in noinit SRAM
|
||||||
|
Increment NoInit_MagicValue upon adding variables to this area
|
||||||
|
*/
|
||||||
|
extern uint32_t __start_noinit_data;
|
||||||
|
extern uint32_t __stop_noinit_data;
|
||||||
|
static constexpr uint32_t NoInit_MagicValue = 0xDEAD0000;
|
||||||
|
uint32_t NoInit_MagicWord __attribute__((section(".noinit")));
|
||||||
|
std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> NoInit_BackUpTime __attribute__((section(".noinit")));
|
||||||
|
|
||||||
|
|
||||||
void nrfx_gpiote_evt_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action) {
|
void nrfx_gpiote_evt_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action) {
|
||||||
if (pin == Pinetime::PinMap::Cst816sIrq) {
|
if (pin == Pinetime::PinMap::Cst816sIrq) {
|
||||||
systemTask.OnTouchEvent();
|
systemTask.OnTouchEvent();
|
||||||
|
@ -316,6 +325,15 @@ int main(void) {
|
||||||
// retrieve version stored by bootloader
|
// retrieve version stored by bootloader
|
||||||
Pinetime::BootloaderVersion::SetVersion(NRF_TIMER2->CC[0]);
|
Pinetime::BootloaderVersion::SetVersion(NRF_TIMER2->CC[0]);
|
||||||
|
|
||||||
|
|
||||||
|
if (NoInit_MagicWord == NoInit_MagicValue) {
|
||||||
|
dateTimeController.SetCurrentTime(NoInit_BackUpTime);
|
||||||
|
} else {
|
||||||
|
//Clear Memory to known state
|
||||||
|
memset(&__start_noinit_data,0,(uintptr_t)&__stop_noinit_data-(uintptr_t)&__start_noinit_data);
|
||||||
|
NoInit_MagicWord = NoInit_MagicValue;
|
||||||
|
}
|
||||||
|
|
||||||
lvgl.Init();
|
lvgl.Init();
|
||||||
|
|
||||||
systemTask.Start();
|
systemTask.Start();
|
||||||
|
|
|
@ -376,6 +376,7 @@ void SystemTask::Work() {
|
||||||
monitor.Process();
|
monitor.Process();
|
||||||
uint32_t systick_counter = nrf_rtc_counter_get(portNRF_RTC_REG);
|
uint32_t systick_counter = nrf_rtc_counter_get(portNRF_RTC_REG);
|
||||||
dateTimeController.UpdateTime(systick_counter);
|
dateTimeController.UpdateTime(systick_counter);
|
||||||
|
NoInit_BackUpTime = dateTimeController.CurrentDateTime();
|
||||||
if (!nrf_gpio_pin_read(PinMap::Button))
|
if (!nrf_gpio_pin_read(PinMap::Button))
|
||||||
watchdog.Kick();
|
watchdog.Kick();
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "drivers/Watchdog.h"
|
#include "drivers/Watchdog.h"
|
||||||
#include "Messages.h"
|
#include "Messages.h"
|
||||||
|
|
||||||
|
extern std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> NoInit_BackUpTime;
|
||||||
namespace Pinetime {
|
namespace Pinetime {
|
||||||
namespace Drivers {
|
namespace Drivers {
|
||||||
class Cst816S;
|
class Cst816S;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user