Skip to content

Commit dd493bc

Browse files
authored
Merge branch 'main' into subrating
2 parents de3c72c + c375058 commit dd493bc

1 file changed

Lines changed: 8 additions & 14 deletions

File tree

rmk/src/input_device/iqs5xx.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -227,24 +227,18 @@ where
227227
let x_resolution = u16::from(channels[0].saturating_sub(1)) * 256;
228228
let y_resolution = u16::from(channels[1].saturating_sub(1)) * 256;
229229

230-
let i2c_timeout_ms;
231-
let active_interval_ms;
232-
let system_config_0;
233-
let system_config_1;
234-
match &mut self.window_detection {
230+
231+
232+
233+
234+
let (system_config_0, system_config_1, i2c_timeout_ms, active_interval_ms) = match &mut self.window_detection {
235235
WindowDetection::Rdy(_) => {
236-
system_config_0 = 0b01100100; // §8.10.9: !MANUAL_CONTROL | SETUP_COMPLETE | WDT | REATI
237-
system_config_1 = 0b00001111; // §8.10.10: REATI_EVENT | TP_EVENT | GESTURE_EVENT | EVENT_MODE
238-
i2c_timeout_ms = 30;
239-
active_interval_ms = 9;
236+
(0b01100100, 0b00001111, 30, 9)
240237
}
241238
WindowDetection::Poll { interval_ms, .. } => {
242-
system_config_0 = 0b11100100; // §8.10.9: MANUAL_CONTROL | SETUP_COMPLETE | WDT | REATI
243-
system_config_1 = 0; // §8.10.10: !EVENT_MODE
244-
i2c_timeout_ms = 100;
245-
active_interval_ms = *interval_ms;
239+
(0b11100100, 0, 100, *interval_ms)
246240
}
247-
}
241+
};
248242
// I2C timeout register at 0x058A; §8.6.
249243
let i2c_timeout = [0x05, 0x8A, i2c_timeout_ms];
250244
#[rustfmt::skip]

0 commit comments

Comments
 (0)