commit fa8322719236bd4326179f38b0aa26c718b54c49
parent 612093eb3265fd3d12a3b203c3a94d2679b84e83
Author: Henry Wilson <m3henry@googlemail.com>
Date: Sun, 11 Feb 2018 17:35:26 +0000
reordered mix(a,b, mask)
Diffstat:
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/hidModule.cpp b/hidModule.cpp
@@ -20,7 +20,7 @@ uint8_t hid::sampleInput()
const auto saveCout = io::out::C();
io::out::C() = saveCout | maskC;
- io::out::D() = mix(io::out::D(), maskD, wheelCOM);
+ io::out::D() = mix(io::out::D(), wheelCOM, maskD);
_delay_us(1);
auto buttons = (maskC & ~io::pin::C()) << 1;
@@ -37,8 +37,8 @@ uint8_t hid::sampleInput()
void hid::setLeds(const uint8_t val)
{
- io::out::B() = mix(io::out::B(), ledRED, val);
- io::out::D() = mix(io::out::D(), ledYEL | ledGRN, val);
+ io::out::B() = mix(io::out::B(), val, ledRED);
+ io::out::D() = mix(io::out::D(), val, ledYEL | ledGRN);
}
void hid::test()
diff --git a/utils.h b/utils.h
@@ -31,7 +31,7 @@ inline constexpr uint16_t wbit(const uint8_t shift)
return uint8_t(1) << shift;
}
-inline constexpr uint8_t mix(const uint8_t a, const uint8_t mask, const uint8_t b)
+inline constexpr uint8_t mix(const uint8_t a, const uint8_t b, const uint8_t mask)
{
return (a & ~mask) | (b & mask);
}