Project

chip-gpio

0.0
No commit activity in last 3 years
No release in over 3 years
A ruby gem to control the IO hardware the CHIP computer
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0
 Project Readme

chip-gpio

A ruby gem for controlling the IO hardware on a $9 CHIP computer.

Can currently set output values and read input values from GPIO pins on CHIP computers running v4.3 or v4.4 images.

Supports a software SPI mode using the GPIO pins. This support is incomplete. See the TODO in SoftSpi.rb.

Installation

gem install chip-gpio

Examples

Initialize

require 'chip-gpio'
pins = ChipGPIO.get_pins

Export pins

pins[:XIO7].available? 
=> false

pins[:XIO7].export
pins[:XIO7].available? 
=> true

Set a value

pins[:XIO7].direction = :output
pins[:XIO7].value = 1
pins[:XIO7].value
=> 1

Read a value

pins[:XIO7].direction = :output
pins[:XIO7].value
=> 1