Koala Library
koala_utils.c File Reference

Useful functions of the libkoala. More...

Include dependency graph for koala_utils.c:

Go to the source code of this file.

Functions

int koala_kbhit (void)
void koala_change_term_mode (int dir)
void koala_clrscr (void)
void koala_erase_line (int line)
void koala_move_cursor (int c, int l)
void koala_move_cursor_column (int c)
void koala_move_cursor_line (int l)
long long koala_timeval_diff (struct timeval *difference, struct timeval *end_time, struct timeval *start_time)

Detailed Description

Useful functions of the libkoala.

Definition in file koala_utils.c.


Function Documentation

void koala_change_term_mode ( int  dir)

Change terminal mode for getchar to return immediately

Parameters:
dir1= mode changed to non-blocking, 0 mode reverted to previous
Returns:
none

Definition at line 85 of file koala_utils.c.

Referenced by ctrlc_handler(), drive_robot(), and main().

void koala_clrscr ( void  )

Clear the console screen

Definition at line 111 of file koala_utils.c.

Referenced by drive_robot(), and main().

void koala_erase_line ( int  line)

erase line (origin at 1,1)

Parameters:
lineline

Definition at line 124 of file koala_utils.c.

References koala_move_cursor().

Here is the call graph for this function:

int koala_kbhit ( void  )

Test if anykey was pushed

Returns:
-1 if error occured >=0 number of characters to read

Definition at line 52 of file koala_utils.c.

Referenced by braitenbergAvoidance(), drive_robot(), and main().

void koala_move_cursor ( int  c,
int  l 
)

move cursor (origin at 1,1)

Parameters:
ccolumn
lline

Definition at line 136 of file koala_utils.c.

Referenced by koala_erase_line().

void koala_move_cursor_column ( int  c)

move cursor column (origin at 1,1), keep line

Parameters:
ccolumn

Definition at line 146 of file koala_utils.c.

void koala_move_cursor_line ( int  l)

move cursor line (origin at 1,1), keep column

Parameters:
lline

Definition at line 156 of file koala_utils.c.

long long koala_timeval_diff ( struct timeval *  difference,
struct timeval *  end_time,
struct timeval *  start_time 
)

Compute time difference

Parameters:
differencedifference between the two times, in structure timeval type
end_timeend time
start_timestart time
Returns:
difference between the two times in [us]

Definition at line 174 of file koala_utils.c.