You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add constant_current_range selector for LED driving
The AW9523 supports 256-step linear constant-current dimming when LED driving.
As noted in the datasheet introduction, the maximum current can be configured:
https://cdn-shop.adafruit.com/product-files/4886/AW9523+English+Datasheet.pdf
> The default maximum current (IMAX) is 37mA, and IMAX can be changed in GCR
> register.
In Table 10 ("GCR, Global control register (11H)"), the datasheet explains that
4 possible current ranges can be selected - maintaining the 256-step
granularity over a shorter current range:
> D[1:0] is used to configure the max drive current of LED. AW9523B set max
> current IMAX to 37mA(typical) default, and through register ISEL[1:0] can
> set to IMAX×1/4,IMAX×2/4, IMAX×3/4,IMAX, so the 256 step dimming range changes.
This change updates the `adafruit_aw9523.AW9523` class to have a
`constant_current_range` selector field that can be used to set the register
value. The 4 options are provided as constants (`AW9523_4_4_RANGE`,
`AW9523_3_4_RANGE`, etc).
An example of using this code would be:
```
aw = adafruit_aw9523.AW9523(i2c)
aw.constant_current_range = adafruit_aw9523.AW9523_3_4_RANGE
```
0 commit comments