summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-04-12 13:42:35 +0100
committerDamien George <damien.p.george@gmail.com>2016-04-12 14:06:54 +0100
commitd083712224602372c5fd22d0b9e2b32efe6fa26b (patch)
tree49d2f865325a4684a9d23ba702fe702fe2244475 /py
parent53ad681ed1786601ca5eccb60f8fd950b8bc47d7 (diff)
downloadmicropython-d083712224602372c5fd22d0b9e2b32efe6fa26b.tar.gz
micropython-d083712224602372c5fd22d0b9e2b32efe6fa26b.zip
extmod: Add generic machine.I2C class, with bit-bang I2C.
Should work on any machine that provides the correct pin functions.
Diffstat (limited to 'py')
-rw-r--r--py/mpconfig.h4
-rw-r--r--py/py.mk1
-rw-r--r--py/qstrdefs.h20
3 files changed, 25 insertions, 0 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h
index bbf0555137..017030b0f4 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -837,6 +837,10 @@ typedef double mp_float_t;
#define MICROPY_PY_MACHINE (0)
#endif
+#ifndef MICROPY_PY_MACHINE_I2C
+#define MICROPY_PY_MACHINE_I2C (0)
+#endif
+
#ifndef MICROPY_PY_USSL
#define MICROPY_PY_USSL (0)
#endif
diff --git a/py/py.mk b/py/py.mk
index 3cfc6712a5..599850e3d4 100644
--- a/py/py.mk
+++ b/py/py.mk
@@ -167,6 +167,7 @@ PY_O_BASENAME = \
../extmod/moduhashlib.o \
../extmod/modubinascii.o \
../extmod/machine_mem.o \
+ ../extmod/machine_i2c.o \
../extmod/modussl.o \
../extmod/modurandom.o \
../extmod/modwebsocket.o \
diff --git a/py/qstrdefs.h b/py/qstrdefs.h
index d8c7ccc428..a2717d256d 100644
--- a/py/qstrdefs.h
+++ b/py/qstrdefs.h
@@ -681,6 +681,26 @@ Q(mem16)
Q(mem32)
#endif
+#if MICROPY_PY_MACHINE_I2C
+Q(I2C)
+Q(init)
+Q(scl)
+Q(sda)
+Q(freq)
+Q(scan)
+Q(start)
+Q(stop)
+Q(read)
+Q(readinto)
+Q(write)
+Q(readfrom)
+Q(readfrom_into)
+Q(writeto)
+Q(readfrom_mem)
+Q(readfrom_mem_into)
+Q(writeto_mem)
+#endif
+
#if MICROPY_PY_USSL
Q(ussl)
Q(wrap_socket)