mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-09 21:51:45 +00:00
powctl: don't require arm64 arch for floating -> fixed conversion
This commit is contained in:
parent
f7f83b4742
commit
03efc31f9c
1 changed files with 3 additions and 5 deletions
|
@ -564,12 +564,10 @@ namespace ams::powctl::impl::board::nintendo::nx {
|
|||
}
|
||||
|
||||
Result Max17050Driver::SetFullChargeThreshold(double percentage) {
|
||||
#if defined(ATMOSPHERE_ARCH_ARM64)
|
||||
const u16 val = vcvtd_n_s64_f64(percentage, BITSIZEOF(u8));
|
||||
#else
|
||||
#error "Unknown architecture for floating point -> fixed point"
|
||||
#endif
|
||||
/* Convert percentage from double to signed fixed-point with 8 fractional bits. */
|
||||
const u16 val = static_cast<u16>(static_cast<s16>(percentage * (1 << 8)));
|
||||
|
||||
/* Set the threshold. */
|
||||
return WriteRegister(m_i2c_session, max17050::FullSocThr, val);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue