diff options
| author | Jeff Epler <jepler@gmail.com> | 2020-05-06 11:04:53 -0500 |
|---|---|---|
| committer | Jeff Epler <jepler@gmail.com> | 2020-06-26 11:50:23 -0500 |
| commit | 57fde2e07bb2ee4dcff342deed08e4e7799da799 (patch) | |
| tree | e0c9f2ecccc45637a48db61e823485ad3460e9cf /shared-bindings/busio/SPI.c | |
| parent | 12df4ce221b212c866f83c0ccf0233458fb421bd (diff) | |
sdcardio: implement new library for SD card I/O
Testing performed: That a card is successfully mounted on Pygamer with
the built in SD card slot
This module is enabled for most FULL_BUILD boards, but is disabled for
samd21 ("M0"), litex, and pca10100 for various reasons.
Diffstat (limited to 'shared-bindings/busio/SPI.c')
| -rw-r--r-- | shared-bindings/busio/SPI.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/shared-bindings/busio/SPI.c b/shared-bindings/busio/SPI.c index 22f001d2d..793ab4f67 100644 --- a/shared-bindings/busio/SPI.c +++ b/shared-bindings/busio/SPI.c @@ -418,3 +418,10 @@ const mp_obj_type_t busio_spi_type = { .make_new = busio_spi_make_new, .locals_dict = (mp_obj_dict_t*)&busio_spi_locals_dict, }; + +busio_spi_obj_t *validate_obj_is_spi_bus(mp_obj_t obj) { + if (!MP_OBJ_IS_TYPE(obj, &busio_spi_type)) { + mp_raise_TypeError_varg(translate("Expected a %q"), busio_spi_type.name); + } + return MP_OBJ_TO_PTR(obj); +} |
