@ -12,6 +12,7 @@
|
||||
|
||||
// needs global define
|
||||
#define DATA_STOP_BYTE 0x00
|
||||
#define DATA_RESET_BYTE 0xFF
|
||||
#define ROTATOR1_TRIGGER_BIT 1
|
||||
#define ROTATOR1_HIGH_BIT 2
|
||||
#define ROTATOR2_TRIGGER_BIT 4
|
||||
@ -95,6 +96,17 @@ void i2cRequest() {
|
||||
}
|
||||
}
|
||||
|
||||
void i2cReceive(int bytes) {
|
||||
for (int i = 0; i < bytes && Wire.available(); i++) {
|
||||
byte data = Wire.read();
|
||||
if (data == DATA_RESET_BYTE) {
|
||||
writerPos = readerPos = 0;
|
||||
} else {
|
||||
// nothing else yet implemented
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t address = 0;
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
@ -120,6 +132,7 @@ void setup() {
|
||||
|
||||
Wire.begin(address);
|
||||
Wire.onRequest(i2cRequest);
|
||||
Wire.onReceive(i2cReceive);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
Reference in New Issue
Block a user