Spin-controlled optoelectronic devices