dso_bus module

class dso_bus.Bus(parent)

Bases: object

This module can control the bus function on the DSO.

get_can_sample_point() int

Returns the sample point of the CAN bus as a percentage of the bit time.

Returns:

The sample point as a percentage.

Return type:

int

get_lin_sample_point() int

Returns the sample point of the LIN bus as a percentage.

Returns:

The sample point as a percentage.

Return type:

int

get_source() str

Gets the current bus input source.

Returns:

The current but input source (‘ANAlog’ or ‘DIGital’).

Return type:

source (str)

get_supported_buses() tuple

Returns the supported BUS types.

Returns:

A comma-separated list of supported bus types.

Return type:

str

get_type() str

Gets the current bus type.

Returns:

The current bus type, one of ‘UART’, ‘I2C’, ‘SPI’, ‘PARallel’, ‘CAN’, or ‘LIN’.

Return type:

type (str)

is_on() bool

Is the bus state on?

Returns:

True or False.

Return type:

bool

set_can_params(source: int | None = None, signal_type: str | None = None, bitrate: str | None = None) None

Sets CAN bus related settings.

Parameters:
  • source (int, optional) – The CAN input source (1: CH1, 2: CH2, 3: CH3, 4: CH4).

  • signal_type (str, optional) – The signal type of the CAN bus. Can be one of the following: - ‘CANH’: CAN-High - ‘CANL’: CAN-Low - ‘TX’: Transmit - ‘RX’: Receive

  • bitrate (str or int, optional) – The bit rate of the CAN bus. Can be one of the following: - ‘RATE10K’: 10 kbps - ‘RATE20K’: 20 kbps - ‘RATE50K’: 50 kbps - ‘RATE125K’: 125 kbps - ‘RATE250K’: 250 kbps - ‘RATE500K’: 500 kbps - ‘RATE800K’: 800 kbps - ‘RATE1M’: 1 Mbps - Any integer value representing the desired bit rate in bps.

set_disp_format(format: str) None

Sets the dispaly format for the bus.

Parameters:

format (str) – Desired display for the bus. Options are ‘BINary’ or ‘HEXadecimal’

set_i2c_params(rw_include: str | None = None, sclk_ch: int | None = None, sda_ch: int | None = None) None

Sets I2C related settings.

Parameters:
  • rw_include (str, optional) – ‘ON’ to inlcude the R/W bit, ‘OFF’ to exclude it.

  • sclk_ch (int, optional) – The channel for SCLK (1: CH1, 2: CH2, 3: CH3, 4: CH4).

  • sda_ch (int, optional) – The channel for SDA (1: CH1, 2: CH2, 3: CH3, 4: CH4).

set_lin_params(bitrate: int | None = None, id_format: str | None = None, polarity: str | None = None, source: int | None = None, std_ver: str | None = None) None

Sets LIN bus related settings.

Parameters:
  • bitrate (int, optional) – The bit rate of the LIN bus in bps.

  • id_format (str, optional) – The LIN ID format. Can be one of the following: - ‘NOPARrity’: Don’t include parity bits with ID. - ‘PARIty’: Include parity bits with ID.

  • polarity (str, optional) – The LIN polarity. Can be one of the following: - ‘NORMal’: Normal LIN polarity. - ‘INVerted’: Inverted LIN polarity.

  • source (int, optional) – The LIN data source channel (1: CH1, 2: CH2, 3: CH3, 4: CH4).

  • std_ver (str, optional) – The LIN standard version. Can be one of the following: - ‘V1X’: LIN standard version 1.x. - ‘V2X’: LIN standard version 2.x. - ‘BOTH’: Both standards.

set_off() None

Turns the bus off.

set_on() None

Turns the bus on.

set_source(source: str) None

Sets the bus source.

Parameters:

source (str) – ‘ANAlog’ for analog inputs or ‘DIGital’ for digital inputs.

set_spi_params(sclk_pol: str | None = None, ss_pol: str | None = None, word_size: int | None = None, bit_order: int | None = None, sclk_ch: int | None = None, ss_ch: int | None = None, mosi_ch: str | None = None, miso_ch: str | None = None) None

Set SPI related settings.

Parameters:
  • sclk_pol (str, optional) – SCLK line polarity (‘FALL’ for falling edge, ‘RISE’ for rising edge).

  • ss_pol (str, optional) – SS line polarity (‘LOW’ for active low, ‘HIGH’ for active high).

  • word_size (int, optional) – Number of bits per word for SPI (4~32).

  • bit_order (int, optional) – Bit order for SPI (0: MSB first, 1: LSB first).

  • sclk_ch (int, optional) – SCLK channel source (1: CH1, 2: CH2, 3: CH3, 4: CH4).

  • ss_ch (int, optional) – SS channel source (1: CH1, 2: CH2, 3: CH3, 4: CH4).

  • mosi_ch (str or int, optional) – MOSI channel source (‘OFF’, 1: CH1, 2: CH2, 3: CH3, 4: CH4).

  • miso_ch (str or int, optional) – MISO channel source (‘OFF’, 1: CH1, 2: CH2, 3: CH3, 4: CH4).

set_type(type: str) None

Sets the type of bus.

Parameters:

type (str) – The type of bus, one of ‘UART’, ‘I2C’, ‘SPI’, ‘PARallel’, ‘CAN’, or ‘LIN’.

set_uart_params(bitrate: int | None = None, databits: int | None = None, parity: int | None = None, packet: int | None = None, eof_packet: int | None = None, tx_ch: int | None = None, rx_ch: int | None = None) None

Sets UART related settings.

Parameters:
  • bitrate (int, optional) – UART bit rate in bps.

  • databits (int, optional) – Number of data bits in the UART frame (5, 6, 7, 8, 9).

  • parity (int, optional) – UART bus parity (0: None, 1: Odd, 2: Even).

  • packet (int, optional) – UART packet setting (0: Off, 1: On).

  • eof_packet (int, optional) – EOF character (0: NULL, 1: LF, 2: CR, 3: SP, 4: FF).

  • tx_ch (int, optional) – Tx channel (1: CH1, 2: CH2, 3: CH3, 4: CH4).

  • rx_ch (int, optional) – Rx channel (1: CH1, 2: CH2, 3: CH3, 4: CH4).