* * *

Author Topic: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library  (Read 37469 times)

Handoko

  • Hero Member
  • *****
  • Posts: 1425
  • My goal: build my own game engine using Lazarus
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #90 on: March 19, 2017, 03:21:31 am »
Sorry if it is off topic.

I know Raspberry Pi isn't expensive, I want to join the fun. But before I buy one, I wonder what you guys do with your Raspberry Pi?

Cyrax

  • Hero Member
  • *****
  • Posts: 519
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #91 on: March 19, 2017, 04:46:53 am »
How about making your own smartphone? https://hackaday.io/project/19035-zerophone-a-raspberry-pi-smartphone

Idea is tempting and I have put some thought on it.

Thaddy

  • Hero Member
  • *****
  • Posts: 4278
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #92 on: March 19, 2017, 05:39:39 am »
- I have used a RPi3 - a a bet - as my main computer for almost 8 months.... And it did not disappoint.
- Build server consists of 4 RPi3's for a total of 16 threads. Builds kernels and FPC-Lazarus
- My daughter (almost 9) uses one for all kinds of stuff and MineCraft.
- My RPi -1 and 2's are used for robotics and home automation and what not.
- I also tried an OrangePi. (Really cheap but NOT recommended: bad user experience, functions as door-opener)
- There must be about 9 in total in the house + one broken. And one camera.
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

DonAlfredo

  • Hero Member
  • *****
  • Posts: 716
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #93 on: March 19, 2017, 10:44:05 am »
50+ in use for rechargeable battery testing: running 24/7 for 2 years !
Arch Linux + FPC/Laz app, cross-compiled from Windows.
Not a single failure with read-only Linux file system.

sky_khan

  • Guest
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #94 on: March 19, 2017, 11:37:38 am »
I know Raspberry Pi isn't expensive, I want to join the fun. But before I buy one, I wonder what you guys do with your Raspberry Pi?

I have a RPi2 attached to 2TB external disk. Its my low cost, low power 7/24 personal network server.  File server + scm server + dlna server.

ertank

  • Full Member
  • ***
  • Posts: 114
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #95 on: March 19, 2017, 01:13:24 pm »
The most known advantage of Raspberry Pi is having access to sensors, camera and alike hardware. On the other hand, you can use expensive industrial sensors, too.

I am trying to earn money with Raspberry Pi 3. Working on a software project for a device using Raspberry Pi with sensors. Device is targeted for a health sector which will count wasted material after surgeries and save some information into a database.

Just be informed that sensors Raspberry Pi uses are need to be digital for the best practice. They also need to be at certain voltage levels or else you may burn GPIO port of your Raspberry Pi.

Thaddy

  • Hero Member
  • *****
  • Posts: 4278
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #96 on: March 19, 2017, 01:22:42 pm »
Name the voltage level: 3.3V.
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

sfischer

  • New member
  • *
  • Posts: 35
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #97 on: March 19, 2017, 02:28:01 pm »
@mark,

pls. use SPI_Transfer. The SPI BufferSize is limited to 64Byte (pls. see SPI_BUF_SIZE_c). If you want to transfer more bytes, you have to split the IO into several 64Byte chunks. Your question about BaseReg. This is legacy and it comes from the idea, to address the register within a spi device. e.g write 2Bytes (e.g. 0x1234) to controlregister (0x01). in general it's a 3Byte transfer. SPI_Transfer is more basic and just transfers all at once. e.g SPI_Transfer(<bus>,<adr>,<cmdstring>); e.g SPI_Transfer($00,$00,#$01+#$12+#$34); or SPI_Transfer($00,$00,char($01)+char($12)+char($34)); This will transfer the data 0x011234 to an SPI-Device with ChipEnable0 (HW-Pin CE0) which is connected to SPI-Bus 0. The maximal length of <cmdstring> is SPI_BUF_SIZE_c=64.
If you want to see examples, pls. look for procedures/functions '_test' e.g. SPI_Loop_Test within rpi_hal.

hope this helps,
Stefan

enko

  • New member
  • *
  • Posts: 21
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #98 on: July 20, 2017, 06:57:38 pm »
Hello, I'm try to understand how to use Raspberry GPIO.
I've installed last release of Lazarus on a Rasperry Pi3 Model B
Create a project with Form + 2 TButton + TMemo
Project -> Project Options ... -> Compiler Options -> Other add: -dUseCThreads 
uses sequence : cthreads, rpi_hal, pfio, ecc
First Button execute this code without errors
  Memo1.Lines.Add('SERIAL NUMBER : ' + rpi_snr);
  Memo1.Lines.Add('HW            : ' + RPI_hw); // BCM2708
  Memo1.Lines.Add('PROCESSOR     : ' + RPI_proc); // ARMv6-compatible processor rev 7 (v6l)
  Memo1.Lines.Add('MIPS          : ' + RPI_mips); // 697.95
  Memo1.Lines.Add('REVISION      : ' + RPI_rev); // rev1;256MB;1000002
  Memo1.Lines.Add('FREQUENCY     : ' + RPI_freq); // 700000;700000;900000;Hz   

Second Button execute this code quitting from the app
 if RPI_HW_Start([InitHaltOnError,InitGPIO]) then
  begin   
  // NOTHING 
  end
  else
  Memo1.Lines.Add('ERROR, something went wrong with RPI_HW_Start');

Can anyone help me ?
I need set some compiling directive ?
I net configure hardware ?
I'm newbie on linux and raspberry

Can anyone provide to me a working example ?
Thanks for all.
Enrico
Simply a Italian Programmer

avra

  • Hero Member
  • *****
  • Posts: 1072
    • Additional info
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #99 on: July 21, 2017, 11:32:23 am »
ct2laz - Easily convert components and projects between Lazarus and CodeTyphon

Thaddy

  • Hero Member
  • *****
  • Posts: 4278
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #100 on: July 21, 2017, 01:25:59 pm »
Can anyone help me ?
Is it the same if run as root?

You can find more info at http://wiki.freepascal.org/Lazarus_on_Raspberry_Pi#Accessing_external_hardware
No that's not the same as root.. Why is everybody spreading that rumor over and over again.
Linux allows to create a user for a specific piece of hardware or software that requires elevation or that can be accessed and run by or through a normal user.

You don't need root. You need an update on access rights. I hate that. People may start to believe it....

Anyway @ OP Give me some compilable code. I am on an RPi for half a day's time or more.
« Last Edit: July 21, 2017, 01:28:04 pm by Thaddy »
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

enko

  • New member
  • *
  • Posts: 21
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #101 on: July 21, 2017, 03:25:08 pm »
Hi, I do not have many skills in the linux world and certain things considered simple are not for me
To solve my problem if I have my application named TEST in  /home/pi/Desktop/TEST path i need input in terminal
sudo chown root /home/pi/Desktop/TEST/TEST
sudo chmod +s /home/pi/Desktop/TEST/TEST

is right, or iI misses something ?
E.
Simply a Italian Programmer

avra

  • Hero Member
  • *****
  • Posts: 1072
    • Additional info
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #102 on: July 22, 2017, 08:14:05 pm »
No that's not the same as root.. Why is everybody spreading that rumor over and over again.
Linux allows to create a user for a specific piece of hardware or software that requires elevation or that can be accessed and run by or through a normal user.
You don't need root. You need an update on access rights.
A little more attention could be appreciated when reading. My question "Is it the same if run as root?" was just to do basic troubleshooting and to determine if executable would run without problems if started as root. If this simple troubleshooting succeeded then, and only then we would discuss what is the best way to do it. And wiki has a lot about proper way of handling this situation.
ct2laz - Easily convert components and projects between Lazarus and CodeTyphon

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus