summaryrefslogtreecommitdiff
path: root/extmod/machine_spi.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-03-09 17:25:58 +1100
committerDamien George <damien.p.george@gmail.com>2018-03-10 00:59:43 +1100
commit58ebeca6a9a172a35b9298a911d450722797c409 (patch)
tree06434efb89e6c7a01add2137e817177e89532aea /extmod/machine_spi.h
parentad2a6e538ca008d5e25bb03223ac4b948a340aff (diff)
drivers/bus: Pull out software SPI implementation to dedicated driver.
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.
Diffstat (limited to 'extmod/machine_spi.h')
-rw-r--r--extmod/machine_spi.h10
1 files changed, 2 insertions, 8 deletions
diff --git a/extmod/machine_spi.h b/extmod/machine_spi.h
index 3ee1b241f..db21e1cd3 100644
--- a/extmod/machine_spi.h
+++ b/extmod/machine_spi.h
@@ -28,6 +28,7 @@
#include "py/obj.h"
#include "py/mphal.h"
+#include "drivers/bus/spi.h"
// SPI protocol
typedef struct _mp_machine_spi_p_t {
@@ -38,20 +39,13 @@ typedef struct _mp_machine_spi_p_t {
typedef struct _mp_machine_soft_spi_obj_t {
mp_obj_base_t base;
- uint32_t delay_half; // microsecond delay for half SCK period
- uint8_t polarity;
- uint8_t phase;
- mp_hal_pin_obj_t sck;
- mp_hal_pin_obj_t mosi;
- mp_hal_pin_obj_t miso;
+ mp_soft_spi_obj_t spi;
} mp_machine_soft_spi_obj_t;
extern const mp_machine_spi_p_t mp_machine_soft_spi_p;
extern const mp_obj_type_t mp_machine_soft_spi_type;
extern const mp_obj_dict_t mp_machine_spi_locals_dict;
-void mp_machine_soft_spi_transfer(mp_obj_base_t *self, size_t len, const uint8_t *src, uint8_t *dest);
-
mp_obj_t mp_machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args);
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_machine_spi_read_obj);