From 4870f0015b4d985d8469599b3fbb3b8370efb628 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Tue, 4 Aug 2015 10:29:54 -0700 Subject: [PATCH] Extract PPB reset value to a constant. Group with related constants. --- firmware/common/portapack_persistent_memory.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/firmware/common/portapack_persistent_memory.cpp b/firmware/common/portapack_persistent_memory.cpp index 3f1a7d13..bb538d0e 100644 --- a/firmware/common/portapack_persistent_memory.cpp +++ b/firmware/common/portapack_persistent_memory.cpp @@ -49,6 +49,7 @@ struct range_t { using ppb_range_t = range_t; constexpr ppb_range_t ppb_range { -99000, 99000 }; +constexpr ppb_t ppb_reset_value { 0 }; /* struct must pack the same way on M4 and M0 cores. */ struct data_t { @@ -60,7 +61,7 @@ static_assert(sizeof(data_t) <= 0x100, "Persistent memory structure too large fo static data_t* const data = reinterpret_cast(LPC_BACKUP_REG_BASE); ppb_t correction_ppb() { - ppb_range.reset_if_outside(data->correction_ppb, 0); + ppb_range.reset_if_outside(data->correction_ppb, ppb_reset_value); return data->correction_ppb; }