Data Fields | |
str2CheckOutSpace | checkOutSpaceFunc |
This stream's check enough output buffer available function. | |
str2InBufferd | inBufferdFunc |
This stream's input buffer available function. | |
str2OutSpace | outSpaceFunc |
This stream's output buffer available function. | |
str2PutS_P | putS_P_func |
This stream's output a string in flash / program memory function. | |
str2PutS | putSfunc |
This stream's output a RAM string function. |
Extra stream (type) specific data.
By extensions to the stdio type FILE
weAutSys will handle textual output and input in a common and extensible way as well as late binding of stream type specific functions.
For additional user / application streams do something like
// have seven specialised functions defined for my extra stream myStreams FILE myStreams = FDEV_SETUP_STREAM(myPutChar, myGetChar, _FDEV_SETUP_RW ); struct streamClassDescript_t myStreamsData = { .inBufferdFunc = (str2InBufferd)myInBufferd, .outSpaceFunc = (str2OutSpace)myStreamsOutSpace, .checkOutSpaceFunc = (str2CheckOutSpace)myCheckOutSpace, .putSfunc = (str2PutS)myPutSt, .putS_P_func = (str2PutS_P)myPutSt_P() }; // in an initialisation block fdev_set_udata(&myStreams, &myStreamsData);
That's it. The basic I/O functions myPutChar
and/or myGetChar
are, of course, mandatory. All others could be omitted if the respective common / default behaviour is sufficient. For performance reasons those omissions are seldom recommended.
The common behaviour is defined by inBufferd, outSpace, checkOutSpace, putSt and putSt_P. They can be called for the exemplary myStream
after switching to it.
This stream's input buffer available function.
Let or set to null if no number in a range 0..buffer size can be determined.
The common function inBufferd() will return AVAILABLE_UNKNOWN then.
This stream's output buffer available function.
Let or set to null if no number in a range 0..buffer size can be determined.
The common function outSpace() will return AVAILABLE_UNKNOWN then.
This stream's check enough output buffer available function.
Let or set to null if this can't never be determined (i.e. the return value would always be 1).
The common function outSpace() will return 1 then.
This stream's output a RAM string function.
If let or set NULL
the common function putSt() will use fputs()
.
This stream's output a string in flash / program memory function.
If let or set NULL
the common function putSt_P() will use fputs_P()
.