summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorGuillaume Pinot <texitoi@texitoi.eu>2020-08-20 21:35:35 +0200
committerGuillaume Pinot <texitoi@texitoi.eu>2020-08-20 21:35:35 +0200
commit957968bf93a34cf70cf245a9a9e395a2fed018ed (patch)
tree8216328dc05f63d12a07f11432c60ff2284f518c /firmware
parentd1321fb0d9e8b50e610c9f1eb0edf94d7465d0e1 (diff)
fix transpose
Diffstat (limited to 'firmware')
-rw-r--r--firmware/src/main.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/firmware/src/main.rs b/firmware/src/main.rs
index 8e884fc..b97b72a 100644
--- a/firmware/src/main.rs
+++ b/firmware/src/main.rs
@@ -287,21 +287,21 @@ fn transpose_left(e: Event) -> Event {
}
fn transpose_right(e: Event) -> Event {
match e {
- Event::Press(x, y) => Event::Press(11 - x, y),
- Event::Release(x, y) => Event::Release(11 - x, y),
+ Event::Press(i, j) => Event::Press(i, 11 - j),
+ Event::Release(i, j) => Event::Release(i, 11 - j),
}
}
fn de(bytes: &[u8]) -> Result<Event, ()> {
match *bytes {
- [b'P', x, y, b'\n'] => Ok(Event::Press(x as usize, y as usize)),
- [b'R', x, y, b'\n'] => Ok(Event::Release(x as usize, y as usize)),
+ [b'P', i, j, b'\n'] => Ok(Event::Press(i as usize, j as usize)),
+ [b'R', i, j, b'\n'] => Ok(Event::Release(i as usize, j as usize)),
_ => Err(()),
}
}
fn ser(e: Event) -> [u8; 4] {
match e {
- Event::Press(x, y) => [b'P', x as u8, y as u8, b'\n'],
- Event::Release(x, y) => [b'R', x as u8, y as u8, b'\n'],
+ Event::Press(i, j) => [b'P', i as u8, j as u8, b'\n'],
+ Event::Release(i, j) => [b'R', i as u8, j as u8, b'\n'],
}
}