summaryrefslogtreecommitdiffstatshomepage
path: root/extmod/machine_spi.c
Commit message (Collapse)AuthorAge
* extmod/machine_spi: Remove EVENT_POLL_HOOK from soft-SPI transfer func.Damien George2017-02-06
| | | | | | | | | | | SPI needs to be fast, and calling the EVENT_POLL_HOOK every byte makes it unusable for ports that need to do non-trivial work in the EVENT_POLL_HOOK call. And individual SPI transfers should be short enough in time that EVENT_POLL_HOOK doesn't need to be called. If something like this proves to be needed in practice then we will need to introduce separate event hook macros, one for "slow" loops (eg select/poll) and one for "fast" loops (eg software I2C, SPI).
* extmod/machine_spi: Provide reusable software SPI class.Damien George2016-12-08
| | | | | | So long as a port defines relevant mp_hal_pin_xxx functions (and delay) it can make use of this software SPI class without the need for additional code.
* extmod/machine_spi: Add optional support for fast software SPI.Damien George2016-10-04
| | | | | | If a port defines MICROPY_PY_MACHINE_SPI_MIN_DELAY then it can use a faster software SPI loop that does not make calls to the delay_us function.
* extmod/machine_spi: Use delay_half, not baudrate, for internal timing.Damien George2016-10-04
| | | | | | | The delay_half parameter must be specified by the port to set up the timing of the software SPI. This allows the port to adjust the timing value to better suit its timing characteristics, as well as provide a more accurate printing of the baudrate.
* extmod/machine_spi: Factor out software SPI code from esp8266 to extmod.Damien George2016-10-03
|
* extmod/machine_spi: Simplify SPI xfer function to only take one buf len.Damien George2016-10-03
| | | | | | | | There is no need to take src_len and dest_len arguments. The case of reading-only with a single output byte (originally src_len=1, dest_len>1) is now handled by using the output buffer as the input buffer, and using memset to fill the output byte into this buffer. This simplifies the implementations of the spi_transfer protocol function.
* extmod: Add machine_spi with generic SPI C-protocol and helper methods.Damien George2016-09-01
The idea is that all ports can use these helper methods and only need to provide initialisation of the SPI bus, as well as a single transfer function. The coding pattern follows the stream protocol and helper methods.