adafruit / Adafruit_CircuitPython_PCA9685

Adafruit CircuitPython driver for PCA9685 16-channel, 12-bit PWM LED & servo driver chip.
MIT License
120 stars 64 forks source link

Correct PWM frequency prescale computation #59

Closed bdlucas1 closed 6 months ago

bdlucas1 commented 6 months ago

Assuming this datasheet https://www.digikey.be/htmldatasheets/production/1640697/0/0/1/pca9685-datasheet.html#pf19 is correct, the prescale value computation is off by one. This results in the incorrect PWM frequency being selected, and the incorrect frequency being reported on reading back the frequency field. For example