登录 注册
当前位置:主页 > 资源下载 > 10 > Pascal版本的树莓派IO控制代码为rpi_hal

Pascal版本的树莓派IO控制代码为rpi_hal

  • 更新:2024-11-15 14:31:56
  • 大小:39KB
  • 推荐:★★★★★
  • 来源:网友上传分享
  • 类别:其它 - 移动开发
  • 格式:ZIP

资源介绍

功能强大,直接虐死wiringPi的树莓派IO之pascal代码,包括GPIO,I2C,PWM等控制。 rpi_hal-Hardware Abstraction Library (GPIO, I2C and SPI functions and procedures) This Unit with around 1700 Lines of Code provided by Stefan Fischer, delivers procedures and functions to access the rpi HW I2C, SPI and GPIO: Just an excerpt of the available functions and procedures: procedure gpio_set_pin (pin:longword;highlevel:boolean); { Set RPi GPIO pin to high or low level; Speed @ 700MHz -> 0.65MHz } function gpio_get_PIN (pin:longword):boolean; { Get RPi GPIO pin Level is true when Pin level is '1'; false when '0'; Speed @ 700MHz -> 1.17MHz } procedure gpio_set_input (pin:longword); { Set RPi GPIO pin to input direction } procedure gpio_set_output(pin:longword); { Set RPi GPIO pin to output direction } procedure gpio_set_alt (pin,altfunc:longword); { Set RPi GPIO pin to alternate function nr. 0..5 } procedure gpio_set_gppud (mask:longword); { set RPi GPIO Pull-up/down Register (GPPUD) with mask } ... function rpi_snr :string; { delivers SNR: 0000000012345678 } function rpi_hw :string; { delivers Processor Type: BCM2708 } function rpi_proc:string; { ARMv6-compatible processor rev 7 (v6l) } ... function i2c_bus_write(baseadr,reg:word; var data:databuf_t; lgt:byte; testnr:integer) : integer; function i2c_bus_read (baseadr,reg:word; var data:databuf_t; lgt:byte; testnr:integer) : integer; function i2c_string_read(baseadr,reg:word; var data:databuf_t; lgt:byte; testnr:integer) : string; function i2c_string_write(baseadr,reg:word; s:string; testnr:integer) : integer; ... procedure SPI_Write(devnum:byte; reg,data:word); function SPI_Read(devnum:byte; reg:word) : byte; procedure SPI_BurstRead2Buffer (devnum,start_reg:byte; xferlen:longword); procedure SPI_BurstWriteBuffer (devnum,start_reg:byte; xferlen:longword); { Write 'len' Bytes from Buffer SPI Dev startig at address 'reg' }