summaryrefslogtreecommitdiff
path: root/extmod/machine_spi.c
AgeCommit message (Collapse)Author
2021-09-02extmod/machine_spi: Make SoftSPI configurable via macro option.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2020-10-01extmod/machine_spi: Remove "id" arg in SoftSPI constructor.Damien George
The SoftSPI constructor is now used soley to create SoftSPI instances, it can no longer delegate to create a hardware-based SPI instance. Signed-off-by: Damien George <damien@micropython.org>
2020-04-05all: Use MP_ERROR_TEXT for all error messages.Jim Mussared
2020-02-28all: Reformat C and Python source code with tools/codeformat.py.Damien George
This is run with uncrustify 0.70.1, and black 19.10b0.
2018-03-10drivers/bus: Pull out software SPI implementation to dedicated driver.Damien George
This patch takes the software SPI implementation from extmod/machine_spi.c and moves it to a dedicated file in drivers/bus/softspi.c. This allows the SPI driver to be used independently of the uPy runtime, making it a more general component.
2018-03-02extmod/machine_spi: Make SPI protocol structure public.Damien George
So it can be referenced directly without the need for the uPy object.
2017-02-06extmod/machine_spi: Remove EVENT_POLL_HOOK from soft-SPI transfer func.Damien George
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).
2016-12-08extmod/machine_spi: Provide reusable software SPI class.Damien George
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.
2016-10-04extmod/machine_spi: Add optional support for fast software SPI.Damien George
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.
2016-10-04extmod/machine_spi: Use delay_half, not baudrate, for internal timing.Damien George
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.
2016-10-03extmod/machine_spi: Factor out software SPI code from esp8266 to extmod.Damien George
2016-10-03extmod/machine_spi: Simplify SPI xfer function to only take one buf len.Damien George
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.
2016-09-01extmod: Add machine_spi with generic SPI C-protocol and helper methods.Damien George
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.