Available on crate feature
cgb only.Expand description
The Game Boy Color’s infrared port.
What the hardware offers is a lamp and a light sensor. There is no clock, no
framing and nothing to say a message has arrived. Talking to anything means
building all of that out of Port::led and Port::signal.
ⓘ
let Some(port) = ir::open() else { return };
port.led(true);§Sending
A receiver settles to whatever infrared is already in the room, so a lamp held on reads as nothing after a moment and a message has to be pulses. A Philips remote control, for one, sends a run of 32 flashes of 10 and 17.5 microseconds where a single one of 880 would say the same thing.
Nothing here counts those out. The lengths belong to whatever is on the other end, and double speed halves what a loop of a given length takes.
Structs§
- Port
- The port, open and drawing current.
Functions§
- open
- Open the port, if this machine has one.