Do you have any freedom to make hardware changes?

PWM controlling the current of the LED will give the best results.

So you could use a PWM output to drive a programmable constant current which in turn will drive the LED.

It sounds complicated but is not that much. Look at the schematic.

Name:  LED_CONTROL.png
Views: 4152
Size:  2.5 KB
PWM output is filtered and drives the transistor that operates as a constant current driver. Current is controlled by R2 and should be selected to satisfy max LED current.

R1 and C1 be 5-10 times the PWM frequency.

Ioannis