Skip to content

Add method Si5351::reset_freq() - #104

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

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);

@NT7S

NT7S commented Nov 8, 2026

Copy link
Copy Markdown
Member

Thanks for this, it's a good idea! This branch conflicts with the v2.4.x source, so we're re-implementing reset_freq() in a fresh PR against current master, with credit to you. I'll link it here and close this one once it lands.

@NT7S

NT7S commented Nov 8, 2026

Copy link
Copy Markdown
Member

reset_freq() has landed on master via #114 (credited to you), so I'm closing this one. Thank you for the idea and the original implementation!

@NT7S NT7S closed this Nov 8, 2026
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