From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: =?UTF-8?Q?Bj=c3=b6rn_Lundin?= Newsgroups: comp.lang.ada Subject: Re: GNATCOLL-Mmap example Date: Fri, 31 Jan 2020 17:59:49 +0100 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Fri, 31 Jan 2020 16:59:50 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="cb991702d5a782de97bab459e9da31fb"; logging-data="18439"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/MQ3WLfTyBXUD7uDJ+thRO" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 Cancel-Lock: sha1:HiZh9VZ/ucNUx+JEr+xIBycbcT4= In-Reply-To: Content-Language: sv Xref: reader01.eternal-september.org comp.lang.ada:58003 Date: 2020-01-31T17:59:49+01:00 List-Id: Den 2020-01-28 kl. 19:53, skrev Bob Goddard: > On Tuesday, 28 January 2020 08:25:25 UTC, Dmitry A. Kazakov wrote: >> On 2020-01-25 22:52, Bob Goddard wrote: >> >>> I need to map the RPi's GPIO memory addresses so that I can do what I need to do. >> >> See files under: >> >> /sys/class/gpio >> >> You can use standard Ada I/O to read and set GPIO pins. E.g. >> >> /sys/class/gpio/gpio/XXX/value > > This was the way I started, but could not get it to read anything. It just blocks trying to read a single character. My c code works fine using the wiringPi libs. > > Or you just write a wrapper to wiringPi. I wrote one for _writing_ to gpio-pins it is at https://www.dropbox.com/s/svf6e3as0qyx5nr/gpio.zip?dl=0 and is _very_ simple. it has no support for reading, but that would be trivial to add add package Linker is for Default_Switches ("ada") use ("-L/usr/local/lib", "-lwiringPi"); end Linker; to your gpr-file assuming you are using gnat call Gpio.Setup first - then set mode of pin Gpio.Pin_Mode(pin, Gpio.Output); and the write to it Gpio.Digital_Write(Pin, False); I used it to write to a small stepper motor 28YBJ-48 -- Björn