Skip to content

Commit

Permalink
Merge pull request #760 from mjkillough/pca9685
Browse files Browse the repository at this point in the history
Fix full on/off in pca9685.
  • Loading branch information
UncleRus authored Aug 17, 2020
2 parents 48e4132 + acfd46a commit 503e66a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions extras/pca9685/pca9685.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ void pca9685_set_pwm_value(i2c_dev_t *dev, uint8_t channel, uint16_t val)
if (val == 0)
{
// Full off
// Takes precedence over full on.
write_reg(dev, reg + OFFS_REG_LED_OFF, LED_FULL_ON_OFF);
}
else if (val < 4096)
Expand All @@ -195,6 +196,8 @@ void pca9685_set_pwm_value(i2c_dev_t *dev, uint8_t channel, uint16_t val)
}
else
{
// Clear full off, as it takes precedence over full on.
write_reg(dev, reg + OFFS_REG_LED_OFF, 0);
// Full on
write_reg(dev, reg + OFFS_REG_LED_ON, LED_FULL_ON_OFF);
}
Expand Down

0 comments on commit 503e66a

Please sign in to comment.