epc660_ll
The following API has been generated from the header file epc660_ll.h. It contains the low level API for the epc660 sensor.
-
enum epc660_ll_sequencer
Updatable sequencers.
Values:
-
enumerator EPC660_LL_SEQUENCER_PIXEL
-
enumerator EPC660_LL_SEQUENCER_TCMI
-
enumerator EPC660_LL_SEQUENCER_PIXEL
-
enum epc660_ll_mod_clk_source
Modulation clock source.
Values:
-
enumerator EPC660_LL_MOD_CLK_INTERN
-
enumerator EPC660_LL_MOD_CLK_EXTERN
-
enumerator EPC660_LL_MOD_CLK_INTERN
-
enum epc660_ll_led_ctrl_set_flags
Configuration one-hot encoded flags used in epc660_ll_led_ctrl_set()
Values:
-
enumerator EPC660_LL_LED_ENABLE
Enable the LED control output.
-
enumerator EPC660_LL_LED2_ENABLE
Enable the LED2 control output.
-
enumerator EPC660_LL_LED_FORCE_ON
Force the led control outputs, permanently active outputs.
-
enumerator EPC660_LL_LED_INVERTED
Sets LED outputs to active low.
-
enumerator EPC660_LL_LED_ENABLE
-
enum epc660_ll_temp_sensor
Temperature Sensors present on the corners of the pixel field.
Values:
-
enumerator EPC660_LL_TEMP_TL
-
enumerator EPC660_LL_TEMP_TR
-
enumerator EPC660_LL_TEMP_BL
-
enumerator EPC660_LL_TEMP_BR
-
enumerator EPC660_LL_TEMP_TL
-
enum epc660_ll_tcmi_format
TCMI data transmission format. Uset epc660_ll_tcmi_format_set()
Values:
-
enumerator EPC660_LL_TCMI_FORMAT_12BIT
-
enumerator EPC660_LL_TCMI_FORMAT_8BIT
-
enumerator EPC660_LL_TCMI_FORMAT_12BIT_lsb_msb
8-Bit x2 per 2 DCLK cycle (LSB, MSB): 1st DCLK: sample[7..0] -> DATA[7..0] 2nd DCLK:: sample[11..8] -> DATA[3..0]
-
enumerator EPC660_LL_TCMI_FORMAT_12BIT_msb_lsb
8-Bit x2 per 2 DCLK cycle (MSB, LSB): 1st DCLK:: sample[11..8] -> DATA[3..0] 2nd DCLK: sample[7..0] -> DATA[7..0]
-
enumerator EPC660_LL_TCMI_FORMAT_12BIT
-
enum epc660_ll_tcmi_sync_output
One-hot encoded configurable TCMI synchronisation outputs.
Values:
-
enumerator EPC660_LL_TCMI_OUTPUT_HSYNC
-
enumerator EPC660_LL_TCMI_OUTPUT_VSYNC
-
enumerator EPC660_LL_TCMI_OUTPUT_XSYNC
-
enumerator EPC660_LL_TCMI_OUTPUT_HSYNC
-
enum epc660_ll_modulation_mode
Modulation modes used in epc660_ll_modulation_mode_set()
Values:
-
enumerator EPC660_LL_MODULATION_MODE_CWTOF
-
enumerator EPC660_LL_MODULATION_MODE_GRAYSCALE
-
enumerator EPC660_LL_MODULATION_MODE_CWTOF
-
enum epc660_ll_sensing_mode
ADC sensing mode. Use epc660_ll_sensing_mode_set()
Values:
-
enumerator EPC660_LL_SENSING_MODE_NORMAL
-
enumerator EPC660_LL_SENSING_MODE_TEMPERATURE
-
enumerator EPC660_LL_SENSING_MODE_NORMAL
-
enum epc660_ll_dcs_sel
Number of frames triggered by a shutter.
Values:
-
enumerator EPC660_LL_DCS_SEL_1X
-
enumerator EPC660_LL_DCS_SEL_2X
-
enumerator EPC660_LL_DCS_SEL_4X
-
enumerator EPC660_LL_DCS_SEL_1X
-
enum epc660_ll_modulation_gate
Configurable modulation gates.
Values:
-
enumerator EPC660_LL_MOD_GATE_0
Default modulation gate in use
-
enumerator EPC660_LL_MOD_GATE_1
Alternative modulation gate only applied for dual modulation and dual integration
-
enumerator EPC660_LL_MOD_GATE_0
-
enum epc660_ll_modulation_phase
Supported demodulation phases relative to the modulation.
Values:
-
enumerator EPC660_LL_MOD_PHASE_000
Phase used for DCS0
-
enumerator EPC660_LL_MOD_PHASE_090
Phase used for DCS1
-
enumerator EPC660_LL_MOD_PHASE_180
Phase used for DCS2
-
enumerator EPC660_LL_MOD_PHASE_270
Phase used for DCS3
-
enumerator EPC660_LL_MOD_PHASE_000
-
enum epc660_ll_frame
Configurable frames/DCS.
Values:
-
enumerator EPC660_LL_FRAME_1ST
-
enumerator EPC660_LL_FRAME_2ND
-
enumerator EPC660_LL_FRAME_3RD
-
enumerator EPC660_LL_FRAME_4TH
-
enumerator EPC660_LL_FRAME_GRAYSCALE
-
enumerator EPC660_LL_FRAME_1ST
-
enum epc660_ll_led_modulation
By frame/DCS configurable LED modulations during integration.
Values:
-
enumerator EPC660_LL_LED_MODULATED
-
enumerator EPC660_LL_LED_OFF
-
enumerator EPC660_LL_LED_ON
-
enumerator EPC660_LL_LED_MODULATED
-
enum epc660_ll_readout_mode
By frame configurable pixel readout mode.
Values:
-
enumerator EPC660_LL_READOUT_DIFFERENTIAL_WO_ABS
-
enumerator EPC660_LL_READOUT_SINGLE_ENDED_SGA
-
enumerator EPC660_LL_READOUT_DIFFERENTIAL_W_ABS
-
enumerator EPC660_LL_READOUT_DIFFERENTIAL_WO_ABS
-
enum epc660_ll_dll_ctrl
Settings for delay locked loop used to delay the LED modulation.
Values:
-
enumerator EPC660_LL_DLL_BYPASS
-
enumerator EPC660_LL_DLL_MANUAL
-
enumerator EPC660_LL_DLL_BYPASS
-
int epc660_ll_video_start(const struct epc660_ll *epc660, bool continuous)
Sends a shutter signal to the sensor over I2C.
- Parameters:
epc660 – [in] epc660 instance
continuous – [in] if set to true, the sensor will start continuous video mode, otherwise single shutter mode
- Returns:
int — See epc660_ll::i2c_write()
-
int epc660_ll_video_stop(const struct epc660_ll *epc660)
Stops continuous shutter signal to the sensor over I2C.
- Parameters:
epc660 – [in] epc660 instance
- Returns:
int — See epc660_ll::i2c_write()
-
int epc660_ll_sensing_mode_set(const struct epc660_ll *epc660, enum epc660_ll_sensing_mode mode)
Set the epc660 sensing mode.
- Parameters:
epc660 – [in] epc660 instance
mode – [in] Sensing mode. See epc660_ll_sensing_mode enum.
- Returns:
int — See epc660_ll::i2c_write()
-
int epc660_ll_modulation_mode_set(const struct epc660_ll *epc660, enum epc660_ll_modulation_mode mode)
Set the modulation mode of the epc660.
- Parameters:
epc660 – [in] epc660 instance
mode – [in] Modulation mode. See epc660_ll_modulation_mode enum.
- Returns:
int — See epc660_ll::i2c_write()
-
int epc660_ll_video_dcs_sel_set(const struct epc660_ll *epc660, enum epc660_ll_dcs_sel dcs_sel)
Set the number of dcs triggered by a single shutter.
- Parameters:
epc660 – [in] epc660 instance
dcs_sel – [in] Number of DCS triggered by a shutter
- Returns:
int — See epc660_ll::i2c_write()
-
int epc660_ll_frame_cfg_modulation_phase_set(const struct epc660_ll *epc660, uint16_t frames, enum epc660_ll_modulation_gate gate, enum epc660_ll_modulation_phase phase)
Set the demodulation phase shift of a gate.
- Parameters:
epc660 – [in] epc660 instance
frames – [in] combination of epc660_ll_frame to be configured excluding EPC660_LL_FRAME_GRAYSCALE
gate – [in] demodulation gate to be configured
phase – [in] demodulation phase shift to modulation
- Returns:
int
-EPC_ERR_ILLEGAL_FLAG_COMBINATION
frames contains EPC660_LL_FRAME_GRAYSCALE flag
frames contains flag(s) not listed in epc660_ll_frame
Otherwise
-
int epc660_ll_frame_cfg_readout_mode_set(const struct epc660_ll *epc660, uint16_t frames, enum epc660_ll_readout_mode ro_mode)
Set the readout mode.
- Parameters:
epc660 – [in] epc660 instance
frames – [in] combination of epc660_ll_frame to be configured
ro_mode – [in] pixel readout mode.
- Returns:
int
frames contains flag(s) not listed in epc660_ll_frame
Otherwise -See epc660_ll::i2c_write()
-
int epc660_ll_frame_cfg_led_modulation_set(const struct epc660_ll *epc660, uint16_t frames, enum epc660_ll_led_modulation led_mod)
Set the LED modulation mode.
- Parameters:
epc660 – [in] epc660 instance
frames – [in] combination of epc660_ll_frame to be configured
led_mod – [in] LED modulation
- Returns:
int
frames contains flag(s) not listed in epc660_ll_frame
Otherwise -See epc660_ll::i2c_write()
-
int epc660_ll_roi_set(const struct epc660_ll *epc660, uint16_t x0, uint8_t y0, uint16_t x1, uint8_t y1)
Set the region of interest of the top pixel field half.
E.g valid : x0 - 36, y0 - 16, x1 = 77, y1 = 105
For more information refer to datasheet.
- Parameters:
epc660 – [in] epc660 instance
x0 – [in] lowest column idx in roi. See details
y0 – [in] lowest row idx in roi. See details
x1 – [in] highest column idx in roi. See details
y1 – [in] highest pixel idx in roi. See details
- Returns:
int
x0 is not in [4,318] or
y0 is not in [6,124] or
x1 is not in [9,323] or
y1 is not in [7,125]
-EPC_ERR_RESULTS_IN_ILLEGAL_STATE
x0 is not even or
y0 is not even or
x1 is not odd or
y1 is not odd or
x0 is greater x1 or
y0 is greater y1 or
Horizontal range does not respect divisibility rule. See details or
Vertical range does not respect divisibility rule. See details
Otherwise
Vertical ROI can only be read in fixed groups of 2 with the start value being even and end value being odd. For normal operations the height requires to be divisible by 2
Horizontal ROI can only be read in fixed groups of 6 with the start value being even and end value being odd. For normal operations the width requires to be divisible by 6
-
int epc660_ll_temp_sensor_calib_get(const struct epc660_ll *epc660, enum epc660_ll_temp_sensor sensor, struct epc660_ll_temp_sensor_calib *calib)
Get the epc660 temperature sensor calibration data from specified sensor.
- Parameters:
epc660 – [in] epc660 instance
sensor – [in] Index of the sensor from which to grab the calibration data
calib – [out] pointer to calibration data of temperature sensor
1 Offset is not calibrated therfore a default value is used
- Returns:
int
calib is NULL
Otherwise
-
int epc660_ll_temp_sensor_get(const struct epc660_ll *epc660, enum epc660_ll_temp_sensor sensor, const struct epc660_ll_temp_sensor_calib *calib, int16_t *temp_sensor_cC)
Get the epc660 temperature from specified sensor.
- Parameters:
epc660 – [in] epc660 instance
sensor – [in] temperature sensor from which to grab the data
calib – [in] pointer to calibration data of temperature sensor aquired by epc660_ll_temp_sensor_calib_get
temp_sensor_cC – [out] Latest temperature reading in centi-degrees Celsius (°C × 100). Divide by 100 to obtain the temperature in °C.
- Returns:
int
temp_sensor_cC is NULL
calib is NULL
Invalid sensing mode. See details
Otherwise
-
int epc660_ll_update_sequencer(const struct epc660_ll *epc660, const struct epc660_ll_sequencer_program *sequencer_program)
update readout sequencer with the given entries
- Parameters:
epc660 – [in] epc660 instance
sequencer_program – [in] epc660 sequencer program struct
- Returns:
int
sequencer_program is NULL
sequencer_program->entries[x].addr is not in [0, 192] when EPC_LL_SEQENCER_PIXEL is passed
sequencer_program->entries[x].addr is not in [0, 64] when EPC_LL_SEQENCER_TCMI is passed
Otherwise
-
int epc660_ll_demodulation_delay_set(const struct epc660_ll *epc660, uint8_t delay_clk)
Set the demodulation delay applied to pixel control signals(mg0, mg1, …)
- Parameters:
epc660 – [in] epc660 instance
delay_clk – [in] delay in number of pll_clk cycles
- Returns:
int
delay_clk is not in [0, 12]
Otherwise
-
int epc660_ll_modulation_clk_src_set(const struct epc660_ll *epc660, enum epc660_ll_mod_clk_source clk_src)
Set the modulation clock source.
- Parameters:
epc660 – [in] epc660 instance
clk_src – [in] Clock source
- Returns:
int — See epc660_ll::i2c_write()
-
int epc660_ll_modulation_clk_div_set(const struct epc660_ll *epc660, uint8_t clk_div)
Set the modulation clock divider.
- Parameters:
epc660 – [in] epc660 instance
clk_div – [in] Clock divider
- Returns:
int
clk_div [1,32]
Otherwise
-
int epc660_ll_modulation_clk_div_get(const struct epc660_ll *epc660, uint8_t *clk_div)
Get the modulation clock divider.
- Parameters:
epc660 – [in] epc660 instance
clk_div – [out] Current clock divider
- Returns:
int
clk_div is NULL
Otherwise
-
int epc660_ll_tcmi_clk_div_set(const struct epc660_ll *epc660, uint8_t clk_div)
Set the tcmi clock divider.
- Parameters:
epc660 – [in] epc660 instance
clk_div – [in] Clock divider
- Returns:
int
clk_div is not in [2, 32]
Otherwise
-
int epc660_ll_integration_time_set(const struct epc660_ll *epc660, uint32_t mod_freq_hz, uint32_t int_us)
Set total integration length.
The passed integration time is converted to a total period count which, in turn, is divded into the two factors. The repetition count is minimized to reduce noise related to the repetition. Therefore the register values are conditionally calculated:
\[\begin{split} \begin{array}{rrl} N_T &= &t_{int}*f_{mod}\\ INT_M &:= &\text{Repetitions}\\ INT_N &:= &\text{Base Length}\\ INT_M(N_T)&=&\left\{\begin{array}{ll} INT_M=\left\lfloor\frac{N_T}{0x10000}\right\rfloor+1 &: \ N_T \gt 0x10000 \\ INT_M=1 &: \ N_T \leq 0x10000 \\ \end{array}\right .\\ INT_N(N_T)&=&\left\{\begin{array}{ll} INT_N=\left\lfloor\frac{N_T}{INT_M}\right\rfloor-1 &: \ N_T \gt 0x10000 \\ INT_N=N_T - 1 &: \ N_T \leq 0x10000 \end{array}\right . \end{array} \end{split}\]- Parameters:
epc660 – [in] epc660 instance
mod_freq_hz – [in] modulation frequency used for calulcation in Hz
int_us – [in] integration length in us
- Returns:
int
int_us see epc660_ll_calc_int_time_reg()
Otherwise
See epc660_ll::i2c_write(), epc660_ll::i2c_read()
The integration time is set by specifying two settings.
the base integration length - Modulation clock cycles count per repetition
the repetition count - Number of repetition of base integration
-
int epc660_ll_integration_time_get(const struct epc660_ll *epc660, uint32_t mod_freq_hz, uint32_t *int_us)
Get total integration length.
- Parameters:
epc660 – [in] epc660 instance
mod_freq_hz – [in] modulation frequency used for calulcation in Hz
int_us – [out] integration length in us
- Returns:
int
mod_freq_hz is 0 or
int_us overflow. See epc660_ll_calc_int_time_reg
int_us is NULL
Otherwise
-
int epc660_ll_tcmi_format_set(const struct epc660_ll *epc660, enum epc660_ll_tcmi_format format)
Select the TCMI transmission format.
- Parameters:
epc660 – [in] epc660 instance
format – [in] TCMI output format
- Returns:
int — See epc660_ll::i2c_write()
-
int epc660_ll_tcmi_polarity_set(const struct epc660_ll *epc660, uint8_t tcmi_outputs)
Select the TCMI sync-signals active polarity.
- Parameters:
epc660 – [in] epc660 instance
tcmi_outputs – [in] Combination of epc660_ll_tcmi_sync_output enum to be set to active high. Others will be set active low.
- Returns:
int
tcmi_outputs contains flag(s) not listed in epc660_ll_tcmi_sync_output
Otherwise
-
int epc660_ll_tcmi_polarity_get(const struct epc660_ll *epc660, uint8_t *tcmi_outputs)
Get the current TCMI sync-signals polarity.
- Parameters:
epc660 – [in] epc660 instance
tcmi_outputs – [out] Combination of epc660_ll_tcmi_sync_output enum which are active high.
- Returns:
int
tcmi_outputs contains flag(s) not listed in epc660_ll_tcmi_sync_output
Otherwise
-
int epc660_ll_tcmi_sample_edge_set(const struct epc660_ll *epc660, bool rising)
Select the TCMI data clock edge at which the outputs are aligned.
- Parameters:
epc660 – [in] epc660 instance
rising – [in] true - Align on rising edge; false - Align on falling edge
- Returns:
int — See epc660_ll::i2c_write()
-
int epc660_ll_dll_ctrl_set(const struct epc660_ll *epc660, enum epc660_ll_dll_ctrl ctrl)
Select delay locked loop operation.
- Parameters:
epc660 – [in] epc660 instance.
ctrl – [in] DLL operation
- Returns:
int — See epc660_ll::i2c_write()
-
int epc660_ll_dll_coarse_set(const struct epc660_ll *epc660, uint8_t coarse_step)
Set the manual DLL coarse delay steps.
- Parameters:
epc660 – [in] epc660 instance
coarse_step – [in] Coarse delay steps to be applied on LED output signal(s)
- Returns:
int
coarse_step is not in [0, 49]
Otherwise
-
int epc660_ll_led_ctrl_set(const struct epc660_ll *epc660, uint8_t ctrl_flags)
Set the LED configuration.
- Parameters:
epc660 – [in] epc660 instance
ctrl_flags – [in] Combination of epc660_ll_led_ctrl_set_flags enum to set. Others will be reset.
- Returns:
int
ctrl_flags contains flag(s) not listed in epc660_ll_led_ctrl_set_flags
Otherwise
-
int epc660_ll_led_ctrl_get(const struct epc660_ll *epc660, uint8_t *ctrl_flags)
Get the current led configuration.
- Parameters:
epc660 – [in] epc660
ctrl_flags – [in] Combination of epc660_ll_led_ctrl_set_flags enum
- Returns:
int — See epc660_ll::i2c_read()
-
int epc660_ll_ic_informations_get(const struct epc660_ll *epc660, struct epc660_ll_ic_information *info)
Get the information stored on sensor chip.
- Parameters:
epc660 – [in] epc660 instance
info – [out] buffer for IC information
- Returns:
int
info is NULL
Otherwise
-
static int epc660_ll_calc_int_time_reg(uint32_t int_us, uint32_t mod_freq_hz, uint8_t *reg_values)
private helper function used to convert an integration time to register values
Since the epc660 chip does not feature an internal measurement of the modulation clock frequency it only stores an amount of steps to do. The resulting integration times are dependend on the modulation clock frequency and the two integration time register. The integration lenght gets repated as many times as set in the integration time multiplier.
\[\begin{split} \begin{array}{rll} M & = M_{Hi}*2^8+M_{Lo} & := \text{Integration Multiplier} \\ N & = N_{Hi}*2^8+N_{Lo} + 1 & := \text{Integration Length} \\ t_{int} & = \dfrac{M*N}{f_{mod}} & \\ \end{array} \end{split}\]Following limit of integration time in dependence or modulation frequency:
\[\begin{split} \begin{array}{rll} t_{int,MIN}(f_{mod}) & = \dfrac{M_{MIN}*N_{MIN}}{f_{mod}} & = \dfrac{0001_{16}*0008_{16}}{f_{mod}} \\ t_{int,MAX}(f_{mod}) & = \dfrac{M_{MAX}*N_{MAX}}{f_{mod}} & = \dfrac{3FF_{16}*10000_{16}}{f_{mod}} \\ \end{array} \end{split}\]- Parameters:
int_us – [in] integration time in us
mod_freq_hz – [in] modulation frequency used for calulcation
reg_values – [out] buffer for register values:
reg_values[0] : M_Hi
reg_values[1] : M_Lo
reg_values[2] : L_Hi
reg_values[3] : L_Lo
- Returns:
int
reg_values is NULL
mod_freq_hz is 0 or
Mismatch between int_us and mod_freq_hz. See epc660_ll_integration_time_set() details
Otherwise
0
-
static int epc660_ll_calc_reg_int_time(const uint8_t *reg_values, uint32_t mod_freq_hz, uint32_t *int_us)
private helper function to convert the register values to integration time
Computes the integration time in us from the register values. The reverse computation of epc660_ll_calc_int_time_reg(). For values of \(f_{mod} < 15.6\ kHz\) the resulting integration time may exceed \(2^{32}-1\ \mu s\) which would lead to an overflow. Therefore error is returned rather than a nonsensical value.
- Parameters:
reg_values – [in] Integration Register values.
reg_values[0] : M_Hi
reg_values[1] : M_Lo
reg_values[2] : N_Hi
reg_values[3] : N_Lo
mod_freq_hz – [in] modulation frequency used for calulcation
int_us – [out] integration time in us
- Returns:
int
reg_values is NULL
mod_freq_hz is 0 or
int_us overflow. See details
Otherwise
0
-
EPC660_LL_ROI_MAX_WIDTH 320
-
EPC660_LL_ROI_MAX_HEIGHT 240
-
struct epc660_ll
Structure containing device and functions that need to be provided by user.
Public Members
-
const struct i2cdevice *i2c_device
-
i2c_read_reg_t i2c_read
-
i2c_write_reg_t i2c_write
-
const struct i2cdevice *i2c_device
-
struct epc660_ll_temp_sensor_calib
Temperature sensor calibration data.
The offset and gain are scaled to be able to prevent floating point arithmetic as it should be avoided in linux kernel drivers.
Public Members
-
int32_t offset_x1e5
Offset correction in 1e-5 C°
-
int32_t offset_x1e5
-
struct epc660_ll_sequence_entry
Structure of a sequencer program line entry.
-
struct epc660_ll_sequencer_program
Structure of a full sequencer program.
Public Members
-
enum epc660_ll_sequencer sequencer
-
const struct epc660_ll_sequence_entry *entries
-
const size_t num_entries
-
enum epc660_ll_sequencer sequencer
-
struct epc660_ll_ic_information
Container for information about sensor chip acquired with epc660_ll_ic_informations_get()