@@ -179,57 +179,85 @@ class SerialBase : private NonCopyable<SerialBase> {
179
179
180
180
#if DEVICE_SERIAL_ASYNCH
181
181
182
- /* * Begin asynchronous write using 8bit buffer. The completion invokes registered TX event callback
182
+ /* * Begin asynchronous write using 8bit buffer.
183
183
*
184
- * This function locks the deep sleep until any event has occurred
184
+ * The write operation ends with any of the enabled events and invokes
185
+ * registered callback function (which can be NULL to not receive callback at all).
186
+ * Events that are not enabled by event argument are simply ignored.
187
+ * Operation has to be ended explicitly by calling abort_write() when
188
+ * no events are enabled.
189
+ * This function locks the deep sleep until any event has occurred.
185
190
*
186
191
* @param buffer The buffer where received data will be stored
187
192
* @param length The buffer length in bytes
188
193
* @param callback The event callback function
189
- * @param event The logical OR of TX events
194
+ * @param event The logical OR of TX events that should end operation
195
+ * @return Zero if new transaction was started, -1 if transaction is already on-going
190
196
*/
191
197
int write (const uint8_t *buffer, int length, const event_callback_t &callback, int event = SERIAL_EVENT_TX_COMPLETE);
192
198
193
- /* * Begin asynchronous write using 16bit buffer. The completion invokes registered TX event callback
199
+ /* * Begin asynchronous write using 16bit buffer.
194
200
*
195
- * This function locks the deep sleep until any event has occurred
201
+ * The write operation ends with any of the enabled events and invokes
202
+ * registered callback function (which can be NULL to not receive callback at all).
203
+ * Events that are not enabled by event argument are simply ignored.
204
+ * Operation has to be ended explicitly by calling abort_write() when
205
+ * no events are enabled.
206
+ * This function locks the deep sleep until any event has occurred.
196
207
*
197
208
* @param buffer The buffer where received data will be stored
198
209
* @param length The buffer length in bytes
199
210
* @param callback The event callback function
200
- * @param event The logical OR of TX events
211
+ * @param event The logical OR of TX events that should end operation
212
+ * @return Zero if new transaction was started, -1 if transaction is already on-going
201
213
*/
202
214
int write (const uint16_t *buffer, int length, const event_callback_t &callback, int event = SERIAL_EVENT_TX_COMPLETE);
203
215
204
216
/* * Abort the on-going write transfer
217
+ *
218
+ * It is safe to call abort_write() when there is no on-going transaction.
205
219
*/
206
220
void abort_write ();
207
221
208
- /* * Begin asynchronous reading using 8bit buffer. The completion invokes registered RX event callback.
222
+ /* * Begin asynchronous reading using 8bit buffer.
209
223
*
210
- * This function locks the deep sleep until any event has occurred
224
+ * The read operation ends with any of the enabled events and invokes registered
225
+ * callback function (which can be NULL to not receive callback at all).
226
+ * Events that are not enabled by event argument are simply ignored.
227
+ * Operation has to be ended explicitly by calling abort_read() when
228
+ * no events are enabled.
229
+ * This function locks the deep sleep until any event has occurred.
211
230
*
212
231
* @param buffer The buffer where received data will be stored
213
232
* @param length The buffer length in bytes
214
233
* @param callback The event callback function
215
- * @param event The logical OR of RX events
234
+ * @param event The logical OR of RX events that should end operation
216
235
* @param char_match The matching character
236
+ * @return Zero if new transaction was started, -1 if transaction is already on-going
217
237
*/
218
238
int read (uint8_t *buffer, int length, const event_callback_t &callback, int event = SERIAL_EVENT_RX_COMPLETE, unsigned char char_match = SERIAL_RESERVED_CHAR_MATCH);
219
239
220
- /* * Begin asynchronous reading using 16bit buffer. The completion invokes registered RX event callback.
240
+ /* * Begin asynchronous reading using 16bit buffer.
221
241
*
222
- * This function locks the deep sleep until any event has occurred
242
+ * The read operation ends with any of the enabled events and invokes registered
243
+ * callback function (which can be NULL to not receive callback at all).
244
+ * Events that are not enabled by event argument are simply ignored.
245
+ * Operation has to be ended explicitly by calling abort_read() when
246
+ * no events are enabled.
247
+ * This function locks the deep sleep until any event has occurred.
223
248
*
224
249
* @param buffer The buffer where received data will be stored
225
250
* @param length The buffer length in bytes
226
251
* @param callback The event callback function
227
- * @param event The logical OR of RX events
252
+ * @param event The logical OR of RX events that should end operation
228
253
* @param char_match The matching character
254
+ * @return Zero if new transaction was started, -1 if transaction is already on-going
229
255
*/
230
256
int read (uint16_t *buffer, int length, const event_callback_t &callback, int event = SERIAL_EVENT_RX_COMPLETE, unsigned char char_match = SERIAL_RESERVED_CHAR_MATCH);
231
257
232
258
/* * Abort the on-going read transfer
259
+ *
260
+ * It is safe to call abort_read() when there is no on-going transaction.
233
261
*/
234
262
void abort_read ();
235
263
0 commit comments