Skip to content

add possibility to pass in a Wire instance #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 11, 2020
Merged

Conversation

SunboX
Copy link

@SunboX SunboX commented Aug 9, 2020

This adds the possibility to pass in a Wire instance to be able to configure the clock speed / frequency and also the used IO pins.

SunboX added 4 commits August 10, 2020 00:50
This adds the possibility to pass in a Wire instance to be able to configure the clock speed / frequency and also the used IO pins.
@ladyada
Copy link
Member

ladyada commented Aug 10, 2020

looks good! what hardware did you test with?

@SunboX
Copy link
Author

SunboX commented Aug 10, 2020

Thanks! I tested with an ESP32 Dev Kit from AZ-Delivery and an MCP23017 Expansion Board from Waveshare

@ladyada
Copy link
Member

ladyada commented Aug 10, 2020

do you have an AVR board like UNO to check with?

@SunboX
Copy link
Author

SunboX commented Aug 10, 2020

I have to look into my box, but I might have none.

@ladyada
Copy link
Member

ladyada commented Aug 10, 2020

ok please do :) that will help a lot!

@SunboX
Copy link
Author

SunboX commented Aug 10, 2020

Ok, found one in one of my boxes. Will test it tomorrow.
IMG_20200810_214831

@ladyada
Copy link
Member

ladyada commented Aug 10, 2020

perfect :)

@SunboX
Copy link
Author

SunboX commented Aug 11, 2020

Ok, I tested it using an Arduino Uno and set the clock speed to 400khz. Here's my test code:

#include <Wire.h>
#include "Adafruit_MCP23017.h"

Adafruit_MCP23017 mcp;

void setup() {

    Wire.setClock(400000); // set frequency to 400khz

    mcp.begin(7, &Wire);

    mcp.pinMode(5, OUTPUT);
    mcp.digitalWrite(5, HIGH);
}

void loop() {

    delay(5000);

    mcp.digitalWrite(5, LOW);

    delay(5000);

    mcp.digitalWrite(5, HIGH);
}

And here's a video showing the test:
https://youtu.be/4aTDRAySRF4

Sadly I have no oscilloscope, so I could not validate if it runs @ 400khz.

@ladyada
Copy link
Member

ladyada commented Aug 11, 2020

sounds good, thanks!

@ladyada ladyada merged commit e92db5b into adafruit:master Aug 11, 2020
@SunboX
Copy link
Author

SunboX commented Aug 11, 2020

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants