Functions | |
| NANOEXT void POSCALL | c_nos_keyinput (UVAR_t key) |
| NANOEXT char POSCALL | nosKeyGet (void) |
| NANOEXT UVAR_t POSCALL | nosKeyPressed (void) |
| NANOEXT UVAR_t POSCALL | p_putchar (char c) |
| NANOEXT void POSCALL | c_nos_putcharReady (void) |
| NANOEXT void POSCALL | nosPrintChar (char c) |
| NANOEXT void POSCALL | nosPrint (const char *s) |
| NANOEXT void POSCALL | nosPrintf1 (const char *fmt, arg a1) |
| NANOEXT void POSCALL | nosSPrintf1 (char *buf, const char *fmt, arg a1) |
The nano layer supplies a set of multitasking able console I/O functions. Note that the platform port must support some basic I/O mechanisms. For console output, pico]OS calls the function p_putchar to output a single character. This function may fail when a transmitter FIFO ran out of space, and the function c_nos_putcharReady should be called when the transmitter is ready again. Input from a terminal or keyboard is fet into pico]OS by calling the function c_nos_keyinput or by rising the software interrupt number zero with the keycode as parameter. Not all platform ports may support console I/O, please read the port documentation for further information.
Since the nano layer supplies also a set of printf and sprintf functions, you may no more need a large runtime library in some special cases.
| NANOEXT void POSCALL c_nos_keyinput | ( | UVAR_t | key | ) |
Keyboard input. This function is called by the architecture port to feed keyboard input into the nano layer.
| key | keycode of the pressed key |
| NANOEXT void POSCALL c_nos_putcharReady | ( | void | ) |
This is the optional handshake function for p_putchar. The handshake function is usefull for console output over a serial line. The function p_putchar will fail when the transmitter FIFO is full, and the nano layer will save the last character for later transmission. The platform port should than call c_nos_putcharReady when the transmitter FIFO has space again (when the last character has left the output shift register); most commonly this is signalled by a hardware interrupt, that would be used to call this handshake function.
The purpose of this handshaking is to reduce CPU usage by avoiding polling on the standard output until the stdout is ready again. In the current implementation this function triggers a semaphore that wakes the task waiting for service on standard out.
Note that this function must be supplied by the architecture port; it is not callable by the user.
| NANOEXT char POSCALL nosKeyGet | ( | void | ) |
Wait and get the code of the next pressed key. This function blocks until the user presses a key on the keyboard and returns the code of the pressed key as result.
| NANOEXT UVAR_t POSCALL nosKeyPressed | ( | void | ) |
Test if a key was pressed. This function tests if a key code is available in the keyboard buffer. Even if no key is pressed yet, the function will immediately return.
| NANOEXT void POSCALL nosPrint | ( | const char * | s | ) |
Print a character string to the console or terminal. This function prints a string of characters (text) to the console. A CR/LF conversion is performed, CR is preceding each LF.
| s | pointer to zero terminated ASCII string |
| NANOEXT void POSCALL nosPrintChar | ( | char | c | ) |
Print a character to the console or terminal. This function prints a single character to the console. No CR/LF conversion is performed.
| NANOEXT void POSCALL nosPrintf1 | ( | const char * | fmt, | |
| arg | a1 | |||
| ) |
Print a formated character string to the console or terminal. This function acts like the usual printf function, except that it is limmited to the basic formats. The largest integer that can be displayed is of type INT_t.
| fmt | format string | |
| a1 | first argument |
| NANOEXT void POSCALL nosSPrintf1 | ( | char * | buf, | |
| const char * | fmt, | |||
| arg | a1 | |||
| ) |
Print a formated character string to a string buffer. This function acts like the usual sprintf function, except that it is limmited to the basic formats. The largest integer that can be displayed is of type INT_t.
| buf | destination string buffer | |
| fmt | format string | |
| a1 | first argument |
| NANOEXT UVAR_t POSCALL p_putchar | ( | char | c | ) |
Print a character to the console or terminal. This function must be supplied by the architecture port; it is not callable by the user.
| c | character to print out. |
If this function returns FALSE, the platform port must do a call to c_nos_putcharReady when it is ready again for accepting new characters. When NOSCFG_CONOUT_HANDSHAKE is disabled, the return value of this function is ignored.
1.5.4