Skip to content
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

Wire : New "begin" method for late call configuration #838

Merged
merged 12 commits into from
Dec 18, 2019

Conversation

jmchiappa
Copy link
Contributor

Summary

This PR implements the following feature
begin(uint8_t sda, uint8_t scl);

Why ?
In some libraries, it requires a late call for SDA/SCL configuration. Have a look on u8g2 library. This method is supported by modern 32 bits architecture (ESP12, ESP8266).

How to test ?

  1. Install u8g2 library

  2. Open Graphic test

  3. wire your OLED display to D6 (SCL) and D39 (SDA).

  4. uncomment the line U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE, /* clock=*/ 6, /* data=*/ 39); // ESP32 Thing, HW I2C with pin remapping

  5. compile and test

Known limitations
This needs to add defined(ARDUINO_ARCH_STM32) in u8g2 library in order to take benefits of this feature. The PR will be submitted very soon.

@fpistm fpistm added this to In progress in STM32 core based on ST HAL via automation Dec 18, 2019
@fpistm fpistm added this to the 1.8.0🎄 🎅 milestone Dec 18, 2019
@fpistm fpistm self-requested a review December 18, 2019 15:35
Copy link
Member

@fpistm fpistm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix astyle issue.
Else it seems reasonable and could avoid to use the setSDA/setSCL before Begin
Thanks

libraries/Wire/src/Wire.h Outdated Show resolved Hide resolved
STM32 core based on ST HAL automation moved this from In progress to Needs review Dec 18, 2019
STM32 core based on ST HAL automation moved this from Needs review to Reviewer approved Dec 18, 2019
@fpistm
Copy link
Member

fpistm commented Dec 18, 2019

@jmchiappa
Could you clean this PR to get only your change.
Thanks.

@jmchiappa
Copy link
Contributor Author

@jmchiappa
Could you clean this PR to get only your change.
Thanks.

@fpistm,
Sorry I don't know how to do that...

@fpistm
Copy link
Member

fpistm commented Dec 18, 2019

@jmchiappa
the main issue is that you made your PR on master. Then you pull the master.
So update you master to be inline with the original repo:

git remote add upstream https://github.com/stm32duino/Arduino_Core_STM32.git
git fetch upstream

then rebase your master on remote/upstream/master
git rebase -i upstream/master
Finally remove all unrelated commit and you can also squash the astyle fix.

You can see the Contributing.md for more details

@fpistm fpistm merged commit 48fcb38 into stm32duino:master Dec 18, 2019
STM32 core based on ST HAL automation moved this from Reviewer approved to Done Dec 18, 2019
@fpistm
Copy link
Member

fpistm commented Dec 18, 2019

@jmchiappa
by squashing your PR, it is ok.
Anyway, a best practice is to create branch base on the master to avoid having all pulled commit in the PR 😉

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

Successfully merging this pull request may close these issues.

None yet

3 participants