This is the quick start guide for the SAM4L Parallel Capture (PARC) Driver, with step-by-step instructions on how to configure and use the driver for a specific use case.
The use cases contain several code fragments. The code fragments in the steps for setup can be copied into a custom initialization function, while the steps for usage can be copied into, e.g. the main application function.
This use case demonstrates how to use the PARC module on SAM4L. In this use case the PARC module is configured as:
This module requires the following service:
Add the following to the main loop or a setup function:
We can poll the data ready status and then read it once capture has finished:
uint32_t captured_data; while (!parc_is_data_ready(&module_inst)) { } parc_read(&module_inst, &captured_data);
We can enable the data ready interrupt and install a callback function to perform a custom task:
parc_register_callback(&module_inst, (parc_callback_t)parc_complete_callback, PARC_CALLBACK_DATA_READY); parc_enable_interrupts(&module_inst, PARC_INTERRUPT_DRDY); parc_enable_callback(&module_inst, PARC_CALLBACK_DATA_READY); parc_start_capture(&module_inst); // The callback function example. static void parc_complete_callback( struct parc_module *const module) { callback_data_ready = true; parc_read(module, &captured_data); }