From acb9e8d426aa22d60985e1823279924411776082 Mon Sep 17 00:00:00 2001
From: ch3 <ch3@mailbox.org>
Date: Mon, 8 Jul 2019 22:23:21 +0200
Subject: [PATCH] chore(pycardium): Make (defunct) open() available

---
 pycardium/mpconfigport.h | 4 ++++
 pycardium/mphalport.c    | 1 +
 2 files changed, 5 insertions(+)

diff --git a/pycardium/mpconfigport.h b/pycardium/mpconfigport.h
index c4199e63..9628e3cc 100644
--- a/pycardium/mpconfigport.h
+++ b/pycardium/mpconfigport.h
@@ -39,6 +39,10 @@ typedef unsigned mp_uint_t; /* must be pointer size */
 
 typedef long mp_off_t;
 
+/* extra built in names to add to the global namespace */
+#define MICROPY_PORT_BUILTINS \
+    { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
+
 /*
  * Make a pointer to RAM callable (eg set lower bit for Thumb code)
  * (This scheme won't work if we want to mix Thumb and normal ARM code.)
diff --git a/pycardium/mphalport.c b/pycardium/mphalport.c
index b6d3465b..91064177 100644
--- a/pycardium/mphalport.c
+++ b/pycardium/mphalport.c
@@ -116,6 +116,7 @@ mp_import_stat_t mp_import_stat(const char *path)
 mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs)
 {
 	/* TODO: Once fs is implemented, get this working as well */
+	mp_raise_NotImplementedError ("FS is not yet implemented");
 	return mp_const_none;
 }
 MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open);
-- 
GitLab