HomeGenie Forum

Automation Program Plugins and Wizard Scripting => Raspberry Pi GPIO/SPI/I2C => Topic started by: Matt on February 23, 2015, 08:58:42 PM

Title: Using Spi to talk to external expansion unit
Post by: Matt on February 23, 2015, 08:58:42 PM
Hi,
I am creating an external expansion board for the pi  that I would like homegeni to communicate with via SPI. I can't seem to find an example code to do this.  Can someone please share a link or some code using the rasberry pi SPI port.

Thanks
Matt
Title: Re: Using Spi to talk to external expansion unit
Post by: Gene on February 23, 2015, 09:12:45 PM
One example could be EdenV2_Module_1_1.hgx available from:

https://sourceforge.net/projects/homegenie/files/testing/

this is used to talk to arduino via SPI. Also the arduino firmware is available for download.

Cheers,
g.
Title: Re: Using Spi to talk to external expansion unit
Post by: NickP on February 28, 2015, 09:57:22 PM
I just added a driver for the PiFaceDigital device to the genielabs raspberry-sharp-io. If Gene is happy it will get pulled in.

The driver uses native SPI to control the MCP23S17 port expander at the core of the PiFace.
Title: Re: Using Spi to talk to external expansion unit
Post by: Gene on February 28, 2015, 10:50:11 PM
Merged. I will update HomeGenie as well soon.
Thanks!

g.
Title: Re: Using Spi to talk to external expansion unit
Post by: Gene on February 28, 2015, 11:32:39 PM
I also forwarded a pull request to the raspberry-sharp-io master.
In the meantime, a couple of days ago, my fork was already integrated into the master, so you could have pulled in there.

Cheers,
g.
Title: Re: Using Spi to talk to external expansion unit
Post by: NickP on March 17, 2015, 03:25:45 AM
Thinking through this again; I believe it makes sense to create an abstract MCP23x17 class and derive MCP23017 from it (without breaking the current interface) then also derive an MCP23S17 (SPI ) class as well.

Updating the components that currently accept an MCP23017 to accept MCP23x17 would still work for existing code ( MCP12017 being a derivative) but also allow people to use MCP23S17 as well.

What do you think?