I created the triangle wave control (CTRL) signal using an integrator driven by a square wave. I created a square wave (DN) by using an op-amp as a comparator with hysteresis comparing the triangle wave with a reference. It then occurred to me that the dimming of the LED could be more efficient by using an inductor to drop the voltage and limit the current when driven by a square wave from a comparator.
There is nothing special about the integrator, a low leakage capacitor is needed.
The op-amp comparator has much higher input current as the inputs are not at the same voltage. The tiny capacitor on the positive feedback is to speed up the switch between states.
The switch mode LED dimming, measures the current with a sense resistor (R1) and the voltage developed is amplified 25 times to give the negative input (NE) to the comparator. The control input (CTRL) is divided by 4 to give the positive input (PO) to the comparator. The comparator is given hysteresis equivalent to plus/minus 0.5 mA, but this is nearer 1 mA in simulation. This comparator has a 'floating' output transistor and the emitter-follower output is used, so the inputs are swapped.