
Originally Posted by
defragster
... someone double check - but not sure T_4.x i2c SLAVE mode yet been completed.
Might confirm MASTER function with that code if there is a T_3.x or T_LC handy to act as slave.
Hi, I'm curious about this. Is it still uncertain if the Slaev functionality was completed?
I am trying to send data from a Teensy 4.1 as am I2C slave. Here is an image from a logic analyzer of what I am sending to it:


And I am using the basic example (just modifying the slave address):
Code:
#include <Arduino.h>
#include <i2c_driver.h>
#include <i2c_driver_wire.h>
void requestEvent();
int led = LED_BUILTIN;
void setup()
{
pinMode(led, OUTPUT);
Wire.begin(0x22);
Wire.onRequest(requestEvent); // register event
}
void loop()
{
delay(100);
}
// function that executes whenever data is requested by master
// this function is registered as an event, see setup()
void requestEvent()
{
digitalWrite(led, HIGH); // briefly flash the LED
Wire.write(0xFF);
digitalWrite(led, LOW);
}
I am using pins 16 and 17 as a slave I2C in the teensy. It seems that requestEvent() never kicks in though.
Thanks!