Fixed all the includes that were broken due to the renames
This commit is contained in:
20
src/components/firmwarevalidator/FirmwareValidator.cpp
Normal file
20
src/components/firmwarevalidator/FirmwareValidator.cpp
Normal 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();
|
||||
}
|
18
src/components/firmwarevalidator/FirmwareValidator.h
Normal file
18
src/components/firmwarevalidator/FirmwareValidator.h
Normal 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};
|
||||
};
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user