IBNOS
Macros | Enumerations | Functions
console.h File Reference
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <hardware/context.h>
Include dependency graph for console.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MAKE_COLOR(foreground, background)   (((foreground) & 15) | (background) << 4)
 
#define MAKE_RAW_CHAR(color, chr)   ((((uint32_t)(chr)) & 0xFF) | (((uint32_t)(color)) & 0xFF) << 8)
 
#define RAW_CHAR_COLOR(raw)   (((raw) >> 8) & 0xFF)
 
#define RAW_CHAR_CHR(raw)   ((raw) & 0xFF)
 
#define BG_COLOR(color)   ((color >> 4) & 15)
 
#define FG_COLOR(color)   (color & 15)
 
#define CONSOLE_WIDTH(size)   (size & 0xFFFF)
 
#define CONSOLE_HEIGHT(size)   ((size >> 16) & 0xFFFF)
 
#define CONSOLE_POSX(pos)   (pos & 0xFFFF)
 
#define CONSOLE_POSY(pos)   ((pos >> 16) & 0xFFFF)
 

Enumerations

enum  VGA_COLOR {
  COLOR_BLACK = 0, COLOR_BLUE = 1, COLOR_GREEN = 2, COLOR_CYAN = 3,
  COLOR_RED = 4, COLOR_MAGENTA = 5, COLOR_BROWN = 6, COLOR_LIGHT_GREY = 7,
  COLOR_DARK_GREY = 8, COLOR_LIGHT_BLUE = 9, COLOR_LIGHT_GREEN = 10, COLOR_LIGHT_CYAN = 11,
  COLOR_LIGHT_RED = 12, COLOR_LIGHT_MAGENTA = 13, COLOR_LIGHT_BROWN = 14, COLOR_WHITE = 15
}
 
enum  CONSOLE_FLAGS { CONFLAGS_ECHO = 1, CONFLAGS_HWCURSOR = 2, CONFLAGS_HWCURSOR_AUTO = 4, CONFLAGS_RAW_MODE = 8 }
 

Functions

void consoleInit ()
 Initializes the console. More...
 
void consoleClear ()
 Clear the screen contents. More...
 
void consoleSetColor (uint8_t color)
 Set the text and background color of the console. More...
 
uint8_t consoleGetColor ()
 Get current color. More...
 
uint8_t consoleGetColorForeground ()
 Get current foreground color. More...
 
uint8_t consoleGetColorBackground ()
 Get current background color. More...
 
void consolePutChar (char chr)
 Write a character on the console. More...
 
void consoleEchoChar (char chr)
 Echo keyboard input on the console. More...
 
void consolePutCharRaw (uint16_t chr)
 Write a raw character and color on the console. More...
 
void consoleWriteString (const char *str)
 Write a C string to the console. More...
 
void consoleWriteStringLen (const char *str, size_t len)
 Write a string with a fixed size to the console. More...
 
void consoleWriteRawLen (const uint16_t *data, size_t count)
 Write raw data with a fixed size to the console. More...
 
void consoleWriteStringMax (const char *str, size_t len)
 Write a nullterminated string or a maximum of len characters. More...
 
void consoleWriteHex32 (uint32_t value)
 Write a 32 bit integer as hex value on the console. More...
 
void consoleWriteInt32 (uint32_t value)
 Write a 32 bit integer as decimal value on the console. More...
 
void consoleWriteHex16 (uint16_t value)
 Write a 16 bit integer as hex value on the console. More...
 
bool consoleSetCursorPos (uint8_t x, uint8_t y)
 Set the position of the text cursor. More...
 
uint32_t consoleGetCursorPos ()
 Get packed position of the text cursor. More...
 
uint32_t consoleGetCursorPosX ()
 Get X position of the text cursor. More...
 
uint32_t consoleGetCursorPosY ()
 Get Y position of the text cursor. More...
 
void consoleScrollUp ()
 Scroll the console up one line. More...
 
uint32_t consoleGetSize ()
 Returns the packed size of the console. More...
 
uint8_t consoleGetHeight ()
 Returns the height (text rows) of the console. More...
 
uint8_t consoleGetWidth ()
 Returns the width (text cols) of the console. More...
 
void consoleShowHardwareCursor (bool changed)
 Show / hide blinking hardware cursor. More...
 
void consoleSetHardwareCursor (uint8_t x, uint8_t y)
 Set the position of the hardware cursor. More...
 
uint32_t consoleGetHardwareCursor ()
 Get packed position of the hardware cursor. More...
 
void consoleSetFont ()
 Load a custom font supporting latin1 characters. More...
 
void consoleSetFlags (uint32_t newFlags)
 Set console flags. More...
 
uint32_t consoleGetFlags ()
 Get console flags. More...
 
void consoleSystemFailure (const char **lines, uint32_t numArgs, uint32_t *args, struct taskContext *context)
 Print a system failure message and halts the system. More...