A method is disclosed. The method includes forming a substrate with a
leadframe and a molding compound. The molding compound fills internal
spaces in the leadframe and forms a dam structure. An optical emitter and
an optical receiver are placed on the substrate. An optically
transmissive medium is formed between the optical emitter and optical
receiver.