|
@@ -282,12 +282,6 @@ cmSeH_t cmSeCreate( cmCtx_t* ctx, cmSeH_t* hp, const char* deviceStr, unsigned b
|
282
|
282
|
goto errLabel;
|
283
|
283
|
}
|
284
|
284
|
|
285
|
|
- if( cmThreadPause(p->_thH,0) != kOkThRC )
|
286
|
|
- {
|
287
|
|
- rc = cmErrMsg(&p->_err,kThreadErrSeRC,0,"Thread start failed.");
|
288
|
|
- goto errLabel;
|
289
|
|
- }
|
290
|
|
-
|
291
|
285
|
if( hp != NULL )
|
292
|
286
|
hp->h = p;
|
293
|
287
|
else
|
|
@@ -321,6 +315,26 @@ cmSeRC_t cmSeDestroy(cmSeH_t* hp )
|
321
|
315
|
return rc;
|
322
|
316
|
}
|
323
|
317
|
|
|
318
|
+cmSeRC_t cmSeSetCallback( cmSeH_t h, cmSeCallbackFunc_t cbFunc, void* cbArg )
|
|
319
|
+{
|
|
320
|
+ cmSerialPort_t* p = _cmSePtrFromHandle(h);
|
|
321
|
+ p->_cbFunc = cbFunc;
|
|
322
|
+ p->_cbArg = cbArg;
|
|
323
|
+ return kOkSeRC;
|
|
324
|
+}
|
|
325
|
+
|
|
326
|
+cmSeRC_t cmSeStart( cmSeH_t h )
|
|
327
|
+{
|
|
328
|
+ cmSerialPort_t* p = _cmSePtrFromHandle(h);
|
|
329
|
+
|
|
330
|
+ if( cmThreadPause(p->_thH,0) != kOkThRC )
|
|
331
|
+ return cmErrMsg(&p->_err,kThreadErrSeRC,0,"Thread start failed.");
|
|
332
|
+
|
|
333
|
+ return kOkSeRC;
|
|
334
|
+}
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
324
|
338
|
bool cmSeIsOpen( cmSeH_t h)
|
325
|
339
|
{
|
326
|
340
|
if( h.h == NULL )
|
|
@@ -542,6 +556,9 @@ cmSeRC_t cmSePortTest(cmCtx_t* ctx)
|
542
|
556
|
|
543
|
557
|
h = cmSeCreate(ctx,&h,device,baud,serialCfgFlags,_cmSePortTestCb,NULL,pollPeriodMs);
|
544
|
558
|
|
|
559
|
+ if( cmSeIsOpen(h) )
|
|
560
|
+ cmSeStart(h);
|
|
561
|
+
|
545
|
562
|
bool quitFl = false;
|
546
|
563
|
printf("q=quit\n");
|
547
|
564
|
while(!quitFl)
|