tbs,crsf (on uart bus)

Description

TBS CRSF

CRSF (Crossfire), originally developed by Team BlackSheep (TBS) and used by
ExpressLRS (ELRS) and others, is a bidirectional UART-based serial protocol
that can be used to receive analog joystick and switch inputs from RC
transmitters.

CRSF uses a non-inverted signal and therefore does not require an external
inverter or RX pin inversion support. It operates over a standard UART
interface (RX/TX) at 420000 baud, 8N1.

The binding allows mapping of up to 16 CRSF channels to Zephyr input events.
Each channel can be configured to generate either absolute position events
(for joysticks and sliders) or key events (for switches).

The following example shows how to configure 2 joysticks and a button using 5 channels:

&lpuart6 {
  status = "okay";

  crsf {
      compatible = "tbs,crsf";
      right_stick_x {
          channel = <1>;
          type = <INPUT_EV_ABS>;
          zephyr,code = <INPUT_ABS_RX>;
      };
      right_stick_y {
          channel = <2>;
          type = <INPUT_EV_ABS>;
          zephyr,code = <INPUT_ABS_RY>;
      };
      left_stick_x {
          channel = <3>;
          type = <INPUT_EV_ABS>;
          zephyr,code = <INPUT_ABS_X>;
      };
      left_stick_y {
          channel = <4>;
          type = <INPUT_EV_ABS>;
          zephyr,code = <INPUT_ABS_Y>;
      };
      kill_switch {
          channel = <5>;
          type = <INPUT_EV_KEY>;
          zephyr,code = <INPUT_KEY_0>;
      };
  };
};

Properties

Top level properties

These property descriptions apply to “tbs,crsf” nodes themselves. This page also describes child node properties in the following sections.

Properties not inherited from the base binding file.

(None)

Child node properties

Name

Type

Details

channel

int

CRSF input channel
Valid range: 1 - 16

This property is required.

type

int

Input event types see INPUT_EV_CODES

This property is required.

zephyr,code

int

Code to emit.

This property is required.