more G-Labs products

Author Topic: Using Spi to talk to external expansion unit  (Read 1784 times)

February 23, 2015, 08:58:42 PM
Read 1784 times

Matt

  • *
  • Information
  • Newbie
  • Posts: 1
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

February 23, 2015, 09:12:45 PM
Reply #1

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
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.

February 28, 2015, 09:57:22 PM
Reply #2

NickP

  • *
  • Information
  • Newbie
  • Posts: 24
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.

February 28, 2015, 10:50:11 PM
Reply #3

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Merged. I will update HomeGenie as well soon.
Thanks!

g.

February 28, 2015, 11:32:39 PM
Reply #4

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
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.

March 17, 2015, 03:25:45 AM
Reply #5

NickP

  • *
  • Information
  • Newbie
  • Posts: 24
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?