Set spi chunk limit on linux with cfg!

Not tested yet
embedded-hal-1.0
Chris 2018-10-12 11:30:04 +02:00
parent a079653a26
commit 6b89ee1b8e
1 changed files with 10 additions and 1 deletions

View File

@ -100,8 +100,17 @@ where
{ {
// activate spi with cs low // activate spi with cs low
self.cs.set_low(); self.cs.set_low();
// transfer spi data // transfer spi data
// Be careful!! Linux has a default limit of 4096 bytes per spi transfer
if cfg!(target_os = "linux") {
for data_chunk in data.chunks(4096) {
spi.write(data_chunk)?;
}
} else {
spi.write(data)?; spi.write(data)?;
}
// deativate spi with cs high // deativate spi with cs high
self.cs.set_high(); self.cs.set_high();