The branch, master has been updated
via 4b7a5e13ce22e8e1c1f3d1ee01ae4c5f26f07657 (commit)
from 2d790e377ad5f1c61b38436aa3d5a201c9184028 (commit)
- Log -----------------------------------------------------------------
commit 4b7a5e13ce22e8e1c1f3d1ee01ae4c5f26f07657
Author: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
Date: Thu Sep 29 22:46:43 2011 +0200
Add example code demonstrating how to use the python wrapper
-----------------------------------------------------------------------
Summary of changes:
examples/python/simple.py | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
create mode 100644 examples/python/simple.py
diff --git a/examples/python/simple.py b/examples/python/simple.py
new file mode 100644
index 0000000..fe4babc
--- /dev/null
+++ b/examples/python/simple.py
@@ -0,0 +1,26 @@
+"""Python example program.
+
+Small program to demonstrate the usage
+of the swig generated python wrapper
+
+You need to build and install the wrapper first"""
+
+import ftdi
+
+def main():
+ """Main program"""
+ context = ftdi.ftdi_context()
+ ftdi.ftdi_init(context)
+
+ version_info = ftdi.ftdi_get_library_version()
+ print("[FTDI version] major: %d, minor: %d, micro: %d" \
+ ", version_str: %s, snapshot_str: %s" %
+ (version_info.major, version_info.minor, version_info.micro,
+ version_info.version_str, version_info.snapshot_str))
+
+ print("ftdi_open(): %d" % ftdi.ftdi_usb_open(context, 0x403, 0x6010))
+ print("ftdi_set_baudrate(): %d" % ftdi.ftdi_set_baudrate(context, 9600))
+
+ ftdi.ftdi_deinit(context)
+
+main()
hooks/post-receive
--
port libftdi to libusb-1.0
--
libftdi-git - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi-git+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|