For the Digitally Controlled Current Source:
You could use a Digital-to-Analog Converter with Op-Amp feedback control providing the base voltage to a BJT as a current source.
See this: **broken link removed**
but replace zener diode reference with DAC.