[Lazarus] PWM on raspberry pi

Koenraad Lelong lazarus2 at de-brouwerij.be
Wed Mar 9 09:57:16 CET 2016


Op 08-03-16 om 19:50 schreef Bo Berglund:
>
> In PiGpio I added the following (roundabout line #20:
>
> {$DEFINE RPi2}
>
> const
>    REG_GPIO = {$IFDEF RPi2} $3F000 {$ELSE} $20000
> {$ENDIF};//bcm2835/bcm2836 gpio register 0x2000 0000. new fpMap uses
> page offset, one page is 4096bytes
>
> then later down in the file (around line #150):
>
> function TIoDriver.MapIo: boolean;
> begin
>   Result := True;
>   {$IFDEF RPi2}
>     fd := fpopen('/dev/gpiomem', O_RdWr or O_Sync); // Open the master
> /dev/memory device
>   {$ELSE}
>     fd := fpopen('/dev/mem', O_RdWr or O_Sync); // Open the master
> /dev/memory device
>   {$ENDIF}
>
> I do not know for a fact tha the second change is because of the RPi2
> hardware, it was probably put there in order to make my program run as
> a normal user rather than su.
>
>
Well, that's what I did, although without the conditionals.
Did you try PWM, e.g. with the demo-program ? Does it work ?

Koenraad.




More information about the Lazarus mailing list