Skip to content

trombik/libmpsse-ruby

 
 

Repository files navigation

LibMpsse binding for ruby

Build Status

Description

Ruby bindings for libmpsse.

With ruby and FT2232 (or any other variants like FT232H), your code can speak I2C and SPI, or bitbang, over USB. Breakout boards are available at digikey (27 USD), aliexpress (13 USD), and many others. The chip supports 3.3 V and 5 V devices. Now you can read values from BME280.

Prerequisites

Current status

Mode Status
Bitbang In progress
I2C Implemented
SPI Implemented

Synopsis

#!/usr/bin/env ruby
require 'libmpsse'

# read a value from 8 bit register

register = 0x01
device = LibMpsse::I2CDevice.new(adress: address)
value = device.read8(register)
puts format('address: 0x%0.2x: register: 0x%0.4x: 0x%0.2x', address, register, value)

YARD documentation is available at: github Pages

For more examples, see examples.

About

A ruby FFI wrapper around libmpsse

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 99.8%
  • Shell 0.2%