DLPC 350

class pycrafter4500.dlpc350(device)

Class representing dmd controller. Can connect to different DLPCs by changing product ID. Check IDs in device manager.

__init__(device)

Connects the device.

Parameters:device – lcr4500 USB device.
command(mode, sequence_byte, com1, com2, data=None)

Sends a command to the dlpc.

Parameters:
  • mode (str) – Whether reading or writing.
  • sequence_byte (int) –
  • com1 (int) – Command 1
  • com2 (int) – Command 3
  • data (list) – Data to pass with command.
get_main_status(pretty_print=False)

The Main Status command shows the status of DMD park and DLPC350 sequencer, frame buffer, and gamma correction.

(USB: CMD2: 0x02, CMD3: 0x0C)

mailbox_set_address(address=0)

This API defines the offset location within the DLPC350 mailboxes to write data into or to read data from.

(USB: CMD2: 0x1A, CMD3: 0x32)

Parameters:address (int) – Defines the offset within the selected (opened) LUT to write/read data to/from (0-127).
open_mailbox(mbox_num)

This API opens the specified Mailbox within the DLPC350 controller. This API must be called before sending data to the mailbox/LUT using DLPC350_SendPatLut() or DLPC350_SendImageLut() APIs.

(USB: CMD2: 0x1A, CMD3: 0x33)

Parameters:mbox_num
0:Disable (close) the mailboxes.
1:Open the mailbox for image index configuration.
2:Open the mailbox for pattern definition.
3:Open the mailbox for the Variable Exposure.
pattern_display(action='start')

This API starts or stops the programmed patterns sequence.

(USB: CMD2: 0x1A, CMD3: 0x24)

Parameters:action (int) –

Pattern Display Start/Stop Pattern Sequence

0:Stop Pattern Display Sequence. The next “Start” command will restart the pattern sequence from the beginning.
1:Pause Pattern Display Sequence. The next “Start” command will start the pattern sequence by re-displaying the current pattern in the sequence.
2:Start Pattern Display Sequence.
read_reply()

Reads in reply.

send_pattern_lut(trig_type, pat_num, bit_depth, led_select, do_invert_pat=False, do_insert_black=False, do_buf_swap=False, do_trig_out_prev=False)

Mailbox content to setup pattern definition. See table 2-65 in programmer’s guide for detailed description of pattern LUT entries.

(USB: CMD2: 0x1A, CMD3: 0x34)

Parameters:
  • trig_type (int) –

    Select the trigger type for the pattern

    0:Internal trigger.
    1:External positive.
    2:External negative.
    3:No Input Trigger (Continue from previous; Pattern still has full exposure time).
    0x3FF:Full Red Foreground color intensity
  • pat_num (int) – Pattern number (0 based index). For pattern number 0x3F, there is no pattern display. The maximum number supported is 24 for 1 bit-depth patterns. Setting the pattern number to be 25, with a bit-depth of 1 will insert a white-fill pattern. Inverting this pattern will insert a black-fill pattern. These patterns will have the same exposure time as defined in the Pattern Display Exposure and Frame Period command. Table 2-66 in the programmer’s guide illustrates which bit planes are illuminated by each pattern number.
  • bit_depth

    Select desired bit-depth

    0:Reserved
    1:1-bit
    2:2-bit
    3:3-bit
    4:4-bit
    5:5-bit
    6:6-bit
    7:7-bit
    8:8-bit
  • led_select (int) –

    Choose the LEDs that are on (bit flags b0 = Red, b1 = Green, b2 = Blue)

    0:0b000 No LED (Pass through)
    1:0b001 Red
    2:0b010 Green
    3:0b011 Yellow (Green + Red)
    4:0b100 Blue
    5:0b101 Magenta (Blue + Red)
    6:0b110 Cyan (Blue + Green)
  • do_invert_pat (bool) –
    True:Invert pattern.
    False:Do not invert pattern.
  • do_insert_black (bool) –
    True:Insert black-fill pattern after current pattern. This setting requires 230 us of time before the start of the next pattern.
    False:Do not insert any post pattern.
  • do_buf_swap (bool) –
    True:perform a buffer swap.
    False:Do not perform a buffer swap.
  • do_trig_out_prev
    True:Trigger Out 1 will continue to be high. There will be no falling edge between the end of the previous pattern and the start of the current pattern. Exposure time is shared between all patterns defined under a common trigger out). This setting cannot be combined with the black-fill pattern.
    False:Trigger Out 1 has a rising edge at the start of a pattern, and a falling edge at the end of the pattern.
set_buffer_freeze(freeze=False)

The Display Buffer Freeze command disables swapping the memory buffers.

(USB: CMD2: 0x10, CMD3: 0x0A)

Parameters:park (bool) – Whether to park the dmd mirrors
set_display_mode(mode='pattern')

Selects the input mode for the projector.

(USB: CMD2: 0x1A, CMD3: 0x1B)

Parameters:mode (int) –
0:”video” mode
1:”pattern” mode
set_dmd_park(park=False)

This command is used to park or unpark the DMD, whenever system is idle user can send this command to park the DMD.

(USB: CMD2: 0x06, CMD3: 0x09)

Parameters:park (bool) – Whether to park the dmd mirrors
set_exposure_frame_period(exposure_period, frame_period)

The Pattern Display Exposure and Frame Period dictates the time a pattern is exposed and the frame period. Either the exposure time must be equivalent to the frame period, or the exposure time must be less than the frame period by 230 microseconds. Before executing this command, stop the current pattern sequence. After executing this command, call DLPC350_ValidatePatLutData() API before starting the pattern sequence.

(USB: CMD2: 0x1A, CMD3: 0x29)

Parameters:
  • exposure_period (int) – Exposure time in microseconds (4 bytes).
  • frame_period (int) – Frame period in microseconds (4 bytes).
set_gamma_correction(apply_gamma=True)

This command only works in video mode.

Because the DMD is inherently linear in response, the Gamma Correction command specifies the removal of the gamma curve that is applied to the video data at the source. Two degamma tables are provided: TI Video (Enhanced) and TI Video (Max Brightness).

(USB: CMD2: 0x1A, CMD3: 0x0E)

Parameters:apply_gamma (bool) – Whether to apply gamma correction while in video mode.
set_pattern_config(num_lut_entries=3, do_repeat=True, num_pats_for_trig_out2=3, num_images=0)

This API controls the execution of patterns stored in the lookup table. Before using this API, stop the current pattern sequence using DLPC350_PatternDisplay() API. After calling this API, send the Validation command using the API DLPC350_ValidatePatLutData() before starting the pattern sequence.

(USB: CMD2: 0x1A, CMD3: 0x31)

Parameters:
  • num_lut_entries (int) – Number of LUT entries.
  • do_repeat (bool) –
    True:Execute the pattern sequence once.
    False:Repeat the pattern sequence.
  • num_pats_for_trig_out2 (int) – Number of patterns to display(range 1 through 256). If in repeat mode, then this value dictates how often TRIG_OUT_2 is generated.
  • num_images (int) – Number of Image Index LUT Entries(range 1 through 64). This Field is irrelevant for Pattern Display Data Input Source set to a value other than internal.
set_pattern_input_source(mode='video')

Selects the input type for pattern sequence.

(USB: CMD2: 0x1A, CMD3: 0x22)

Parameters:mode (int) –
0:”video”
3:”flash”
set_pattern_trigger_mode(mode='vsync')

Selects the trigger type for pattern sequence.

(USB: CMD2: 0x1A, CMD3: 0x23)

Parameters:mode (int) –
0:”vsync”
set_power_mode(do_standby=False)

The Power Control places the DLPC350 in a low-power state and powers down the DMD interface. Standby mode should only be enabled after all data for the last frame to be displayed has been transferred to the DLPC350. Standby mode must be disabled prior to sending any new data.

(USB: CMD2: 0x02, CMD3: 0x00)

Parameters:do_standby (bool) –
True:Standby mode. Places DLPC350 in low power state and powers down the DMD interface.
False:Normal operation. The selected external source will be displayed.
start_pattern_lut_validate()

This API checks the programmed pattern display modes and indicates any invalid settings. This command needs to be executed after all pattern display configurations have been completed.

(USB: CMD2: 0x1A, CMD3: 0x1A)

Helpers

pycrafter4500.connect_usb()

Context manager for connecting to and releasing usb device.

Yields:USB device.
pycrafter4500.pattern_mode(input_mode='pattern', input_type='video', num_pats=3, trigger_type='vsync', period=4504, bit_depth=7, led_color=7, **kwargs)

Helper function to setup a video pattern mode.

Parameters:
  • input_mode (str) – See pycrafter4500.set_display_mode()
  • input_type (str) – See pycrafter4500.set_pattern_input_source()
  • num_pats (int) – See pycrafter4500.set_pattern_config()
  • trigger_type (str) – See pycrafter4500.set_pattern_trigger_mode()
  • period (int) – See pycrafter4500.set_exposure_frame_period()
  • bit_depth (int) – See pycrafter4500.send_pattern_lut()
  • led_color (int) – See pycrafter4500.send_pattern_lut()
pycrafter4500.video_mode()

Puts LCR4500 into video mode.

pycrafter4500.power_down()

Puts LCR4500 into standby mode.

pycrafter4500.power_up()

Wakes LCR4500 up from standby mode.

pycrafter4500.conv_len(a, l)

Function that converts a number into a bit string of given length.

Parameters:
  • a (int) – Number to convert.
  • l (int) – Length of bit string.
Returns:

Padded bit string.

pycrafter4500.bits_to_bytes(a, reverse=True)

Function that converts bit string into a given number of bytes.

Parameters:
  • a (str) – Bytes to convert.
  • reverse (bool) – Whether or not to reverse the byte list.
Returns:

List of bytes.

pycrafter4500.fps_to_period(fps)

Calculates desired period (us) from given fps.

Parameters:fps (int) – Frames per second.
Returns:Period (us).