Erbium doping of crystalline and amorphous silicon for optoelectronic applications