Browse Source

Merge branch 'master' into add_embedded_graphics

embedded-hal-1.0
Chris 7 years ago
parent
commit
d65cf0c578
  1. 12
      src/interface.rs

12
src/interface.rs

@ -100,8 +100,18 @@ where
{
// activate spi with cs low
self.cs.set_low();
// transfer spi data
spi.write(data)?;
// Be careful!! Linux has a default limit of 4096 bytes per spi transfer
// see https://raspberrypi.stackexchange.com/questions/65595/spi-transfer-fails-with-buffer-size-greater-than-4096
if cfg!(target_os = "linux") {
for data_chunk in data.chunks(4096) {
spi.write(data_chunk)?;
}
} else {
spi.write(data)?;
}
// deativate spi with cs high
self.cs.set_high();

Loading…
Cancel
Save