[Lazarus] Accessing GPIO on RaspberryPi2 from Lazarus/FPC

Bo Berglund bo.berglund at gmail.com
Sat Oct 10 00:31:07 CEST 2015


On Fri, 09 Oct 2015 07:31:52 +0000, Alfred <alfred at consulab.nl> wrote:

>Please have a look at:
>http://www.afterwarp.net/products/pxl
>https://github.com/yunkot/pxl
>
>Forum post:
>http://forum.lazarus.freepascal.org/index.php/topic,29852.0.html?PHPSESSID=bf43911005bf788ab072b3d73d1bfb4f
>
>Pxl is a very well written library, capable of doing a lot, with the 
>inclusion of hardware access on RPi(2) !
>
>See sample:
>https://github.com/yunkot/pxl/tree/master/Samples/FreePascal/SingleBoard/RaspberryPI

Very good suggestion, Thanks!

I noticed in the file PXL.Boards.RPi.pas the following note:

// The following option controls whether the code is optimized for
Raspberry PI 2.
{.$DEFINE RPi2}

And further down I found that this define controls the address used
for GPIO:
  FChipOffsetBase := {$IFDEF RPi2} $3F000 {$ELSE} $20000 {$ENDIF}; //
in pages (x 4096 bytes)

So it looks like it is going to solve my I/O control on the Pi2!
Now I just have to figure which files to copy over to the Pi for this
to work, the complete download is very big and most of it I really do
not need...


-- 
Bo Berglund
Developer in Sweden





More information about the Lazarus mailing list