Exemple #1
0
int console_drain( Console* cons )
{
	uchar ch;
	
	while( console_receive( cons, &ch, 0 ) != ERR_CONSOLE_NOT_READY );

	return ERR_NONE;
}
Exemple #2
0
void console_task(void) {
  uint8_t buffer[CONSOLE_EPSIZE];
  size_t size = 0;
  do {
    size_t size = chnReadTimeout(&drivers.console_driver.driver, buffer, sizeof(buffer), TIME_IMMEDIATE);
    if (size > 0) {
        console_receive(buffer, size);
    }
  } while(size > 0);
}
Exemple #3
0
int console_read( Console* cons, uchar* buffer, uint size )
{
	uint i = 0;
	int status = 0;
	
	for( i = 0; i < size; i += 1 ) {
		status = console_receive( cons, buffer + i, cons->blocking );
		if( status == ERR_CONSOLE_NOT_READY ){
			break;
		}
	}

	cons->last_read = i;

	return ERR_NONE;
}