From de30bf01a0e69bf0bedf6637b04b4868ac3b5130 Mon Sep 17 00:00:00 2001
From: Rahix <rahix@rahix.de>
Date: Mon, 19 Aug 2019 11:39:34 +0200
Subject: [PATCH] docs(pycardium): Document os module

Signed-off-by: Rahix <rahix@rahix.de>
---
 Documentation/index.rst        |  1 +
 Documentation/pycardium/os.rst | 45 ++++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)
 create mode 100644 Documentation/pycardium/os.rst

diff --git a/Documentation/index.rst b/Documentation/index.rst
index 28fb426c..27b0d56a 100644
--- a/Documentation/index.rst
+++ b/Documentation/index.rst
@@ -26,6 +26,7 @@ Last but not least, if you want to start hacking the lower-level firmware, the
    pycardium/display
    pycardium/leds
    pycardium/light-sensor
+   pycardium/os
    pycardium/utime
    pycardium/vibra
 
diff --git a/Documentation/pycardium/os.rst b/Documentation/pycardium/os.rst
new file mode 100644
index 00000000..5b450fd3
--- /dev/null
+++ b/Documentation/pycardium/os.rst
@@ -0,0 +1,45 @@
+.. py:module:: os
+
+``os`` - OS Functions
+=====================
+The ``os`` module allows access to a few core functionalities of Epicardium and functions found in CPythons ``os`` module.
+
+CPython-Like
+------------
+
+.. py:function:: os.unlink(path)
+
+   Unlink (remove) a file.
+
+   :param str path: The file to remove.
+
+.. py:function:: os.listdir(dir)
+
+   List contents of a directory.
+
+   :param str dir: Path to the directory to list.
+   :returns: A list of entities (files or subdirectories) in the directory
+      ``dir``.
+
+Epicardium-Specific
+-------------------
+
+.. py:function:: os.exit(ret = None)
+
+   Exit from the current app and return to the menu.
+
+
+   :param int ret: Optional return code, same semantics as Posix (``0`` means
+      success).
+   :return: This function will never return.
+
+.. py:function:: os.exec(name)
+
+   Try executing a new app, stopping the currently running one.
+
+   ``name`` is the path to either a l0dable (ending in ``.elf``) or a python
+   script (ending in ``.py``).  If the path does not lead to an executable file,
+   ``os.exec()`` will raise an exception.
+
+   :param str name: Path to new app/script/l0dable.
+   :return: This function never returns.  It can, however raise an exception.
-- 
GitLab