MajenkoLibraries / MCP23S17

Arduino library for MCP23S17 IO Expanders
BSD 3-Clause "New" or "Revised" License
45 stars 16 forks source link

Changed SPI to always set clock speed before sending data #8

Closed ramboerik closed 3 years ago

ramboerik commented 3 years ago

Hi!

I'm using your library with multiple SPI devices and stumbled across an issue when using multiple devices with different SPI transfer speeds. The problem is that the clock speed is only set once in begin() and is overwritten by other SPI devices transfer calls later on.

The solution is to use the beginTransaction/endTransaction call to restore the clock speed before each transfer call.

majenkotech commented 3 years ago

This will break chipKIT DSPI support. It needs making optional for systems that support transactions only.