diff --git a/esp8266/Makefile b/esp8266/Makefile
index 22591f209b0d726c834a1508a5e7e40397fa7855..0b498602f271e07861c2df7aa47e255792b8f589 100644
--- a/esp8266/Makefile
+++ b/esp8266/Makefile
@@ -78,6 +78,7 @@ SRC_C = \
 	modpybrtc.c \
 	modpybadc.c \
 	modpybuart.c \
+	modmachinespi.c \
 	modpybspi.c \
 	modpybhspi.c \
 	modesp.c \
diff --git a/esp8266/esp8266.ld b/esp8266/esp8266.ld
index 6c89858070eaba0bcdf45f8974ca650300a2a650..dec3bf5a30b63abf7ce6cb41991ed5c1b331ec2e 100644
--- a/esp8266/esp8266.ld
+++ b/esp8266/esp8266.ld
@@ -141,6 +141,7 @@ SECTIONS
         *modpybadc.o(.literal*, .text*)
         *modpybuart.o(.literal*, .text*)
         *modpybi2c.o(.literal*, .text*)
+        *modmachinespi.o(.literal*, .text*)
         *modpybspi.o(.literal*, .text*)
         *modpybhspi.o(.literal*, .text*)
         *hspi.o(.literal*, .text*)
diff --git a/esp8266/modmachine.c b/esp8266/modmachine.c
index 624ce2ac566863d09c66747bcac01bf8ce6e1ce9..7672834aaccdc5f7db2af1396fae79c1b65ff8b5 100644
--- a/esp8266/modmachine.c
+++ b/esp8266/modmachine.c
@@ -251,8 +251,9 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
     { MP_ROM_QSTR(MP_QSTR_ADC), MP_ROM_PTR(&pyb_adc_type) },
     { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&pyb_uart_type) },
     { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&machine_i2c_type) },
-    { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&pyb_spi_type) },
+    { MP_ROM_QSTR(MP_QSTR_SoftSPI), MP_ROM_PTR(&pyb_spi_type) },
     { MP_ROM_QSTR(MP_QSTR_HSPI), MP_ROM_PTR(&pyb_hspi_type) },
+    { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&machine_spi_type) },
 
     // wake abilities
     { MP_ROM_QSTR(MP_QSTR_DEEPSLEEP), MP_ROM_INT(MACHINE_WAKE_DEEPSLEEP) },
diff --git a/esp8266/modmachinespi.c b/esp8266/modmachinespi.c
new file mode 100644
index 0000000000000000000000000000000000000000..1c6a373698e7e8091b3f5ff3098b9ba7c3935f66
--- /dev/null
+++ b/esp8266/modmachinespi.c
@@ -0,0 +1,71 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Damien P. George
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "ets_sys.h"
+#include "etshal.h"
+#include "ets_alt_task.h"
+
+#include "py/runtime.h"
+#include "py/stream.h"
+#include "py/mphal.h"
+
+
+mp_obj_t pyb_spi_make_new(const mp_obj_type_t *type, size_t n_args,
+                          size_t n_kw, const mp_obj_t *args);
+mp_obj_t pyb_hspi_make_new(const mp_obj_type_t *type, size_t n_args,
+                           size_t n_kw, const mp_obj_t *args);
+
+
+STATIC mp_obj_t machine_spi_make_new(const mp_obj_type_t *type, size_t n_args,
+                                     size_t n_kw, const mp_obj_t *args) {
+    mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
+    switch (mp_obj_get_int(args[0])) {
+        case -1:
+            return pyb_spi_make_new(type, n_args - 1, n_kw, args + 1);
+        case 0:
+            return pyb_hspi_make_new(type, n_args - 1, n_kw, args + 1);
+        default:
+            nlr_raise(mp_obj_new_exception_msg_varg(
+                &mp_type_ValueError, "no such SPI peripheral"));
+    }
+}
+
+
+STATIC const mp_rom_map_elem_t machine_spi_locals_dict_table[] = {};
+
+STATIC MP_DEFINE_CONST_DICT(machine_spi_locals_dict,
+                            machine_spi_locals_dict_table);
+
+const mp_obj_type_t machine_spi_type = {
+    { &mp_type_type },
+    .name = MP_QSTR_SPI,
+    .make_new = machine_spi_make_new,
+    .locals_dict = (mp_obj_dict_t*)&machine_spi_locals_dict,
+};
diff --git a/esp8266/modpyb.h b/esp8266/modpyb.h
index 0eec556b159475f0c28cf4f0837c0db6bea52ad4..45d0bb8cfda59ee8f5d8000c42c9a6f7206c9b01 100644
--- a/esp8266/modpyb.h
+++ b/esp8266/modpyb.h
@@ -11,6 +11,7 @@ extern const mp_obj_type_t pyb_uart_type;
 extern const mp_obj_type_t pyb_i2c_type;
 extern const mp_obj_type_t pyb_spi_type;
 extern const mp_obj_type_t pyb_hspi_type;
+extern const mp_obj_type_t machine_spi_type;
 
 MP_DECLARE_CONST_FUN_OBJ(pyb_info_obj);
 
diff --git a/esp8266/modpybhspi.c b/esp8266/modpybhspi.c
index ad78c83fd8e5f3bd2b74e4e89193504711e10de7..f80fbae00ace44bd887702f960387a3eea85d138 100644
--- a/esp8266/modpybhspi.c
+++ b/esp8266/modpybhspi.c
@@ -106,7 +106,7 @@ STATIC void pyb_hspi_init_helper(pyb_hspi_obj_t *self, size_t n_args, const mp_o
     spi_mode(HSPI, self->phase, self->polarity);
 }
 
-STATIC mp_obj_t pyb_hspi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+mp_obj_t pyb_hspi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
     mp_arg_check_num(n_args, n_kw, 0, MP_OBJ_FUN_ARGS_MAX, true);
     pyb_hspi_obj_t *self = m_new_obj(pyb_hspi_obj_t);
     self->base.type = &pyb_hspi_type;
diff --git a/esp8266/modpybspi.c b/esp8266/modpybspi.c
index c2bcc33edce22e850f59038e4f794bf9d58cfba4..fafe3b2fa5bf1531deba19283138d13ba5a778be 100644
--- a/esp8266/modpybspi.c
+++ b/esp8266/modpybspi.c
@@ -131,7 +131,7 @@ STATIC void pyb_spi_init_helper(pyb_spi_obj_t *self, size_t n_args, const mp_obj
     mp_hal_pin_input(self->miso);
 }
 
-STATIC mp_obj_t pyb_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+mp_obj_t pyb_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
     mp_arg_check_num(n_args, n_kw, 0, MP_OBJ_FUN_ARGS_MAX, true);
     pyb_spi_obj_t *self = m_new_obj(pyb_spi_obj_t);
     self->base.type = &pyb_spi_type;
@@ -215,7 +215,7 @@ STATIC MP_DEFINE_CONST_DICT(pyb_spi_locals_dict, pyb_spi_locals_dict_table);
 
 const mp_obj_type_t pyb_spi_type = {
     { &mp_type_type },
-    .name = MP_QSTR_SPI,
+    .name = MP_QSTR_SoftSPI,
     .print = pyb_spi_print,
     .make_new = pyb_spi_make_new,
     .locals_dict = (mp_obj_dict_t*)&pyb_spi_locals_dict,