size_t FreeRTOS_read( Peripheral_Descriptor_t const pxPeripheral, void * const pvBuffer, const size_t xBytes );
Reads one or more bytes from an open peripheral.
|pxPeripheral||The descriptor associated with the peripheral from which bytes are being read. The descriptor will have been returned from the FreeRTOS_open() call used to open the peripheral.|
|pvBuffer||The buffer into which read data are placed.|
The total number of bytes requested.
When an interrupt driven transfer mode is used, the total number of bytes actually read will be less than the total number requested if the total number requested are not available before the peripheral’s read timeout expires. FreeRTOS_ioctl() is used to set the read timeout value.
The total number of bytes read. This will be less than the number of bytes requested by the xBytes parameter if the requested number of bytes cannot be read before the peripheral’s read timeout expires. FreeRTOS_ioctl() is used to set the read timeout value.
The example 1 code snippet demonstrates how to perform a read when a peripheral is configured to use the polled transfer mode. Peripherals default to polled mode when they are opened.
The example 2 code snippet demonstrates how to perform a read when a peripheral is configured to use either the interrupt driven character queue transfer mode, or the interrupt driven circular buffer transfer mode. In these modes, the task making the FreeRTOS_read() call is held in the Blocked state (not using any CPU time) until either the requested number of bytes have been read, or the read timeout expires. FreeRTOS_ioctl() is used with the iocltSET_RX_TIMEOUT request code to configure the read timeout.