Skip to main content

Infrared

1. Overview

The infrared sensor of Omni3576 is connected to the PWM0_CH0_M0 pin by default. This section mainly describes how to test and configure the infrared remote control. The infrared receiver is located next to the power interface of Omni3576.

2. Test

  1. Check the input event device, where pwm-event corresponds to the infrared remote control.

    root@luckfox:/home/luckfox# ls -l /dev/input/by-path/
    total 0
    lrwxrwxrwx 1 root root 9 Oct 17 06:47 platform-27330000.pwm-event -> ../event0
    lrwxrwxrwx 1 root root 9 Oct 17 06:47 platform-2ac40000.i2c-platform-rk805-pwrkey.2.auto-event -> ../event1
    lrwxrwxrwx 1 root root 9 Oct 17 06:47 platform-dp0-sound-event -> ../event3
    lrwxrwxrwx 1 root root 9 Oct 17 06:47 platform-wireless-bluetooth-event -> ../event2
    lrwxrwxrwx 1 root root 9 Oct 17 06:47 platform-xhci-hcd.0.auto-usb-0:1.4:1.0-event-kbd -> ../event4
    lrwxrwxrwx 1 root root 9 Oct 17 06:47 platform-xhci-hcd.0.auto-usb-0:1.4:1.1-event -> ../event6
  2. Get the infrared remote control key value.

    echo 1 > /sys/module/rockchip_pwm_remotectl/parameters/code_print
    • The debugging serial port will print out the key values of the infrared remote control. Terminals such as ADB and SSH need to use the dmesg command to view

3. Device tree Overview

  1. The device file path is located at kernel-6.1/arch/arm64/boot/dts/rockchip/luckfox-omni3576.dts, and the code snippet for opening IR is as follows:

    &pwm0_2ch_0 {

    //compatible = "rockchip,remotectl-pwm";
    compatible = "rockchip,remotectl-pwm-v4";
    status = "okay";
    pinctrl-0 = <&pwm0m0_ch0>;
    pinctrl-names = "default";
    //interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
    remote_pwm_id = <3>;
    handle_cpu_id = <1>;
    remote_support_psci = <0>;

    ir_key_luckfox{
    rockchip,usercode = <0xff00>;
    rockchip,key_table =
    <0xb7 KEY_BACK>,
    <0xe9 KEY_UP>,
    <0xe8 KEY_DOWN>,
    <0xe6 KEY_LEFT>,
    <0xe7 KEY_RIGHT>,
    <0x6b KEY_HOME>,
    <0xbb KEY_VOLUMEUP>,
    <0xbc KEY_VOLUMEDOWN>,
    <0xf2 KEY_POWER>,
    <0xea KEY_ENTER>,
    <0xeb KEY_MENU>;
    };
    };