[][src]Function librgbmatrix_sys::led_matrix_create_from_options

pub unsafe extern "C" fn led_matrix_create_from_options(
    options: *mut RGBLedMatrixOptions,
    argc: *mut c_int,
    argv: *mut *mut *mut c_char
) -> *mut RGBLedMatrix

Universal way to create and initialize a matrix. The "options" struct (if not NULL) contains all default configuration values chosen by the programmer to create the matrix.

If "argc" and "argv" are provided, this function also reads command line flags provided, that then can override any of the defaults given. The arguments that have been used from the command line are removed from the argv list (and argc is adjusted) - that way these don't mess with your own command line handling.

The actual options used are filled back into the "options" struct if not NULL.

Usage:

int main(int argc, char **argv) { struct RGBLedMatrixOptions options; memset(&options, 0, sizeof(options)); options.rows = 32; // You can set defaults if you want. options.chain_length = 1; struct RGBLedMatrix *matrix = led_matrix_create_from_options(&options, &argc, &argv); if (matrix == NULL) { led_matrix_print_flags(stderr); return 1; } // do additional commandline handling; then use matrix... }