On 30/11/2019 16:38, druck wrote:
> On 23/11/2019 08:55, R.Wieser wrote:
>> Hello all,
>>
>> I've got a few I2C modules (clock, temperature sensor, etc) that I would
>> like to access using different programs.
>>
>> The question is: how do I allow multiple programs to access the same I2C
>> bus, but not interfering with each other ?
>
> Normally for a device which requires reading and writng you would create
> a driver providing an API to clients, which would serialise access to
> the device.
>
> However if it is only reading the value of sensors, it is probably
> easiest to have one program which regular reads the values, and
> publishes them for other programs to use.
>
> For example, to get a running average of the CPU temperature over a
> period of 15 minutes, I wrote a python program which runs as a daemon at
> start up, reading the CPU temperature every second calculating the
> running average, min and max values. The values are read by running
> another instance of the program which communicates with the daemon
> instance via a named pipe.
>
I actually did something simuilar to get data from a sound deamon back
to a contrilling web browser, but I didn't use a pipe. I created a
ramdiosk of a few K and mounted that and wrote a file in it. Daemon
writes: browser reads.
Very simple.
Cant ever fill up. It just gets overwritten by 'current state' every so
often...
> ---druck
--
Of what good are dead warriors? … Warriors are those who desire battle
more than peace. Those who seek battle despite peace. Those who thump
their spears on the ground and talk of honor. Those who leap high the
battle dance and dream of glory … The good of dead warriors, Mother, is
that they are dead.
Sheri S Tepper: The Awakeners.
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|