asynchronous mode
This example demonstrates using the FreeRTOS TWI driver to receive data using the fully asynchronous operation mode. See Initializing the FreeRTOS TWI driver
The example below implements a function that receives a block of data, then processes the received data while another bock is being received.
Refer to the FreeRTOS peripheral control projects in the Atmel ASF distribution for complete working examples, and the FreeRTOS web site for information on getting started with FreeRTOS.
{
uint16_t calculated_address;
read_parameters.
buffer = first_receive_buffer;
calculated_address = 0;
read_parameters.
addr[0] = 0;
read_parameters.
addr[1] = 0;
notification_semaphore);
calculated_address += BUFFER_SIZE
read_parameters.
addr[0] = (uint8_t) ((calculated_address >> 8) & 0xff);
read_parameters.
addr[1] = (uint8_t) (calculated_address & 0xff);
read_parameters.
buffer = second_receive_buffer;
notification_semaphore);
process_received_data(first_receive_buffer);
process_received_data(second_receive_buffer);
}