-
Notifications
You must be signed in to change notification settings - Fork 22
Description
As implemented currently, the SPI / I2C / OutputPin structs all keep references to Mutex<RefCell<FtInner<Device>>>.
This makes it difficult / impossible to have FtHal inside a Box or RefCell or otherwise pass it around once SPI has been initialized.
(It is possible, but then each time one would need to access the SPI functions of FtHal, this would require re-initializing the SPI object with Spi::new, which is inefficient as it sends the MPSSE command each time).
Would it be possible to create a shallow Spi::new (and accordingly for the other structs) which basically becomes a no-op if SPI has already been initialized? Or are there other ideas how one could solve this?
My use case is that I need to share FtHal between two devices (e.g. using a shared pointer), each of which live on the Heap and need to have access to the SPI port...