Home.Raspberry Pi.Lazarus.Linux.Projects.Alternatives.Downloads.

DISCLAIMER & TERMS & CONDITIONS OF USAGE

THE INFORMATION ON THIS WEB SITE MAY BE FALSE, INACCURATE OR INCORRECT. PLEASE USE THE INFORMATION WITH

CAUTION - NO LIABILITY CAN BE ACCEPTED IN CASE OF LOSS OR DAMAGES INCURRED FOR ANY INJURY TO PERSONS OR FINANCIAL LOSS THROUGH THE USE OF THIS INTERNET SITE AS A SOURCE OF CREDIBLE INFORMATION. PLEASE VERIFY ALL PRESENTED FACTS ARE CORRECT INDEPENDENTLY.

How to use the pi_ioII unit.

 

This unit is for use with the Raspberry micro computer only as it directly accesses memory registers. It is a native Lazarus unit to control the Raspberry pi’s GPIO port and other Raspberry Pi hardware. The unit is very much a work in progress that I am adding to as and when the need arises and when I have time. I will probably put it in to a software repository in due course.

 

Classes

 

type EGPIO = class(Exception);     

 

 wrapper around the Exception class throw when errors relating to pi_ioII are thrown.

 

type PWM_CHANNEL = (PWM_1,PWM_2);

 

GPIO_MODE used to define the function of a GPIO (General Purpose Input / Output ) line.

 

type GPIO_MODE = (GPM_INPUT=0,GPM_OUTPUT=1,GPM_ALT5=2,GPM_ALT4=3,GPM_AL T0=4,GPM_ALT1=5, GPM_ALT2=6,GPM_ALT3=7);

 

GPIO_ALLOWED_MODES set of allowed modes a pin may have.

 

type GPIO_ALLOWED_MODES = set of GPIO_MODE;

 

Tpinpull  NO_PULL ( Floating ), PIO_PIN PULL_UP ( 3.3 v ),PULL_DOWN ( 0v )

 

type TPinPull =(NO_PULL=0,PULL_DOWN,PULL_UP);

 

Array of string

 

type StrArray = Array Of AnsiString;

 

Pointer To A Pointer

 

type pTOp = array[0..0] of Pointer;

 

{$IFNDEF USE_WIRING_PI}

procedure SetUpJumpTable(); //BUILDS A LIST OF POINTERS TO MEMORY VECTORS DO NOT CALL - CALLED DURING INITALIZATION IF WIRING PI ISN’T USED

procedure SetPWMDutyCycle(channel:PWM_Channel;Range:Cardinal;Duty:Single;direction:Boolean);

{$ENDIF}

function GetPort(pin:shortint):ShortInt;

function getPinP1(port:shortint):shortint;

procedure SetPinMode(pin:ShortInt;mode:GPIO_MODE;Owner:string='';PULL:TPinPull=NO_PULL);

procedure InitGPIO(Alt:ShortInt=0;Privileged:Boolean=true);

function ReadPin(pin:shortint):boolean;

procedure WritePin(pin:shortint;z:boolean);

procedure RestoreToSafeState();

procedure ReleasePin(pin:shortInt;Owner:string);

 

The pi_ioII Unit