firmware: Streamline writing to display
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Move if condition inside the SPI call to reduce duplicate code.
This commit is contained in:
finga 2023-06-09 09:32:04 +02:00
parent 59ff782d52
commit c26ba3549a

View file

@ -35,11 +35,7 @@ impl Lcd {
delay.delay_us(5_u8);
self.cd.set_high();
if invert {
data.for_each(|d| block!(self.spi.send(!*d)).unwrap());
} else {
data.for_each(|d| block!(self.spi.send(*d)).unwrap());
}
data.for_each(|d| block!(self.spi.send(if invert { !*d } else { *d })).unwrap());
delay.delay_us(5_u8);
self.cd.set_low();