geekhack

geekhack Projects => Making Stuff Together! => Topic started by: HotKillerZzz on Fri, 18 July 2014, 08:40:51

Title: How to use an I/O expander
Post by: HotKillerZzz on Fri, 18 July 2014, 08:40:51
How do you use an  MCP23018 "I/O expander" to link between two custom made hardwired diy ergo keyboard?
Title: Re: How to use an I/O expander
Post by: swill on Fri, 18 July 2014, 08:42:14
Subscribing. I will need to do this for my hand wired dox and I have not researched it yet.
Title: Re: How to use an I/O expander
Post by: trishume on Fri, 18 July 2014, 08:51:10
The ergodox firmware has a file that explains how the i/o expander works.

https://github.com/benblazak/ergodox-firmware/blob/master/src%2Fkeyboard%2Fergodox%2Fcontroller%2Fmcp23018.md (https://github.com/benblazak/ergodox-firmware/blob/master/src%2Fkeyboard%2Fergodox%2Fcontroller%2Fmcp23018.md)

You can also check out the source code for the ergodox firmware:

https://github.com/benblazak/ergodox-firmware/blob/master/src%2Fkeyboard%2Fergodox%2Fcontroller%2Fmcp23018.c (https://github.com/benblazak/ergodox-firmware/blob/master/src%2Fkeyboard%2Fergodox%2Fcontroller%2Fmcp23018.c)
Title: Re: How to use an I/O expander
Post by: HotKillerZzz on Fri, 18 July 2014, 10:01:34
Then how do you program the teensy to work tgt with it?
Title: Re: How to use an I/O expander
Post by: bcg on Fri, 18 July 2014, 23:05:19
Teensy is a ATmega 32u4 AVR, and can be programmed in C or using the Arduino IDE and libraries.  In either case you will need to write firmware to implement the IO logic, and then you can communicate with the IO expander using an I2C library.  Once your program compiles you load it onto the Teensy using their custom loader program (comes with the "Teensyduino" add on to the Arduino IDE) or via their command line loader (available from the PJRC website I believe).