mirror of
https://github.com/InfiniTimeOrg/InfiniTime.git
synced 2024-12-20 00:02:14 +03:00
0045fb16b6
* Retrieve and display bootloader version - Display bootloader version on System Info screen - Enable SPI flash sleep mode if bootloader version >= 1.0.0 * Wait for SPI flash to wakeup before starting OTA DFU
37 lines
1.1 KiB
C++
37 lines
1.1 KiB
C++
#include <cstdint>
|
|
#include <cstdio>
|
|
#include "BootloaderVersion.h"
|
|
|
|
using namespace Pinetime;
|
|
|
|
// NOTE : version < 1.0.0 of bootloader does not export its version to the application firmware.
|
|
|
|
uint32_t BootloaderVersion::version = 0;
|
|
char BootloaderVersion::versionString[BootloaderVersion::VERSION_STR_LEN] = "0.0.0";
|
|
|
|
const uint32_t BootloaderVersion::Major() {
|
|
return (BootloaderVersion::version >> 16u) & 0xff;
|
|
}
|
|
|
|
const uint32_t BootloaderVersion::Minor() {
|
|
return (BootloaderVersion::version >> 8u) & 0xff;
|
|
}
|
|
|
|
const uint32_t BootloaderVersion::Patch() {
|
|
return BootloaderVersion::version & 0xff;
|
|
}
|
|
|
|
const char* BootloaderVersion::VersionString() {
|
|
return BootloaderVersion::versionString;
|
|
}
|
|
|
|
const bool BootloaderVersion::IsValid() {
|
|
return BootloaderVersion::version >= 0x00010000;
|
|
}
|
|
|
|
void BootloaderVersion::SetVersion(uint32_t v) {
|
|
BootloaderVersion::version = v;
|
|
snprintf(BootloaderVersion::versionString, BootloaderVersion::VERSION_STR_LEN, "%ld.%ld.%ld",
|
|
BootloaderVersion::Major(), BootloaderVersion::Minor(), BootloaderVersion::Patch());
|
|
}
|