#include <os.h>
Go to the source code of this file.
Data Structures | |
struct | nio_console |
Macros | |
#define | NIO_CURSOR_BLOCK 0 |
#define | NIO_CURSOR_UNDERSCORE 1 |
#define | NIO_CURSOR_VERTICAL 2 |
#define | NIO_CURSOR_CUSTOM 3 |
#define | NIO_CHAR_WIDTH 6 |
#define | NIO_CHAR_HEIGHT 8 |
#define | NIO_MAX_ROWS 30 |
#define | NIO_MAX_COLS 53 |
#define | nio_getc nio_fgetc |
#define | nio_putc nio_fputc |
Typedefs | |
typedef struct nio_console | nio_console |
Functions | |
void | nio_grid_puts (const int offset_x, const int offset_y, const int x, const int y, const char *str, const char bgColor, const char textColor) |
void | nio_grid_putc (const int offset_x, const int offset_y, const int x, const int y, const char ch, const char bgColor, const char textColor) |
void | nio_load (const char *path, nio_console *c) |
void | nio_save (const char *path, const nio_console *c) |
void | nio_set_default (nio_console *c) |
void | nio_clear (nio_console *c) |
void | nio_scroll (nio_console *c) |
void | nio_csl_drawchar (nio_console *c, const int pos_x, const int pos_y) |
void | nio_csl_savechar (nio_console *c, const char ch, const int pos_x, const int pos_y) |
char | nio_getch (nio_console *c) |
void | nio_color (nio_console *c, const char background_color, const char foreground_color) |
void | nio_drawing_enabled (nio_console *c, const BOOL enable_drawing) |
void | nio_init (nio_console *c, const int size_x, const int size_y, const int offset_x, const int offset_y, const char background_color, const char foreground_color, const BOOL drawing_enabled) |
void | nio_free (nio_console *c) |
void | nio_use_stdio (void) |
void | nio_free_stdio (void) |
int | nio_fflush (nio_console *c) |
char | nio_fputc (char ch, nio_console *c) |
char | nio_putchar (const char ch) |
int | nio_fputs (const char *str, nio_console *c) |
int | nio_puts (const char *str) |
char | nio_fgetc (nio_console *c) |
char | nio_getchar (void) |
char * | nio_fgets (char *str, int num, nio_console *c) |
char * | nio_gets (char *str) |
int | nio_fprintf (nio_console *c, const char *format,...) |
int | nio_printf (const char *format,...) |
void | nio_perror (const char *str) |
int | reg_store (void *dataptr, size_t size, char *regpath) |
void * | reg_get (char *regpath) |
BOOL | uart_ready (void) |
char | uart_getchar (void) |
char * | uart_gets (char *str) |
char | uart_putchar (char character) |
int | uart_puts (const char *str) |
void | uart_printf (char *format,...) |
unsigned | nio_time_get () |
void | nio_cursor_draw (nio_console *c) |
void | nio_cursor_erase (nio_console *c) |
void | nio_cursor_blinking_draw (nio_console *c) |
void | nio_cursor_blinking_reset (nio_console *c) |
void | nio_cursor_enable (nio_console *c, BOOL enable_cursor) |
void | nio_cursor_blinking_enable (nio_console *c, BOOL enable_cursor_blink) |
void | nio_cursor_blinking_duration (nio_console *c, int duration) |
void | nio_cursor_type (nio_console *c, int cursor_type) |
void | nio_cursor_width (nio_console *c, int cursor_width) |
void | nio_cursor_custom (nio_console *c, unsigned char cursor_data[6]) |
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Nspire I/O 3.0 header file
void nio_clear | ( | nio_console * | c | ) |
Clears a console.
c | Console |
void nio_color | ( | nio_console * | c, |
const char | background_color, | ||
const char | foreground_color | ||
) |
Sets the background- and text color of a console. Possible values are 0-15.
c | Console |
background_color | Background color |
foreground_color | Text color |
void nio_csl_drawchar | ( | nio_console * | c, |
const int | pos_x, | ||
const int | pos_y | ||
) |
Draws a char from the console to the screen. For internal use.
c | Console |
pos_x | x position |
pos_y | y position |
void nio_csl_savechar | ( | nio_console * | c, |
const char | ch, | ||
const int | pos_x, | ||
const int | pos_y | ||
) |
Saves a char in a console without drawing it. For internal use.
c | Console |
ch | Char |
pos_x | x position |
pos_y | y position |
void nio_cursor_blinking_draw | ( | nio_console * | c | ) |
Draws a blinking cursor, if enabled. Blinking occurs on an interval set inside the console.
c | Console |
void nio_cursor_blinking_duration | ( | nio_console * | c, |
int | duration | ||
) |
Sets the console cursor blink duration (the time it takes to switch on or off)
c | Console |
duration | The time (in seconds) it takes to switch on or off. |
void nio_cursor_blinking_enable | ( | nio_console * | c, |
BOOL | enable_cursor_blink | ||
) |
Enables console cursor blinking.
c | Console |
enable_cursor_blink | When this is true, the cursor will blink, false: no cursor blinking will occur. |
void nio_cursor_blinking_reset | ( | nio_console * | c | ) |
Resets the blinking cursor timer.
c | Console |
void nio_cursor_custom | ( | nio_console * | c, |
unsigned char | cursor_data[6] | ||
) |
Sets the console cursor width.
c | Console |
cursor_data | The custom cursor data. This is in the form of a char[6] array. This pretty much uses the format (and the drawing code) for character drawing, so take a look at charmap.h for examples. Note that the characters in charmap.h are truncated, so they will display differently. |
By default, if this is not specified and the cursor type is set to the custom cursor type (3), the custom cursor will be set to {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} (a block cursor).
void nio_cursor_draw | ( | nio_console * | c | ) |
Draws the cursor of the console, if enabled.
c | Console |
void nio_cursor_enable | ( | nio_console * | c, |
BOOL | enable_cursor | ||
) |
Enables the console cursor.
c | Console |
enable_cursor | When this is true, a cursor will be drawn to the screen, false: no cursor shown. |
void nio_cursor_erase | ( | nio_console * | c | ) |
Erases the cursor of the console, if enabled.
c | Console |
void nio_cursor_type | ( | nio_console * | c, |
int | cursor_type | ||
) |
Sets the console cursor type.
c | Console |
cursor_type | The cursor type. 0 is a block cursor (default, like a Linux X11 terminal), 1 is an underscore cursor (like a Windows Command Prompt window), 2 is a vertical bar cursor (like a regular text box), and 3 is a custom cursor that is set via SetCursorCustom. |
If you specify an invalid value, NspireIO will silenty fail and set the cursor type to 0, a block cursor.
You may also use the predefined types as arguments. (NIO_CURSOR_*)
void nio_cursor_width | ( | nio_console * | c, |
int | cursor_width | ||
) |
Sets the console cursor width.
c | Console |
cursor_width | The cursor line width. This only applies to cursors 1 and 2 (underscore and vertical bar). All others cursor types will not be affected by this setting. |
For the underscore cursor, it must be greater than 0 and less than or equal to CHAR_HEIGHT (as defined by charmap.h). At the time of writing, CHAR_HEIGHT is 8. Therefore, for an underscore cursor, 0 < cursor_width <= 8.
For a vertical bar cursor, it must be greater than 0 and less than or equal to CHAR_WIDTH (as defined by charmap.h). At the time of writing, CHAR_WIDTH is 6. Therefore, for a vertical bar cursor, 0 < cursor_width < 6.
If you wish to draw a blank cursor, you probably should disable the cursor altogether with EnableCursor(nio_console, FALSE).
Note that if you specify an out-of-range value, NspireIO will silently fail and reset the cursor width to 1.
void nio_drawing_enabled | ( | nio_console * | c, |
const BOOL | enable_drawing | ||
) |
Changes the drawing behavior of a console.
c | Console |
enable_drawing | If this is true, a console will automatically be updated if text is written to it. |
int nio_fflush | ( | nio_console * | c | ) |
See fflush
char nio_fgetc | ( | nio_console * | c | ) |
See fgetc
char* nio_fgets | ( | char * | str, |
int | num, | ||
nio_console * | c | ||
) |
int nio_fprintf | ( | nio_console * | c, |
const char * | format, | ||
... | |||
) |
See fprintf
char nio_fputc | ( | char | ch, |
nio_console * | c | ||
) |
See fputc
int nio_fputs | ( | const char * | str, |
nio_console * | c | ||
) |
See fputs
void nio_free | ( | nio_console * | c | ) |
Uninitializes a console. This should always be called before the program ends.
c | Console |
void nio_free_stdio | ( | void | ) |
For use with NIO_REPLACE_STDIO. Use at the end of your program.
char nio_getch | ( | nio_console * | c | ) |
Immediately gets a char from the keyboard. For internal use.
c | Console |
char nio_getchar | ( | void | ) |
See getchar
char* nio_gets | ( | char * | str | ) |
See gets
void nio_grid_putc | ( | const int | offset_x, |
const int | offset_y, | ||
const int | x, | ||
const int | y, | ||
const char | ch, | ||
const char | bgColor, | ||
const char | textColor | ||
) |
Draws a char to the screen on the given position. For internal use.
offset_x | x offset in px |
offset_y | y offset in px |
x | x position in columns (px*6) |
y | y position in rows (px*8) |
c | Char |
bgColor | Background color |
textColor | text color |
void nio_grid_puts | ( | const int | offset_x, |
const int | offset_y, | ||
const int | x, | ||
const int | y, | ||
const char * | str, | ||
const char | bgColor, | ||
const char | textColor | ||
) |
Draws a string to the screen on the given position. For internal use.
offset_x | x offset in px |
offset_y | y offset in px |
x | x position in columns (px*6) |
y | y position in rows (px*8) |
str | String |
bgColor | Background color |
textColor | text color |
void nio_init | ( | nio_console * | c, |
const int | size_x, | ||
const int | size_y, | ||
const int | offset_x, | ||
const int | offset_y, | ||
const char | background_color, | ||
const char | foreground_color, | ||
const BOOL | drawing_enabled | ||
) |
Initializes a console.
c | Console |
size_x | console width |
size_y | console height |
offset_x | x position |
offset_y | y position |
background_color | Background color |
foreground_color | Text color |
drawing_enabled | See nio_enable_drawing() |
void nio_load | ( | const char * | path, |
nio_console * | c | ||
) |
Loads a console from a file on flash storage.
path | File path |
c | Console |
void nio_perror | ( | const char * | str | ) |
See perror
int nio_printf | ( | const char * | format, |
... | |||
) |
See printf
char nio_putchar | ( | const char | ch | ) |
See putchar
int nio_puts | ( | const char * | str | ) |
See puts
void nio_save | ( | const char * | path, |
const nio_console * | c | ||
) |
Saves a console to a file in flash storage.
path | File path |
c | Console |
void nio_scroll | ( | nio_console * | c | ) |
Scrolls a console one line down.
c | Console |
void nio_set_default | ( | nio_console * | c | ) |
Sets a default console that will be used for all functions without console argument, e.g. nio_puts()
c | Console |
|
inline |
Returns the current time.
void nio_use_stdio | ( | void | ) |
For use with NIO_REPLACE_STDIO. Use at the beginning of your program.
void* reg_get | ( | char * | regpath | ) |
Reads binary data from a file.
regpath | Path to file |
int reg_store | ( | void * | dataptr, |
size_t | size, | ||
char * | regpath | ||
) |
Stores binary data in a file.
dataptr | Pointer to the data to be stored |
size | Length in bytes |
regpath | Path to file |
char uart_getchar | ( | void | ) |
See getchar
char* uart_gets | ( | char * | str | ) |
See gets
void uart_printf | ( | char * | format, |
... | |||
) |
See printf
char uart_putchar | ( | char | character | ) |
See putchar
int uart_puts | ( | const char * | str | ) |
See puts
BOOL uart_ready | ( | void | ) |
Checks if there is data available at the serial port.