def set_scl_trigger_level(self, level: float = 0) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:IIC:CLEVel <level> :TRIGger:IIC:CLEVel? **Description** Set the trigger level of SCL in IIC trigger and the unit is the same with the current amplitude unit. Query the current trigger level of SCL in IIC trigger. **Parameter** ======== ===== ================================= ======== Name Type Range Default ======== ===== ================================= ======== <level> Real ± 5 × VerticalScale from 0 the screen center - OFFSet ======== ===== ================================= ======== Note: For the VerticalScale, refer to the :CHANnel<n>:SCALe command. For the OFFSet, refer to the :CHANNel<n>:OFFSet command. **Return Format** The query returns the trigger level in scientific notation. **Example** :TRIGger:IIC:CLEVel 0.16 The query returns 1.600000e-01. """ scale: float = -1.0 offset: float = -1.0 source = self.get_scl_source() if source == "channel 1": scale = self.subdevice.device.channel1.get_scale() offset = self.subdevice.device.channel1.get_offset() elif source == "channel 2": scale = self.subdevice.device.channel2.scale() offset = self.subdevice.device.channel2.get_offset() else: DS2000StateError("The level coul'd only be set, if the source is" "Channel 1 or Channel 2.") # TODO: Right?? min_rng = -5 * scale - offset max_rng = 5 * scale - offset if not isinstance(level, float) or not min_rng <= level <= max_rng: ValueError( f'"level" must be of type float and between ' f"{min_rng}..{max_rng}. You entered type {type(level)}.") self.subdevice.device.ask(f":TRIGger:IIC:CLEVel {level}")
def status(self) -> str: """ **Rigol Programming Guide** **Syntax** :TRIGger:MODE <mode> :TRIGger:MODE? **Description** Select the trigger type. Query the current trigger type. **Parameter** ======= ========= ============================ ======= Name Type Range Default ======= ========= ============================ ======= <mode> Discrete {EDGE|PULSe|RUNT|WIND|NEDG| EDGE SLOPe|VIDeo|PATTern|DELay| TIMeout|DURATion|SHOLd| RS232|IIC|SPI|USB} ======= ========= ============================ ======= **Return Format** The query returns the current trigger type. **Example** :TRIGger:MODE SLOPe The query returns SLOP. """ status = self.subdevice.device.ask(":TRIGger:MODE?").lower() if status in ( "edge", "pulse", "runt", "slope", "video", "pattern", "delay", "timeout", "duration", "rs232", "spi", "usb", ): return status if status == "wind": return "windows" if status == "nedg": return "nth edge" if status == "shold": return "setup/hold" if status == "iic": return "i2c" raise DS2000StateError()
def set_level(self, level: int = 0) -> None: """ **Rigol Programming Guide** **Syntax** :TRIGger:NEDGe:LEVel <level> :TRIGger:NEDGe:LEVel? **Description** Set the trigger level in Nth edge trigger and the unit is the same with the current amplitude unit. Query the current trigger level in Nth edge trigger. **Parameter** ======== ===== =========================== ======= Name Type Range Default ======== ===== =========================== ======= <level> Real ± 5 × VerticalScale from 0 the screen center - OFFSet ======== ===== =========================== ======= Note: For VerticalScale, refer to the :CHANnel<n>:SCALe command. For the OFFSet, refer to the :CHANNel<n>:OFFSet command. **Return Format** The query returns the trigger level in scientific notation. **Example** :TRIGger:NEDGe:LEVel 0.16 The query returns 1.600000e-01. """ scale: float = -1.0 offset: float = -1.0 source = self.source.status() if source == "channel 1": scale = self.subdevice.device.channel1.get_scale() offset = self.subdevice.device.channel1.get_offset() elif source == "channel 2": scale = self.subdevice.device.channel2.scale() offset = self.subdevice.device.channel2.get_offset() else: DS2000StateError("The level coul'd only be set, if the source is" "Channel 1 or Channel 2.") # ToDo: Right?? min_rng = -5 * scale - offset max_rng = 5 * scale - offset check_input(level, "level", int, min_rng, max_rng, "") self.subdevice.device.ask(f":TRIGger:NEDGe:LEVel {level}")
def status(self) -> str: """ **Rigol Programming Guide** **Syntax** :TRIGger:SHOLd:TYPe <type> :TRIGger:SHOLd:TYPe? **Description** Set the hold type of setup/hold trigger. Query the current hold type of setup/hold trigger. **Parameter** ======= ========= ===================== ======== Name Type Range Default ======= ========= ===================== ======== <type> Discrete {SETup|HOLd|SETHOLd} SETup ======= ========= ===================== ======== **Explanation** SETup: set the time (refer to the :TRIGger:SHOLd:STIMe command) that the data stays stable and constant before the clock edge appears. HOLd: set the time (refer to the :TRIGger:SHOLd:HTIMe command) that the data stays stable and constant after the clock edge appears. SETHOLd: set the time (refer to the :TRIGger:SHOLd:STIMe and :TRIGger:SHOLd:HTIMe commands) that the data stays stable and constant before and after the clock edge appears. **Return Format** The query returns SETup, HOL or SETHOL. **Example** :TRIGger:SHOLd:TYPe SETHOLd The query returns SETHOL. """ status = self.subsubdevice.subdevice.device.ask( ":TRIGger:SHOLd:TYPe?").lower() if status == "setup": return "setup" if status == "hold": return "hold" if status == "sethold": return "setup hold" raise DS2000StateError()
def status(self) -> str: """ **Rigol Programming Guide** **Syntax** :TRIGger:TIMeout:SOURce <source> :TRIGger:TIMeout:SOURce? **Description** Select the trigger source of timeout trigger. Query the current trigger source of timeout trigger. **Parameter** ========= ========= ==================== ======== Name Type Range Default ========= ========= ==================== ======== <source> Discrete {CHANnel1|CHANnel2} CHANnel1 ========= ========= ==================== ======== **Return Format** The query returns CHAN1 or CHAN2. **Example** :TRIGger:TIMeout:SOURce CHANnel2 The query returns CHAN2. """ status: str = self.subsubdevice.subdevice.device.ask( ":TRIGger:TIMeout:SOURce?").lower() if status == "chan1": return "channel 1" if status == "chan2": return "channel 2" raise DS2000StateError()
def status(self) -> str: """ **Rigol Programming Guide** **Syntax** :TRIGger:TIMeout:SLOPe <slope> :TRIGger:TIMeout:SLOPe? **Description** Set the edge type of timeout trigger. Query the current edge type of timeout trigger. **Parameter** ======== ========= ========================== ======== Name Type Range Default ======== ========= ========================== ======== <slope> Discrete {POSitive|NEGative|RFALl} POSitive ======== ========= ========================== ======== **Return Format** The query returns POS, NEG or RFAL. **Example** :TRIGger:TIMeout:SLOPe NEGative The query returns NEG. """ status: str = self.subsubdevice.subdevice.device.ask( ":TRIGger:TIMeout:SLOPe?") if status == "POS": return "rising edge" if status == "NEG": return "falling edge" if status == "RFAL": return "both edges" raise DS2000StateError()
def status(self) -> str: """ **Rigol Programming Guide** **Syntax** :TRIGger:SHOLd:SLOPe <slope> :TRIGger:SHOLd:SLOPe? **Description** Set the edge type of setup/hold trigger to the rising edge or falling edge. Query the current edge type of setup/hold trigger. **Parameter** ======== ========= ==================== ======== Name Type Range Default ======== ========= ==================== ======== <slope> Discrete {POSitive|NEGative} POSitive ======== ========= ==================== ======== **Return Format** The query returns POS or NEG. **Example** :TRIGger:SHOLd:SLOPe NEGative The query returns NEG. """ status: str = self.subsubdevice.subdevice.device.ask( ":TRIGger:SHOLd:SLOPe?").lower() if status == "POSitive": return "rising edge" if status == "NEGative": return "falling edge" raise DS2000StateError()
def status(self) -> str: """ **Rigol Programming Guide** **Syntax** :TRIGger:SHOLd:CSrc <source> :TRIGger:SHOLd:CSrc? **Description** Set the clock source of setup/hold trigger. Query the current clock source of setup/hold trigger. **Parameter** ========= ========= ==================== ======== Name Type Range Default ========= ========= ==================== ======== <source> Discrete {CHANnel1|CHANnel2} CHANnel1 ========= ========= ==================== ======== **Return Format** The query returns CHAN1 or CHAN2. **Example** :TRIGger:SHOLd:CSrc CHANnel2 The query returns CHAN2. """ status = self.subsubdevice.subdevice.device.ask( ":TRIGger:SHOLd:CSrc?").lower() if status == "chan1": return "channel 1" if status == "chan2": return "channel 2" raise DS2000StateError()