IO¶
Link to IOs and pin mapping for Red Pitaya 125-14 devices.
Base IO¶
- class openlabctrl.io.base.BaseIo(addr, clk_freq)[source]¶
-
- set_time(val)[source]¶
Set new IO time (should be larger or equal than current IO time).
- Parameters:
val (int) – time (in units of clk cycles).
- set_time_increment(val)[source]¶
Set IO instruction time increment, i.e. time between consecutive IO instructions. Default time increment after reset is 1 clk cycle.
- Parameters:
val (int) – time increment (in units of clk cycles).
Digital¶
- class openlabctrl.io.digital.DigitalIo(addr, clk_freq)[source]¶
Bases:
BaseIoDriver class for Digital IOs.
Note
Ports configured as inputs (high-impedance via
tristate()) include internal pull-up resistors and will idle high when left undriven.- output(val, mask=0b1111)[source]¶
Set output value of masked ports (requires ports to be defined as outputs via
DigitalIo.tristate()). E.g.val=0b0010andmask=0b1010will result in port[0] -> unchanged, port[1] -> 1, port[2] -> unchanged and port[3] -> 0.
- tristate(val, mask=0b1111)[source]¶
Set direction (output/tristate) of masked ports. A
0bit configures the corresponding port as a driven output; a1bit puts it in high-impedance (input) mode. E.g.val=0b0010andmask=0b1010will result in port[0] -> unchanged, port[1] -> high-Z (input), port[2] -> unchanged and port[3] -> driven (output).
- delay()¶
See
BaseIo.delay().
- get_time()¶
See
BaseIo.get_time().
- get_time_increment()¶
- reset()¶
See
BaseIo.reset().
- set_time()¶
See
BaseIo.set_time().
- set_time_increment()¶
Analog¶
- class openlabctrl.io.analog.AnalogOut(addr, clk_freq)[source]¶
Bases:
BaseIoDriver class for low speed analog IOs (PWM + Low Pass Filter).
- duty_cycle(val)[source]¶
Define scale of underlying Sigma-Delta Modulator.
- Parameters:
val (float) – Relative scale in range [0.0, 1.0].
- delay()¶
See
BaseIo.delay().
- get_time()¶
See
BaseIo.get_time().
- get_time_increment()¶
- reset()¶
See
BaseIo.reset().
- set_time()¶
See
BaseIo.set_time().
- set_time_increment()¶
RF¶
- class openlabctrl.io.rf.RfBase(addr, clk_freq)[source]¶
Bases:
BaseIoBase driver class for RF IOs (DDS-based signal generation).
Wraps a direct digital synthesizer (DDS) core and provides control over frequency, phase, and amplitude. The
updateflag on each method controls whether the new value is applied immediately (True) or staged for a later atomic update (False), which allows frequency, phase, and amplitude to be changed simultaneously.- frequency(val, update=True)[source]¶
Set the output frequency.
The valid range is
[-clk_freq/2, clk_freq/2](i.e. ±62.5 MHz for a 125 MHz clock).
- phase_reset(update=True)[source]¶
Reset the DDS phase accumulator to zero.
- Parameters:
update (bool) – If
True, apply immediately. Set toFalseto stage the reset and apply it later with other staged parameters.
- delay()¶
See
BaseIo.delay().
- get_time()¶
See
BaseIo.get_time().
- get_time_increment()¶
- reset()¶
See
BaseIo.reset().
- set_time()¶
See
BaseIo.set_time().
- set_time_increment()¶
- class openlabctrl.io.rf.RfOut(addr, clk_freq)[source]¶
Bases:
RfBaseDriver class for RF output channels.
- amplitude()¶
See
RfBase.amplitude().
- delay()¶
See
BaseIo.delay().
- frequency()¶
See
RfBase.frequency().
- get_time()¶
See
BaseIo.get_time().
- get_time_increment()¶
- phase()¶
See
RfBase.phase().
- phase_reset()¶
See
RfBase.phase_reset().
- reset()¶
See
BaseIo.reset().
- set_time()¶
See
BaseIo.set_time().
- set_time_increment()¶
Scope (Digital, Analog, RF acquisition)¶
- class openlabctrl.io.scope.ScopeSource(value)[source]¶
- RF_IN_0 = 0¶
- RF_IN_1 = 1¶
- RF_OUT_0 = 2¶
- RF_OUT_1 = 3¶
- DIGITAL_IO_0 = 4¶
- DIGITAL_IO_1 = 5¶
- DIGITAL_IO_2 = 6¶
- DIGITAL_IO_3 = 7¶
- ANALOG_OUT_0 = 8¶
- ANALOG_OUT_1 = 9¶
- ANALOG_OUT_2 = 10¶
- ANALOG_OUT_3 = 11¶
- ANALOG_IN_0 = 14¶
- ANALOG_IN_1 = 12¶
- ANALOG_IN_2 = 13¶
- ANALOG_IN_3 = 15¶
- class openlabctrl.io.scope.Scope(addr, clk_freq)[source]¶
Bases:
BaseIoDriver class for signal acquisition (digital oscilloscope).
Before calling
acquire(), bothsource()anddecimation()must be set within the same frame. Eachacquire()call is registered under a label and can be retrieved after the frame is executed.- source(src)[source]¶
Set the acquisition source.
Must be called before
acquire()within the same frame.- Parameters:
src (ScopeSource) – Signal source to capture. Must be a
ScopeSourcemember.
- decimation(dec=1)[source]¶
Set the decimation factor.
The effective sample rate is
clk_freq / dec. A value of1captures every clock cycle (no decimation).- Parameters:
dec (int) – Decimation factor in the range
[1, 2**32 - 1].
- acquire(samples, label=None, run_async=False)[source]¶
Schedule an acquisition from the current source.
source()anddecimation()must have been called earlier in the same frame. Acquired data is stored underlabeland can be retrieved after the frame executes.- Parameters:
samples (int) – Number of samples to acquire, in the range
[1, 2**32 - 1].label (str | None) – Key used to retrieve the acquisition data. Auto-generated as
acq_0,acq_1, … if not provided.run_async (bool) – If
False(default), the frame waits for all samples before continuing. IfTrue, the frame proceeds immediately after issuing the acquisition command (non-blocking).
- delay()¶
See
BaseIo.delay().
- get_time()¶
See
BaseIo.get_time().
- get_time_increment()¶
- set_time()¶
See
BaseIo.set_time().
- set_time_increment()¶
LED¶
- class openlabctrl.io.led.Led(addr, clk_freq)[source]¶
Bases:
BaseIoDriver class for the onboard LEDs.
- output(val, mask=0xffff)[source]¶
Set the on/off state of masked LEDs. E.g.
val=0b0010andmask=0b1010will result in LED[0] -> unchanged, LED[1] -> on, LED[2] -> unchanged and LED[3] -> off.
- delay()¶
See
BaseIo.delay().
- get_time()¶
See
BaseIo.get_time().
- get_time_increment()¶
- reset()¶
See
BaseIo.reset().
- set_time()¶
See
BaseIo.set_time().
- set_time_increment()¶