eliminated warnings in Hrs3300

This commit is contained in:
Niall Cooling 2021-02-12 17:36:56 +00:00
parent 6420885abb
commit 6c03c97005

View File

@ -70,11 +70,12 @@ uint16_t Hrs3300::ReadAls() {
} }
void Hrs3300::SetGain(uint8_t gain) { void Hrs3300::SetGain(uint8_t gain) {
static constexpr uint8_t maxGain = 64; constexpr uint8_t maxGain = 64U;
gain = std::min(gain, maxGain); gain = std::min(gain, maxGain);
uint8_t hgain = 0; uint8_t hgain = 0;
while((1 << hgain) < gain) while((1 << hgain) < gain){
hgain++; ++hgain;
}
WriteRegister(static_cast<uint8_t>(Registers::Hgain), hgain << 2); WriteRegister(static_cast<uint8_t>(Registers::Hgain), hgain << 2);
} }