0

CircuitPython Trinket M0 supports i2c slave?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

CircuitPython Trinket M0 supports i2c slave?

by itsnotme on Sat Apr 13, 2019 10:40 pm

I am trying to use the Trinket M0 as a i2c slave in circuitpython but I don't seem to be able to find any documentation of where the i2cslave module is located?

Or is it not possible to do i2cslave on the Trinket M0?

itsnotme
 
Posts: 4
Joined: Sun Oct 21, 2012 2:42 am

Re: CircuitPython Trinket M0 supports i2c slave?

by adafruit_support_mike on Mon Apr 15, 2019 12:10 am

The Wire library supports operation as an I2C slave, you just use a different set of functions.

Once you've selected the Trinket M0 as your target device, the File->Examples menu will have a section labeled 'Examples for Adafruit Trinket M0'. Under the Wire item you'll find examples named 'slave_receiver' and 'slave_sender'.

adafruit_support_mike
 
Posts: 59156
Joined: Thu Feb 11, 2010 2:51 pm

Re: CircuitPython Trinket M0 supports i2c slave?

by itsnotme on Mon Apr 15, 2019 1:51 am

Are you referring to the Arduino Wire library?

I was hoping there would be something in the CircuitPython libraries to use?

itsnotme
 
Posts: 4
Joined: Sun Oct 21, 2012 2:42 am

Re: CircuitPython Trinket M0 supports i2c slave?

by itsnotme on Mon Apr 15, 2019 1:57 am

For some further clarification I was referring to this: https://circuitpython.readthedocs.io/en ... nit__.html

I can't seem to tell if this is available to the Trinket M0 board?

itsnotme
 
Posts: 4
Joined: Sun Oct 21, 2012 2:42 am

Re: CircuitPython Trinket M0 supports i2c slave?

by danhalbert on Mon Apr 15, 2019 10:33 am

I2CSlave is not included in the Trinket M0 build for space reasons. You could build your own version of CircuitPython for Trinket M0 which removed other functionality to make room for I2CSlave. For instance, if you don't need analogio or pulseio, you could turn those off.

Take a look here and see if you want to do this, and we can provide more guidance if you do: https://learn.adafruit.com/building-circuitpython

danhalbert
 
Posts: 1737
Joined: Tue Aug 08, 2017 12:37 pm

Re: CircuitPython Trinket M0 supports i2c slave?

by itsnotme on Sat Apr 20, 2019 1:29 am

Followed the article and was able to build the default builds to get a baseline.

Would like some advice on how to remove components, I did try doing CIRCIUITPY_ANALOGIO = 0 but got some errors from that when trying to do a build.

I also have the circuit playground express so I tried enabling the i2cslave on there since it had the option in there already, but as you said its a bit large so that build went over size.

itsnotme
 
Posts: 4
Joined: Sun Oct 21, 2012 2:42 am

Re: CircuitPython Trinket M0 supports i2c slave?

by danhalbert on Sat Apr 20, 2019 9:28 am

Please post your errors. I just did `CIRCUITPY_ANALOGIO = 0` in ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk and it built with no errors.

danhalbert
 
Posts: 1737
Joined: Tue Aug 08, 2017 12:37 pm

Please be positive and constructive with your questions and comments.