Remove libbcm2835 in favour of spidev#252
Conversation
petercsmith-x
commented
Jul 11, 2025
- Removes libbcm2835
- Uses spidev ioctl to perform SPI instead, abstracting over the hardware so we have RPi 5 and 64-bit compatibility
- Fixes a warning when building the I2C driver
- Some clang-format changes
xhuw
left a comment
There was a problem hiding this comment.
Some comments. nice work though. Its great you got the proper linux drivers working, should make life easier for us in the future
As the deletion of device_access_spi_rpi.c could be a breaking change for users I think it would be good to check with @mbanth before we merge this change
| @@ -0,0 +1,258 @@ | |||
| // Copyright 2025 XMOS LIMITED. | |||
| // This Software is subject to the terms of the XMOS Public Licence: Version 1. | |||
| #if USE_SPI && RPI | |||
There was a problem hiding this comment.
I suppose not, I assume we won't be shipping this out with the Linux build but any Linux machine with spidev could use this. I'll make it just USE_SPI.
| struct timespec rem; | ||
| while(nanosleep(&req, &rem)); | ||
| } | ||
| static long intertransaction_delay = 0; |
There was a problem hiding this comment.
Fair enough being explicit, but note ofc static variables are always 0 initialised anyway.
There was a problem hiding this comment.
I'm aware, just trying to stick to good practice of 0-initialising stuff that should be 0 lol.
| { | ||
| data_len = control_build_spi_data(data_sent_recieved, resid, cmd, payload, payload_len); | ||
| } | ||
| if (resid == 0 && cmd == 0) { |
There was a problem hiding this comment.
Some ancient MISRA C senses from my first job are crying about this linter's decisions
There was a problem hiding this comment.
Might have been a me decision as this would probably be a clippy issue in 🦀 Rust 🦀
…ecks, add status checks to SPI access
…ly used once, change definition to constant
6e75aa5 to
f128871
Compare