Skip to content

fixed LED driver clock setting in function ledDriverInit() #13

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

Merged
merged 2 commits into from
Jan 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/SparkFunSX1509.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,16 @@ void SX1509::ledDriverInit(uint8_t pin, uint8_t freq /*= 1*/, bool log /*= false
// Use configClock to setup the clock divder
if (_clkX == 0) // Make clckX non-zero
{
_clkX = 2000000.0 / (1 << (1 - 1)); // Update private clock variable
// _clkX = 2000000.0 / (1 << (1 - 1)); // Update private clock variable
_clkX = 2000000.0;

uint8_t freq = (1 & 0x07) << 4; // freq should only be 3 bits from 6:4
tempByte |= freq;
// uint8_t freq = (1 & 0x07) << 4; // freq should only be 3 bits from 6:4
// tempByte |= freq;
}

freq = (freq & 0x7) << 4; // mask only 3 bits and shift to bit position 6:4
tempByte |= freq;

writeByte(REG_MISC, tempByte);

// Enable LED driver operation (REG_LED_DRIVER_ENABLE)
Expand Down