Pi gforth interface

Here is a gforth interface for the bcm2835 C library as used in Raspberry Pi.

Version 125 defines gforth interfaces for all of the functions in the bcm2835-1.25 library, with gforth names like pi_gpio_write corresponding to the C function name bcm2835_gpio_write. gforth words are also defined to retrieve the base addresses of the peripheral registers: pi_gpio, pi_pwm, pi_clk, pi_pads, pi_spi0, pi_st, pi_bsc0, pi_bsc1.

Installation (creates /usr/local/lib/libpi.so and /usr/local/include/pi.h):

  tar zxvf pi.tar.gz
  cd pi
  make
  sudo make install
After installation, start gforth as root using pi.fs:
  sudo gforth pi.fs ...
Example using blink.fs (which provides a blink command to turn pin P1-11 (GPIO 17) on/off once per second, 10 times), and spi.fs (which provides a spi command to transfer a byte to and from an SPI device):
  sudo gforth pi.fs blink.fs spi.fs
  blink
  spi
pi.tar.gz - download

src - browse files

References:
http://www.open.com.au/mikem/bcm2835/ - C library for Broadcom BCM 2835 as used in Raspberry Pi
http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/ - Gforth Manual
  section 5.25 - C Interface