Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 63 additions and 2 deletions.
  1. +63 −2 firmware/firmware.cpp
View
65 firmware/firmware.cpp
@@ -53,7 +53,7 @@ void loop() {
if(DEBUG)
Serial.println("Action received: "+('0'+action));
char charVal;
- int pin, mode, val, type, speed;
+ int pin, mode, val, type, speed, address, stop;
switch (action) {
case 0x00: // pinMode
pin = client.read();
@@ -211,7 +211,68 @@ void loop() {
SPI.setDataMode(SPI_MODE3);
}
break;
- default:
+
+ case 0x24: // SPI.transfer
+ val = client.read();
+ SPI.transfer(val);
+ break;
+
+
+ // Wire API
+ case 0x30: // Wire.begin
+ address = client.read();
+ if (address == 0) {
+ Wire.begin();
+ } else {
+ Wire.begin(address);
+ }
+ break;
+ case 0x31: // Wire.requestFrom
+ address = client.read();
+ int quantity = client.read();
+ stop = client.read();
+
+ Wire.requestFrom(address, quantity, stop);
+ break;
+ case 0x32: // Wire.beginTransmission
+ address = client.read();
+ Wire.beginTransmission(address);
+ break;
+ case 0x33: // Wire.endTransmission
+ stop = client.read();
+ val = Wire.endTransmission(stop);
+ client.write(0x33);
+ client.write(val);
+ break;
+ case 0x34: // Wire.write
+ len = client.read();
+ char wireData[len];
+ for (i = 0; i< len; i++) {
+ wireData[i] = client.read();
+ }
+ val = Wire.write(data, len);
+ client.write(0x34);
+ client.write(val);
+ break;
+ case 0x35: // Wire.available
+ val = Wire.available();
+ client.write(0x35);
+ client.write(val);
+ break;
+ case 0x36: // Wire.read
+ val = Wire.read();
+ client.write(0x36);
+ client.write(val);
+ break;
+
+
+
+
+
+
+
+
+ default: // noop
break;
}
}

No commit comments for this range

Something went wrong with that request. Please try again.