Skip to content

Add method Si5351::reset_freq()#104

Open
KT315AM wants to merge 1 commit into
etherkit:masterfrom
KT315AM:master
Open

Add method Si5351::reset_freq()#104
KT315AM wants to merge 1 commit into
etherkit:masterfrom
KT315AM:master

Conversation

@KT315AM

@KT315AM KT315AM commented Jul 19, 2026

Copy link
Copy Markdown

This PR adds the new method Si5351::reset_freq() to the simplify logic of the frequency manipulation.
Current API covers only cases when CLK has fixed output frequency.
Introduced method reset_freq() allows to cover cases when CLK has variable output frequency. It's eliminate needs to manual call output_enable() method to enable CLK before set new frequency value.


Initially was idea to name method reset_clock(), but CLK it's not only output frequency - it also has other settings.
So method was named reset_freq() meaning that resets only output frequency.

Example

Current API:

Si5351 si5351;
si5351.init(SI5351_CRYSTAL_LOAD_8PF, 0, 0);
...
si5351.set_freq(freq1, clk);
si5351.set_freq(freq2, clk);
si5351.output_enable(clk, 0);
...
si5351.output_enable(clk, 1); // <- redundancy code
si5351.set_freq(freq3, clk);
si5351.output_enable(clk, 0);
...
si5351.output_enable(clk, 1); // <- redundancy code
si5351.set_freq(freq4, clk);

API with new method reset_freq():

Si5351 si5351;
si5351.init(SI5351_CRYSTAL_LOAD_8PF, 0, 0);
...
si5351.set_freq(freq1, clk);
si5351.set_freq(freq2, clk);
si5351.reset_freq(clk);
...
si5351.set_freq(freq3, clk);
si5351.reset_freq(clk);
...
si5351.set_freq(freq4, clk);

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.

1 participant