I can write with chnWrite, but I have problems with read, I got random chars.
With chnReadTimeout I got compile error: 'const struct BaseSequentialStreamVMT' has no member named 'readt'
Is is possible to use timeout version with wrapper like this ? How to add timeout check ?
Is there another working example ?
Code: Select all
THD_FUNCTION(console_thd, arg)
{
console_t *con;
msg_t msg;
char input;
con = arg;
BaseSequentialStream* chp = con->bss;
int i=0;
uint8_t c;
while (1)
{
chnWrite(chp, (uint8_t *)'A', 1);
// if(c !=0)
// chnWrite(chp, (uint8_t *)(c+1), 1);
if (chnRead(chp, &c, 1) == 0)
c = 0;
// if (chnReadTimeout(chp, &c, 1, MS2ST(100)) == 0)
// c = 0;
chThdSleepMilliseconds(500);
}