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

set_clock_disable #19

Closed
akadamson opened this issue Feb 29, 2016 · 1 comment
Closed

set_clock_disable #19

akadamson opened this issue Feb 29, 2016 · 1 comment

Comments

@akadamson
Copy link

Jason, I think you may want to make these changes to the set_clock_disable routine. It looks like you copy & pasted and forgot to change some if, ifelse

void Si5351::set_clock_disable(enum si5351_clock clk, enum si5351_clock_disable dis_state)
{
uint8_t reg_val = 0, reg = 0;

if (clk >= SI5351_CLK0 && clk <= SI5351_CLK3)
{
    reg = SI5351_CLK3_0_DISABLE_STATE;
}
else if (clk >= SI5351_CLK4 && clk <= SI5351_CLK7)
{
    reg = SI5351_CLK7_4_DISABLE_STATE;
}

reg_val = si5351_read(reg);

if (clk >= SI5351_CLK0 && clk <= SI5351_CLK3)
{
    reg_val &= ~(0b11 << (clk * 2));
    reg_val |= dis_state << (clk * 2);
}
else if (clk >= SI5351_CLK4 && clk <= SI5351_CLK7)
{
    reg_val &= ~(0b11 << ((clk - 4) * 2));
    reg_val |= dis_state << ((clk - 4) * 2);
}

si5351_write(reg, reg_val);

}

@NT7S
Copy link
Member

NT7S commented Mar 1, 2016

Always appreciate the extra eyes to catch bugs like these. Corrected in release v1.1.1.

@NT7S NT7S closed this as completed Mar 1, 2016
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

No branches or pull requests

2 participants