stm32:adc: Change bitwise AND to logical AND

The original bitwise AND was _functionally_ correct because all operands
were booleans, but it was very poor at conveying the intent.

Fixes #1230
This commit is contained in:
rma-x
2020-07-03 14:16:16 +02:00
committed by Karl Palsson
parent 90753950bb
commit 24bef9c49e
2 changed files with 7 additions and 7 deletions

View File

@@ -111,13 +111,13 @@ void adc_set_regular_sequence(uint32_t adc, uint8_t length, uint8_t channel[])
if (i <= 4) {
reg32_1 |= (channel[i - 1] << (i * 6));
}
if ((i > 4) & (i <= 9)) {
if ((i > 4) && (i <= 9)) {
reg32_2 |= (channel[i - 1] << ((i - 4 - 1) * 6));
}
if ((i > 9) & (i <= 14)) {
if ((i > 9) && (i <= 14)) {
reg32_3 |= (channel[i - 1] << ((i - 9 - 1) * 6));
}
if ((i > 14) & (i <= 16)) {
if ((i > 14) && (i <= 16)) {
reg32_4 |= (channel[i - 1] << ((i - 14 - 1) * 6));
}
}