Recent

Author Topic: hwiringpi pascal wrapper with I2C support  (Read 11953 times)

pascalbythree

  • Sr. Member
  • ****
  • Posts: 255
hwiringpi pascal wrapper with I2C support
« on: September 10, 2017, 08:00:28 pm »
Hey can somebody send me the hwiringpi pascal wrapper with i2c functions/procedures in it?

to:

woutervanwegen@mijnplinq.nl

I did come accross the version before. Then i installed my I2C debug station as seen in the attached photo. And started coding again then i could not find the wrapper back with i2c support in it.

Thank you very Much, Greets Wouter van Wegen

pascalbythree

  • Sr. Member
  • ****
  • Posts: 255
Re: hwiringpi pascal wrapper with I2C support
« Reply #1 on: September 10, 2017, 08:26:14 pm »
Mzz... Found it back already!

Check this:

unit h2wiringpiI2c;

(* Pascal wrapper unit for Gordon Henderson wiringPi library. The source can
 * be found at https://http://wiringpi.com
 *
 * hwiringpi: origanal Wrapper and
 * pascal sample by Alex Schaller.
 *
 * h2wiringpiI2C: Version 0.1 By Allen Roton
 * wiringPi Version 2.23
 * $linklib
 *
 * wiringPi:
 *   Arduino compatable (ish) Wiring library for the Raspberry Pi
 *   Copyright (c) 2012 Gordon Henderson
 ***********************************************************************
 * This file is part of wiringPi:
 *   https://projects.drogon.net/raspberry-pi/wiringpi/
 *
 *    wiringPi is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation, either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    wiringPi is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with wiringPi.  If not, see <http://www.gnu.org/licenses/>.
 ***********************************************************************
 *)

//{$mode objfpc}{$H+}

{$linklib c}
{$linklib libwiringPi}
interface
    {
    }


//extern int wiringPiI2CRead           (int fd) ;
Function wiringPiI2CRead(fd : longint ):longint;cdecl;external;

//extern int wiringPiI2CReadReg8       (int fd, int reg) ;
Function wiringPiI2CReadReg8(fd : longint;reg : longint ):longint;cdecl;external;

//extern int wiringPiI2CReadReg16      (int fd, int reg) ;
Function wiringPiI2CReadReg16(fd : longint;reg : longint ):longint;cdecl;external;

//extern int wiringPiI2CWrite          (int fd, int data) ;
Function wiringPiI2CWrite(fd : longint;data : longint ):longint;cdecl;external;

//extern int wiringPiI2CWriteReg8      (int fd, int reg, int data) ;
Function wiringPiI2CWriteReg8(fd : longint;reg : longint ;data : longint ):longint;cdecl;external;

//extern int wiringPiI2CWriteReg16     (int fd, int reg, int data) ;
Function wiringPiI2CWriteReg16(fd : longint;reg : longint ;data : longint ):longint;cdecl;external;

//extern int wiringPiI2CSetupInterface (const char *device, int devId) ;
// ??? what is it ?

//extern int wiringPiI2CSetup          (const int devId) ;
Function wiringPiI2CSetup(devId : longint ):longint;cdecl;external;


implementation

end.


pascalbythree

  • Sr. Member
  • ****
  • Posts: 255
Re: hwiringpi pascal wrapper with I2C support
« Reply #2 on: September 10, 2017, 08:36:52 pm »
Now i am going to try to compile the damm thing.

ErekSin

  • New Member
  • *
  • Posts: 12
Re: hwiringpi pascal wrapper with I2C support
« Reply #3 on: May 06, 2018, 12:08:32 am »
Hi

I've been trying to get WiringPi working in Lazarus.
I'm using the same wrapper unit as pascalbythree, but as soon as I try to compile, I get the following linking error.  Any ideas much appreciated...

Thanks

/usr/bin/ld.bfd: warning: link.res contains output sections; did you forget -T?
/usr/bin/ld.bfd: /usr/lib/lazarus/1.2.4/components/lazutils/lib/arm-linux/fileutil.o: bad reloc symbol index (0x5a0000 >= 0x2da) for offset 0x3c in section `.rodata.n_VMT_FILEUTIL_TFILEITERATOR'
/usr/lib/lazarus/1.2.4/components/lazutils/lib/arm-linux/fileutil.o: error adding symbols: Bad value
test_envirophat.lpr(22) Error: Error while linking
test_envirophat.lpr(22) Fatal: There were 1 errors compiling module, stopping

 

TinyPortal © 2005-2018