mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-05-25 01:41:28 -04:00
Extract PPB reset value to a constant.
Group with related constants.
This commit is contained in:
parent
52ba9af1c7
commit
4870f0015b
1 changed files with 2 additions and 1 deletions
|
@ -49,6 +49,7 @@ struct range_t {
|
||||||
|
|
||||||
using ppb_range_t = range_t<ppb_t>;
|
using ppb_range_t = range_t<ppb_t>;
|
||||||
constexpr ppb_range_t ppb_range { -99000, 99000 };
|
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 must pack the same way on M4 and M0 cores. */
|
||||||
struct data_t {
|
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<data_t*>(LPC_BACKUP_REG_BASE);
|
static data_t* const data = reinterpret_cast<data_t*>(LPC_BACKUP_REG_BASE);
|
||||||
|
|
||||||
ppb_t correction_ppb() {
|
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;
|
return data->correction_ppb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue