Skip to content

Commit

Permalink
Changes:
Browse files Browse the repository at this point in the history
-digitalRead / digitalWrite for compatibility

New:
- SPI examle for MCP23S17
  • Loading branch information
pi authored and pi committed Jul 8, 2014
1 parent ec9b908 commit 201e068
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 25 deletions.
26 changes: 2 additions & 24 deletions bananaIO/MCP23S17Example.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,40 +84,18 @@ void SpiConfigure(int address, enum PortDirection portDirection) {
void Test() {

Initialize();

ConfigurePinDirection(PIN23, PinDirectionOutput);
WritePinValue(PIN23, 1);
WritePinValue(PIN23, 0);
WritePinValue(PIN23, 1);

newOutput(PIN23);

digitalWrite(PIN23, 0);
digitalWrite(PIN23, 1);

WritePinValue(PIN23,0);
WritePinValue(PIN23,1);




newOutput(PIN_CLOCK);
newOutput(PIN_MOSI);
newOutput(PIN_MISO);
newOutput(PIN_CS);

/*
pinMode(PIN_CLOCK, OUTPUT);
pinMode(PIN_CS, OUTPUT);
pinMode(PIN_MISO, OUTPUT);
pinMode(PIN_MOSI, OUTPUT);
*/

SpiConfigure(0, PortDirectionOutput);

int loopIndex = 0, value = 1;
for (loopIndex; loopIndex < 9; loopIndex++) {
SpiWrite(0, MCP23S17_REGISTER_PORT_A, value);
value = value << 1; // (loopIndex % 2);
value = value << 1;
sleep(1);
}

Expand Down
1 change: 0 additions & 1 deletion bananaIO/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <stdio.h>
#include <stdlib.h>

#include "MCP23S17Example.h"


int main(int argc, char** argv) {
Expand Down

0 comments on commit 201e068

Please sign in to comment.