ref: e5b73212f6addcfdb5e306df63d7135e543c4f8d
src/BootloaderVersion.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
#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"; uint32_t BootloaderVersion::Major() { return (BootloaderVersion::version >> 16u) & 0xff; } uint32_t BootloaderVersion::Minor() { return (BootloaderVersion::version >> 8u) & 0xff; } uint32_t BootloaderVersion::Patch() { return BootloaderVersion::version & 0xff; } const char* BootloaderVersion::VersionString() { return BootloaderVersion::versionString; } 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()); } |