Receives new data from the device. Called repeatedly by mip_interface_update() while waiting for command responses.
- Parameters
-
device | The mip interface object |
buffer | Buffer to fill with data. Should be allocated before calling this function |
max_length | Max number of bytes that can be read into the buffer. |
out_length | Number of bytes actually read into the buffer. |
timestamp_out | Timestamp of the data was received. |
- Returns
- true if operation should continue, or false if the device cannot be updated (e.g. if the serial port is not open).
- Note
- Except in case of error (i.e. returning false), the timestamp must be set even if no data is received. This is required to allow commands to time out.
-
On systems where it makes sense, this is a good place to call sleep or enter a low-power state until data arrives at the port. Typically this function will wait a few milliseconds before returning.
- Warning
- Do not block indefinitely as this will stall the system beyond the normal command timeout. Use a sensible timeout (i.e. 1/10th of the base reply timeout) or only sleep for a minimal amount of time.