Function open

  • 打开 UART 设备,并返回操控句柄对象。

    Returns

    Uart句柄对象

    Parameters

    • id: 0 | 1

      UART设备ID

    • options: {
          baudrate?: number;
          dataBits?: 5 | 6 | 7 | 8;
          parity?: "none" | "odd" | "event";
          rx: Byte;
          stopBits?: 2 | 1 | 1.5;
          tx: Byte;
      }
      • Optional baudrate?: number

        波特率,默认115200

      • Optional dataBits?: 5 | 6 | 7 | 8

        数据位,默认8

      • Optional parity?: "none" | "odd" | "event"

        校验,默认"none"

      • rx: Byte

        RX使用的gpio id

      • Optional stopBits?: 2 | 1 | 1.5

        停止位,默认1

      • tx: Byte

        TX使用的gpio id

    Returns UartHandle