Open
Description
Currently, the SPI::_acquire() function is pretty inefficient: if the current SPI class instance does not own the peripheral, it reinitializes the ENTIRE spi hardware peripheral, including setting up clocking and pins again. This has got to be a bit of a performance drain if you are trying to rapidly switch an SPI bus between multiple chips (even though it does mean that you can use the same SPI peripheral on your MCU with multiple pin mappings which is cool). Ideally:
- General setup such as clocking and DMA channels should only be set up once for a given hardware peripheral
- Pin mappings should only be changed in acquire() if the previous owner used different pin mappings than the current instance