Add new screen that allows the user to manually validate the new firmware he's just OTA'ed.

Still need to find a way to display this screen when needed.
This commit is contained in:
JF
2020-08-11 17:50:00 +02:00
parent 27fa273d83
commit bbfc20c3ff
8 changed files with 179 additions and 9 deletions

View File

@@ -0,0 +1,20 @@
#include <drivers/InternalFlash.h>
#include <hal/nrf_rtc.h>
#include "FirmwareValidator.h"
using namespace Pinetime::Controllers;
bool FirmwareValidator::IsValidated() const {
auto* imageOkPtr = reinterpret_cast<uint32_t *>(validBitAdress);
return (*imageOkPtr) == validBitValue;
}
void FirmwareValidator::Validate() {
if(!IsValidated())
Pinetime::Drivers::InternalFlash::WriteWord(validBitAdress, validBitValue);
}
void FirmwareValidator::Reset() {
NVIC_SystemReset();
}

View File

@@ -0,0 +1,18 @@
#pragma once
#include <cstdint>
namespace Pinetime {
namespace Controllers {
class FirmwareValidator {
public:
void Validate();
bool IsValidated() const;
void Reset();
private:
static constexpr uint32_t validBitAdress {0x7BFE8};
static constexpr uint32_t validBitValue {1};
};
}
}