Hi, could someone explain me how the if statement works in the snippet below? Despite the fact that I know how bitwise works I cannot understand when thewill be TRUE and when will be FALSE.Code:channel & (1 << i)
Code:void selectMuxPin(int channel) {
for (int i = 0; i < MUX_CTRL_CHA; i++) {
if (channel & (1 << i)) {
nrf_gpio_pin_set(ctrlPins[i]);
}else {
nrf_gpio_pin_clear(ctrlPins[i]);
}
}
}