libpruio  0.6.8
Fast and easy Digital/Analog Input/Output for Beaglebones
1.py
Go to the documentation of this file.
1 #!/usr/bin/python
2 
15 
16 
17 from __future__ import print_function
18 from libpruio import *
19 
20 
21 io = pruio_new(PRUIO_DEF_ACTIVE, 4, 0x98, 0)
22 try:
23 
24  IO = io.contents
25  if IO.Errr: raise AssertionError("pruio_new failed (%s)" % IO.Errr)
26  if pruio_config(io, 1, 0x1FE, 0, 4): # upload settings, start IO mode
27  raise AssertionError("config failed (%s)" % IO.Errr)
28 
29  AdcV = IO.Adc.contents.Value
30  for n in range(13): # print some lines
31  for i in range(1, 9): # all steps
32  print("%4X" % AdcV[i], end=" ") # output one channel in hex
33  print() # next line
34 finally:
35  pruio_destroy(io)
char * pruio_config(pruIo *Io, uint32 Samp, uint32 Mask, uint32 Tmr, uint16 Mds)
Wrapper function for PruIo::config().
pruIo * pruio_new(uint16 Act, uint8 Av, uint32 OpD, uint8 SaD)
Wrapper function for the constructor PruIo::PruIo().
void pruio_destroy(pruIo *Io)
Wrapper function for the destructor PruIo::~PruIo().