pub struct InfraredEmitter<P, C, I> { /* private fields */ }
Expand description

Control sending of datagrams, manage infrared radiation pollution

The InfraredEmitter behaves socially by enforcing a pause time between subsequent Required resources:

  • A configured PWM - typically at a frequency of 36..38 kHz (RC5 protocol)
  • A facility that periodically runs half bit sending, e.g. a timer ISR typically at a period of 889 µs (half bit time, RC5 protocol)

Example

TODO

Implementations

Create a new infrared Emitter

Arguments
  • pause_cycles - configures the time between subsequent datagram emissions. The total duration is half-bit-time (889 µs) times number of pause bit cycles. In the pause time no infrared radiation is emitted and other participants can occupy the radiation space.
  • pwm - the PWM to be used for ir pulse emission
  • channel - the channel to be used by the PWM

Progress on sending a datagram by emitting a half bit

This function needs to be called every half-bit period, i.e. each 889 µs. The periodically required call is most likely delegated to a timer ISR.

half-bit emitting happens by enabling/disabling a a properly configured PWM.

Immediately start sending a datagram if possible

Sending is possible iff there is no sending procedure in progress. A call to this function is not blocking

Arguments
  • datagram - The datagram to be send
  • sending_power - The duty cycle of the pwm in percent should be less than or equal 25 (percent) Is reduced to 25 if a higher value is given. Lower sending power is appropriate for pairing datagrams.
Returns
  • true - if sending was initiated
  • false - if sending was not possible to initiate

Immediately start sending a datagram if possible

Sending is possible iff there is no sending procedure in progress. A call to this function is not blocking

Arguments
  • datagram - The datagram to be send
  • sending_power - The duty cycle of the pwm in percent should be less than or equal 25 (percent) Is reduced to 25 if a higher value is given. Lower sending power is appropriate for pairing datagrams.
Returns
  • true - if sending was initiated
  • false - if sending was not possible to initiate

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.