Skip to content
José Carlos edited this page Sep 5, 2024 · 2 revisions

This documentation is for the plmctrl C++ shared library. Function prototypes are defined here, and implementations here. The wrappers in other languages only call those functions with some simple error handling.

StartUI

void StartUI(unsigned int number_of_frames)

Starts the UI display. Displays a texture on the second monitor

unsigned int number_of_frames
// is maximum number of frames to be stored in plmctrl's memory space, each frame contains 24 holograms

StopUI

void StopUI()

Safetly stops the UI display.


SetPLMWindowPos

void SetPLMWindowPos(int width, int height, int monitor)

Specifies the PLM window's size and the monitor in which to display. monitor = 0 is your main monitor, as specified by the OS. monitor = 1 is your second monitor.

int width
// PLM window width. For 0.67" PLM, width = 1358
int height
// PLM window height. For 0.67" PLM, width = 800
int monitor
// PLM monitor id. 0 = main monitor, 1 = secondary monitor

InsertPLMFrame

void InsertPLMFrame(unsigned char* frame, unsigned long long num_frames, unsigned long long offset, int format)

Inserts num_frames bitpacked frames into plmctrl's display sequence, starting at position offset (zero-based indexing). frame is expected to be laid out in memory continously in row-major fashion. format is an integer to specify in which colour format frame is (R8G8B8A8 or R8G8B8).

unsigned char* frame
// is a pointer to the frame data to be inserted.
unsigned long long num_frames
// is the number of frames to insert.
unsigned long long offset
// is the offset where the frame should be inserted in `plmctrl`.
int format
// format specifier. format = 0: RGB, format = 1: RGBA. 8 bits per colour channel

BitpackHolograms

bool BitpackHolograms(double* phase, unsigned char* frame, unsigned long long N, unsigned long long M, int num_holograms);

Bitpacks up to 24 N by M phase profiles into a single RGB frame.

double* phase
// is a pointer to the phase data.
unsigned char* frame
// is a pointer to the memory space where the frame will be stored.
unsigned long long N
// is the number of rows in the phase profile (PLM width).
unsigned long long M
// is the number of columns in the phase profile (PLM height).
int num_holograms
// is the number of phase profiles (up to 24).

StartSequence

bool StartSequence(int number_of_frames)

Initiates a new sequence with the specified number of frames.

int number_of_frames
// The total number of frames in the sequence to be started

StartSequence

bool StartSequence(int number_of_frames)

Initiates a new sequence with the specified number of frames. Returns true if the sequence is successfully started, false otherwise.

int number_of_frames
// The total number of frames in the sequence to be started

SetPhaseMap

bool SetPhaseMap(int* new_phase_map)

Sets a new phase-level (16 levels) -> 2 by 2 binary encoding map. Affects how the hologram is encoded. This can be used to properly calibrate the PLM's lookup-table. Returns true if the phase map is successfully set, false otherwise.

int* new_phase_map
// Pointer to the new phase map data

SetPLMWindowPos

void SetPLMWindowPos(int width, int height, int monitor)

Specifies the PLM window's size and the monitor on which to display it.

int width
// PLM window width in pixels
int height
// PLM window height in pixels
int monitor
// Monitor ID. Typically, 0 = main monitor, 1 = secondary monitor, etc. (parameter not working now)

SetLookupTable

void SetLookupTable(double* phase)

Sets a new lookup table for the PLM -- 16 normalized phase values (0 to 1) relating mirror state to phase offset.

double* phase
// Pointer to the new lookup table data

SetFrameSequence

bool SetFrameSequence(unsigned long long* sequence, unsigned long long length)

Sets a new frame sequence for the PLM. Returns true if the frame sequence is successfully set, false otherwise.

unsigned long long* sequence
// Pointer to the new frame sequence data
unsigned long long length
// The length of the frame sequence

SetPLMFrame

bool SetPLMFrame(unsigned long long offset)

Sets the current PLM frame to the specified offset in the sequence. Returns true if the frame sequence is successfully set, false otherwise.

unsigned long long offset
// The offset of the frame to be set as the current frame