MPLAB Harmony Bluetooth Help
|
void DRV_BM64_BufferAddRead(const DRV_HANDLE handle,
DRV_BM6_BUFFER_HANDLE *bufferHandle, void *buffer, size_t size)
Schedule a non-blocking driver read operation.
This function schedules a non-blocking read operation. The function returns with a valid buffer handle in the bufferHandle argument if the read request was scheduled successfully. The function adds the request to the hardware instance receive queue and returns immediately. While the request is in the queue, the application buffer is owned by the driver and should not be modified. The function returns DRV_BM64_BUFFER_HANDLE_INVALID
If the requesting client registered an event callback with the driver, the driver will issue a DRV_BM64_BUFFER_EVENT_COMPLETE event if the buffer was processed successfully of DRV_BM64_BUFFER_EVENT_ERROR event if the buffer was not processed successfully.
DRV_BM64_Open must have been called to obtain a valid opened device handle.
Parameters |
Description |
handle |
valid handle to an opened BM64 device driver unique to client |
bufferHandle |
pointer to an argument that contains the return buffer handle |
buffer |
pointer to buffer that will contain received data |
size |
buffer size in bytes. |
The bufferHandle parameter will contain the return buffer handle. This will be DRV_BM64_BUFFER_HANDLE_INVALID if the function was not successful.
case APP_STATE_BT_BUFFER_COMPLETE: { //BT RX if (!_bufferUsed[appData.readIndex]) { //Next BT Read Queued // note generic version of call (DRV_BT instead of DRV_BM64) is used DRV_BT_BufferAddRead(appData.bt.handle, &appData.bt.readBufHandle, audioBuffer[appData.readIndex], appData.bt.bufferSize); if(appData.bt.readBufHandle != DRV_BT_BUFFER_HANDLE_INVALID) { appData.bt.readBufHandle = DRV_BT_BUFFER_HANDLE_INVALID; _bufferUsed[appData.readIndex] = true; //QUEUE HEAD Index (for next BT read) appData.readIndex++; if(appData.readIndex >= AUDIO_QUEUE_SIZE) { appData.readIndex = 0; } appData.state = APP_STATE_BT_WAIT_FOR_BUFFER_COMPLETE; } else { SYS_DEBUG(0, "BT Buffer Read FAILED!!!"); } } else { //Overrun -- Wait for Read buffer to become available. SYS_DEBUG(0, "Buffer Overrunrn"); } } break;
void DRV_BM64_BufferAddRead( const DRV_HANDLE handle, DRV_BM64_BUFFER_HANDLE * bufferHandle, void * buffer, size_t size );
MPLAB Harmony Bluetooth Help
|