# libri Introduction¶

## Introduction¶

libri is a c library for interfacing with Resolved Instrument’s DPD80 digital photodetector. It provides the most computationally efficient method for communicating with DPD80 photodetectors and is used internally by Resolved Instruments for all DPD80 related software.

## General usage¶

libri contains two methods to collect data. The first, the blocking method, uses ri_get_raw_data() to collect a predetermined amount of samples. This is the simplest method of taking data, and the function blocks until the requested number of samples have been collected.

Since the memory for these samples to be stored in must be allocated before the function is called, the length of continuous data that can be collected is effectively limited by the amount of ram present. Keep in mind 32 bit applications can only access < 4 GB of ram even if the system contains larger amounts.

The second method, the streaming method, uses ri_start_continuous_transfer() and a callback function. This function is called repeatedly after a short quantity of samples is collected and it is up to the callback function to copy the data elsewhere in memory or do whatever operation is needed on the samples. This will run forever until the transfer operation is requested to be stopped by the callback function.

## Examples¶

For examples on how to use each of these methods for data collection, please see the example directory in the libri distribution. For a complete list of functions provided by libri, please visit the libri Reference .

## Compiling¶

The examples provided compile on Windows with either the gcc based mingw32 compiler or with Visual Studio 2015.

For mingw32, the system path should include the mingw32 bin/ directory with make, gcc, ld, etc. executables. Simple Makefiles are included in the example directories, and it should be sufficient to cd into those directories and run make to compile the examples.

For Visual Studio 2015, project files to compile the examples exist in the examples/visualstudio directory. To compile with libri in a new project, the follow settings should be configured in the project properties:

C/C++ > General > Additional Include Directories: add the libri include directory

Linker > General > Additional Library Directories: add the libri lib or lib64 directory depending on platform of the build.

Additionally the libri.dll file will have to be copied from lib/ or lib64/ and put in the same directory as the executable for the examples to run.