summaryrefslogtreecommitdiff
path: root/src/drivers/Hrs3300.cpp
diff options
context:
space:
mode:
authorJean-François Milants <jf@codingfield.com>2021-03-07 07:44:14 (GMT)
committerJean-François Milants <jf@codingfield.com>2021-03-07 07:44:14 (GMT)
commit9f67e6f6525bd4071609ff9edd6ce132d7ca1464 (patch)
tree65b2dc22bb257c6dd4fc8be77762173b564c340c /src/drivers/Hrs3300.cpp
parent740b3d7b58dd92a6a6f99620a090ae4f05c03299 (diff)
parentada942535718d48eec37cca4f50d678e7201dc67 (diff)
Merge branch 'develop' into recovery-firmware
# Conflicts: # src/CMakeLists.txt # src/displayapp/DisplayApp.h # src/systemtask/SystemTask.cpp # src/systemtask/SystemTask.h
Diffstat (limited to 'src/drivers/Hrs3300.cpp')
-rw-r--r--src/drivers/Hrs3300.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/drivers/Hrs3300.cpp b/src/drivers/Hrs3300.cpp
index 2aded7d..dc9f9cd 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) {