Commit 11b608c2 authored by Peter Jansweijer's avatar Peter Jansweijer

added "desired_freq_2_sfp_ch""function according to SFF8690 (see Table 4-3)

parent 9af53fe5
......@@ -51,3 +51,24 @@ def wavelength_2_itu(wavelength):
itu_channel = round(itu_channel,1) # round to 1 decimal
return(itu_channel)
############################################################################
def desired_freq_2_sfp_ch(desired_freq, first_freq, grid):
"""
converts desired frequency into SFP channel number
input:
desired_freq <int> The desired freqency in Hz
first_freq <int> Lasers First Frequency in Hz
Following SFF8690 Table 4-3 the Lasers First Frequency
can be read from I2C 0xA2 page 2 Addr 132-135.
grid <int> Laser's minimum supported grid spacing in Hz
Following SFF8690 Table 4-3 the Lasers First Frequency
can be read from I2C 0xA2 page 2 Addr 140-141.
return:
sfp_ch <int> The number to set in the tunable SFP to obtain the
desired frequency, according the the equation given
in SFF8690
"""
return(int(1+(desired_freq - first_freq) / grid))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment