Jonas Maebe wrote:
Bo Berglund wrote on Wed, 07 Oct 2015:
I think that it really does because there must be some interface
between the FPC system and the underlying operating system managing
the hardware.
On Linux/Unix, every interface to hardware gets exposed as a file
(generally under /dev). Sometimes you have libraries that provide a
higher level interface, but in the end it will always access that file.
If you need root permissions to perform actions on this file with
language X, you will also need them with language Y and also if you use
library Z to access it. The file operations are basic POSIX operations
(open, read, write, ioctl, close), which are available with an "fp"
prefix via the baseunix and unix units, and which are the same in C or
other languages.
If you have a library that you want to use, then you can of course ask
here whether anyone has translated the headers for it (which will
probably be in C) to Pascal or so.
I've just been taking a look and I don't immediately see a kernel module
that provides an interface to GPIO via /dev. I think there's things for
I2C etc.
Via
http://wiki.freepascal.org/Lazarus_on_Raspberry_Pi#1._Native_hardware_access
I see mention of /sys/class/gpio etc. although I've not looked to see
what's implemented as standard. Using this interface requires membership
of the gpio group, which in principle answers Bo's question.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal