summaryrefslogtreecommitdiff
path: root/liboctopus/python/demos/eeprom_i2c.py
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2011-10-11 21:50:49 +0200
committerYves Fischer <yvesf-git@xapek.org>2011-10-11 21:50:49 +0200
commit324c5ba9098c1010d0aa8c1e26b95509878ce9f2 (patch)
treef6ef2d537decaa2e1af6d4b9c4c31161b22333ec /liboctopus/python/demos/eeprom_i2c.py
downloadmini-octopus-324c5ba9098c1010d0aa8c1e26b95509878ce9f2.tar.gz
mini-octopus-324c5ba9098c1010d0aa8c1e26b95509878ce9f2.zip
Mini-Octopus build from r@171
Diffstat (limited to 'liboctopus/python/demos/eeprom_i2c.py')
-rw-r--r--liboctopus/python/demos/eeprom_i2c.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/liboctopus/python/demos/eeprom_i2c.py b/liboctopus/python/demos/eeprom_i2c.py
new file mode 100644
index 0000000..17707a4
--- /dev/null
+++ b/liboctopus/python/demos/eeprom_i2c.py
@@ -0,0 +1,36 @@
+# blink_i2c.py
+# laesst die led des i2c (0x10) blinken
+
+from octopus import *
+import time
+
+
+op=octopus_context()
+octopus_init(op)
+octopus_open(op)
+octopus_i2c_init(op)
+octopus_i2c_set_bitrate(op,3) # 100khz
+
+
+octopus_i2c_send_start(op)
+octopus_i2c_send_byte(op,0xae,1)
+octopus_i2c_send_byte(op,1,1)
+octopus_i2c_send_byte(op,0,1)
+octopus_i2c_send_byte(op,0x77,1)
+octopus_i2c_send_stop(op)
+
+
+
+octopus_i2c_send_start(op)
+octopus_i2c_send_byte(op,0xae,1)
+octopus_i2c_send_byte(op,1,1)
+octopus_i2c_send_byte(op,0,1)
+octopus_i2c_send_start(op)
+
+octopus_i2c_send_byte(op,0xaf,1)
+
+print octopus_i2c_receive_byte(op,1,1)
+
+octopus_i2c_send_stop(op)
+
+