python: include examples page for sphinx documentation that links to src examples
authorBrendan Le Foll <brendan.le.foll@intel.com>
Tue, 20 May 2014 14:39:58 +0000 (15:39 +0100)
committerBrendan Le Foll <brendan.le.foll@intel.com>
Tue, 20 May 2014 14:39:58 +0000 (15:39 +0100)
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
README.md
examples/python/hello_gpio.py
src/python/docs/example.rst [new file with mode: 0644]
src/python/docs/index.rst

index 9d6b0dc..334e8f5 100644 (file)
--- a/README.md
+++ b/README.md
@@ -27,7 +27,8 @@ cmake and default system libraries are technically required to compile.
 module so comment out add_directories(javacsript) in src/CmakeLists.txt)
 4. doxygen (needed to generate even python doc)
 5. sphinx
-6. pydoc
+6. pygments
+7. pydoc
 
 To install swig-v8 the swig-v8-git package from AUR is helpful.
 
index 5eb58a5..cacee8a 100644 (file)
@@ -24,4 +24,7 @@
 
 import pymaa
 
+print (pymaa.getVersion())
 x = pymaa.Gpio(13)
+x.dir(pymaa.DIR_OUT)
+x.write(1)
diff --git a/src/python/docs/example.rst b/src/python/docs/example.rst
new file mode 100644 (file)
index 0000000..ab25c1d
--- /dev/null
@@ -0,0 +1,25 @@
+#######
+Example
+#######
+Here are some examples of how to use pymaa, common convention is to import pymaa as maa to keep it short but feel free to import it globally!
+
+Hello GPIO
+==========
+
+Here is the simplest Gpio program in pymaa.
+
+.. literalinclude:: ../../../examples/python/hello_gpio.py
+  :prepend: import pymaa
+  :start-after: import pymaa
+
+GPIO Interupt (isr)
+===================
+
+The GPIO module allows you to set an interupt on a GPIO. This interupt is controlled by the mode that the 'edge' is in.
+
+**Note:** Galileo Gen1 only supports EDGE_BOTH
+
+.. literalinclude:: ../../../examples/python/hello_isr.py
+  :prepend: import pymaa as maa
+  :start-after: import pymaa as maa
+
index b95cfa8..7e0f2ea 100644 (file)
@@ -9,9 +9,10 @@ Welcome to Pymaa's documentation!
 Contents:
 
 .. toctree::
-   :maxdepth: 4
+   :maxdepth: 2
 
    pymaa
+   example
 
 
 Indices and tables