diff options
author | Jean-François Milants <jf@codingfield.com> | 2021-02-14 14:42:42 +0100 |
---|---|---|
committer | Jean-François Milants <jf@codingfield.com> | 2021-02-14 14:42:42 +0100 |
commit | f81ff98c308e437139468301ed5198b322c2f4ec (patch) | |
tree | 4e2334bc3a8f7f434890a4cb439703b569572c10 /src/drivers/Hrs3300.cpp | |
parent | 01e194426d51ffb1a6e9e3162567f29c2a84154d (diff) | |
parent | e62f8734befca5e40496f354aa05ea20602a8bbe (diff) |
Merge branch 'develop' of github.com:JF002/Pinetime into develop
Diffstat (limited to 'src/drivers/Hrs3300.cpp')
-rw-r--r-- | src/drivers/Hrs3300.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/drivers/Hrs3300.cpp b/src/drivers/Hrs3300.cpp index 2aded7d3..dc9f9cd8 100644 --- a/src/drivers/Hrs3300.cpp +++ b/src/drivers/Hrs3300.cpp @@ -70,13 +70,14 @@ uint16_t Hrs3300::ReadAls() { } void Hrs3300::SetGain(uint8_t gain) { - static constexpr uint8_t maxGain = 64; + constexpr uint8_t maxGain = 64U; gain = std::min(gain, maxGain); uint8_t hgain = 0; - while((1 << hgain) < gain) - hgain++; + while((1 << hgain) < gain){ + ++hgain; + } - WriteRegister(static_cast<uint8_t>(Registers::Hgain), hgain << 2); + WriteRegister(static_cast<uint8_t>(Registers::Hgain), hgain << 2); } void Hrs3300::SetDrive(uint8_t drive) { |