0

Is there a way to use libpruio and/or libpruw1 (http://users.freebasic-portal.de/tjf/Projekte/libpruw1/doc/html/) in python? I want to make use of libpruw1 to reed (more than 10) ds18b20 as it seams to be much faster than the 'normal' way with dts file (discribed here http://www.bonebrews.com/temperature-monitoring-with-the-ds18b20-on-a-beaglebone-black/). It takes less than a sec for all sensors, rather than 0.7 sec for each sensor. And from what I understud it does not have the max_slave_count = 10 limitation.

SteffenUM
  • 3
  • 2

1 Answers1

1

1) Your ideas are correct: using libpruw1 you can sample 10 Dallas temperature sensors in approx 1 second and the number of sensors has no limit.

2) libpruw1 is based on libpruio (for pinmuxing). You'll need both libraries running.

3) In order to use them with python, you'll need python bindings (API wrappers) for both libraries.

So your main issue is to get the wrappers.

You can find some on the WWW, but only for libpruio (ie. https://gist.github.com/clouetb), AFAIK. You've to make sure that the wrapper matches your libpruio version.

Alternatively you can create the wrappers from the library sources by using SWIG (www.swig.org) for transforming the C bindings (pruio.h & pruw1.h).

There's another option using fb-doc. Find in the package an external module (https://github.com/DTJF/fb-doc/blob/master/src/bas/plugins/py_ctypes.bas) that can generate python bindings based on ctypes from the original FreeBASIC source code. Therefor it's best to use the latest versions published on https://github.com/DTJF/libpruio and https://github.com/DTJF/libpruw1.

TJF
  • 91
  • 1
  • 4
  • TJF, thank you for your answer. If I go for the SWIG option, does it take more than "just" generate those wrappers. Will I have to go through some of the preparation steps descriped here (http://users.freebasic-portal.de/tjf/Projekte/libpruw1/doc/html/ChaPreparation.html) – SteffenUM Dec 28 '17 at 18:42
  • I didn't publish a precompiled package for libpruw1 yet, so you'll have to go through the "M" labeled steps, in order to compile your binary. – TJF Dec 30 '17 at 07:28