Repository navigation
Add I2C bus selection (TwoWire*) constructor; fix si5351_vcxo example - #107
Merged
Merged
Conversation
Si5351(TwoWire *wire = &Wire, uint8_t i2c_addr = SI5351_BUS_BASE_ADDR) selects the bus; Si5351(uint8_t) still selects Wire. init(), the device probe and all reads/writes go through the selected bus. init() still calls begin() with no arguments so ESP32 setPins()/RP2040 setSDA() choices are kept.
- Integer-address overloads so Si5351(0), Si5351(NULL) and any integer type select the address path as before (no ambiguity with TwoWire *) - Null TwoWire * falls back to Wire - Shared setup_obj() helper instead of a C++11 delegating constructor - README: begin() re-runs in init() on non-ESP32 cores and may reset setClock(), so call setClock() after init(); mark setPins() ESP32-only; changelog uses SI5351_BUS_BASE_ADDR
- nullptr or (TwoWire *)0 selects Wire via the bus constructor; NULL/0 mean address 0 - Note the harmless ESP32 'Bus already started in Master Mode' log - si5351_vcxo: get_correction() takes the PLL input; use SI5351_PLL_INPUT_XO
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Version: 2.4.0 (head
8472d61).library.properties,library.jsonand the README changelog are set to 2.4.0.Summary
Adds I2C bus selection so the Si5351 can sit on
Wire1or any otherTwoWirebus (ESP32, RP2040, SAMD, STM32, Teensy and similar boards).Si5351(TwoWire *wire = &Wire, uint8_t i2c_addr = SI5351_BUS_BASE_ADDR).uint8_t,int,unsigned,long,unsigned long,long long,unsigned long long) keepSi5351(),Si5351(0x61),Si5351(0)andSi5351(NULL)compiling on the address path, as before.TwoWire *(nullptror(TwoWire *)0) falls back toWire.init()(begin()plus the device probe) and every register read and write go through_wire. Both constructors share onesetup_obj()helper, so there is no delegating constructor.examples/si5351_vcxonow callsget_correction(SI5351_PLL_INPUT_XO). The old call failed to compile on every core.Usage
Compatibility
Si5351(97.0)(a floating-point address) is now a compile error because the overloads make it ambiguous. It used to convert silently.explicit, the same as before.begin():init()still callsbegin()with no arguments.setPins(). If the bus is already running, it is left alone; the core logs "Bus already started in Master Mode", which is harmless and also happens on master.begin()runs again and may reset an earliersetClock(), so callsetClock()afterinit().Cost
Uno, basic
si5351_example: +138 B flash, +2 B RAM.Verification
Independent review
Si5351(0)/Si5351(NULL)were ambiguous) and 6 non-blocking ones (null guard, delegating constructor, README notes onbegin()/setClock()and ESP32-only pins, changelog wording, extra tests). All were fixed in ee18a6b.Related
PR #76 (I2C interface abstraction for STM32) overlaps with this one, but this PR does not replace it: #76 abstracts away the Wire library itself.
Closes #103
Closes #106