// function declaration
long FLIGrabRow(long dev, void* buff, size_t width);
long img_rows = 1024;
long row_width = 1024;
long img_size = img_rows * row_width;
uint16_t img[img_size]
// (dev is a long that identifies the device)
// read data into array
for (int row = 0; row < img_rows; row++)
{
FLIGrabRow( dev, &img[row * (row_width)], row_width);
}
As the loop continues, we index farther into the buffer, row by row.
buff_p = ffi.new("uint16_t[1024]")
lib.FLIGrabRow(dev[0], buff_p, 1024)
x = ffi.unpack(buff_p, 1024)
print x
ffibuilder.set_source(
"_grabrow",
"""
long dev = 0;
long size = 1024;
uint16_t img[1024];
long x = FLIGrabRow( dev, img[0], size);
""",
libraries=["/usr/local/lib/libfli.so"]
)
ffibuilder.cdef("""
long FLIGrabRow(long dev, void *buff, size_t width);
""")
if __name__ == "__main__":
ffibuilder.compile(verbose=True)
_grabrow.c:426:14: warning: implicit declaration of function 'FLIGrabRow' is invalid in C99 [-Wimplicit-function-declaration]
long x = FLIGrabRow( dev, img[0], size);
^
_grabrow.c:426:14: error: initializer element is not a compile-time constant
long x = FLIGrabRow( dev, img[0], size);
Among other things, I'm not seeing how to pass parameters to the function I define in set_source()
A bientôt,
Armin.