summaryrefslogtreecommitdiff
path: root/shared-bindings
diff options
context:
space:
mode:
authorScott Shawcroft <scott@adafruit.com>2020-10-27 13:53:05 -0700
committerGitHub <noreply@github.com>2020-10-27 13:53:05 -0700
commit563a8934b72030117af8f5e1da566c56be8eb454 (patch)
tree66d98ce55e91d0805467d261ce8c253b09218042 /shared-bindings
parentfa35c3fa7caf24b3b1cc5822f542f5d30476cbe4 (diff)
parent99a3750a2cfd1da8cdd266ca9a0367f0c3a54092 (diff)
Merge pull request #3603 from cwalther/boardspi
Fix lost board.SPI and board.I2C
Diffstat (limited to 'shared-bindings')
-rw-r--r--shared-bindings/board/__init__.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/shared-bindings/board/__init__.c b/shared-bindings/board/__init__.c
index 6837fc41c..717698408 100644
--- a/shared-bindings/board/__init__.c
+++ b/shared-bindings/board/__init__.c
@@ -28,6 +28,12 @@
#include "py/runtime.h"
#include "shared-bindings/board/__init__.h"
+#if BOARD_I2C
+#include "shared-bindings/busio/I2C.h"
+#endif
+#if BOARD_SPI
+#include "shared-bindings/busio/SPI.h"
+#endif
//| """Board specific pin names
//|
@@ -45,7 +51,7 @@
#if BOARD_I2C
mp_obj_t board_i2c(void) {
mp_obj_t singleton = common_hal_board_get_i2c();
- if (singleton != NULL) {
+ if (singleton != NULL && !common_hal_busio_i2c_deinited(singleton)) {
return singleton;
}
assert_pin_free(DEFAULT_I2C_BUS_SDA);
@@ -69,7 +75,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c);
#if BOARD_SPI
mp_obj_t board_spi(void) {
mp_obj_t singleton = common_hal_board_get_spi();
- if (singleton != NULL) {
+ if (singleton != NULL && !common_hal_busio_spi_deinited(singleton)) {
return singleton;
}
assert_pin_free(DEFAULT_SPI_BUS_SCK);