vgatext library  v0.90
Provides functions to simplify Propeller text display on a VGA monitor
vgatext.h
Go to the documentation of this file.
1 
29 #ifndef __VGATEXT_H
30 #define __VGATEXT_H
31 
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #endif
36 
37 #include "simpletext.h"
38 
39 /*
40  * This defines vgatext as a type alias to text_t
41  * Spelling is choice of Parallax education, not the author.
42  */
43 typedef text_t vgatext;
44 
48 #define VGA_TEXT_WHITE_BLUE 0
49 #define VGA_TEXT_YELLOW_BROWN 1
50 #define VGA_TEXT_MAGENTA_BLACK 2
51 #define VGA_TEXT_GREY_WHITE 3
52 #define VGA_TEXT_CYAN_DARKCYAN 4
53 #define VGA_TEXT_GREEN_WHITE 5
54 #define VGA_TEST_RED_PINK 6
55 #define VGA_TEXT_CYAN_BLUE 7
56 
57 #define VGA_TEXT_COLORS 8
58 
62 #define VGA_TEXT_PAL_WHITE_BLUE 0
63 #define VGA_TEXT_PAL_YELLOW_BROWN 2
64 #define VGA_TEXT_PAL_MAGENTA_BLACK 4
65 #define VGA_TEXT_PAL_GREY_WHITE 6
66 #define VGA_TEXT_PAL_CYAN_DARKCYAN 8
67 #define VGA_TEXT_PAL_GREEN_WHITE 10
68 #define VGA_TEST_PAL_RED_PINK 12
69 #define VGA_TEXT_PAL_CYAN_BLUE 14
70 
71 
76 #define VGA_TEXT_COLORTABLE_SIZE 8*2
77 
81 #define VGA_TEXT_COLS 30
82 
86 #define VGA_TEXT_ROWS 14
87 
91 #define VGA_TEXT_SCREENSIZE (VGA_TEXT_COLS * VGA_TEXT_ROWS)
92 
96 #define VGA_TEXT_LASTROW (VGA_TEXT_SCREENSIZE-VGA_TEXT_COLS)
97 
101 typedef enum {
102  VGA_TEXT_STAT_DISABLED,
103  VGA_TEXT_STAT_INVISIBLE,
104  VGA_TEXT_STAT_VISIBLE
105 } vgaTextStat_t;
106 
110 typedef struct _vga_text_struct
111 {
112  long status ; // 0/1/2 = off/visible/invisible read-only (21 longs)
113  long enable ; // 0/non-0 = off/on write-only
114  long pins ; // %pppttt = pins write-only
115  long mode ; // %tihv = tile,interlace,hpol,vpol write-only
116  long screen ; // pointer to screen (words) write-only
117  long colors ; // pointer to colors (longs) write-only
118  long ht ; // horizontal tiles write-only
119  long vt ; // vertical tiles write-only
120  long hx ; // horizontal tile expansion write-only
121  long vx ; // vertical tile expansion write-only
122  long ho ; // horizontal offset write-only
123  long vo ; // vertical offset write-only
124  long hd ; // horizontal display ticks write-only
125  long hf ; // horizontal front porch ticks write-only
126  long hs ; // horizontal sync ticks write-only
127  long hb ; // horizontal back porch ticks write-only
128  long vd ; // vertical display lines write-only
129  long vf ; // vertical front porch lines write-only
130  long vs ; // vertical sync lines write-only
131  long vb ; // vertical back porch lines write-only
132  long rate ; // tick rate (Hz) write-only
133  char *palette ; // color palette
134 } vgatextdev_t;
135 
136 /*
137  * Starts VGA on a cog
138  * @param basepin is first pin number (out of 8) connected to VGA
139  * param clockrate is the clockrate defined for the platform.
140  * @returns non-zero cogid on success
141  */
142 int vgatext_start(volatile vgatextdev_t* vga, int basepin);
143 
144 /*
145  * VGA_Text stop function stops VGA cog
146  * @param id is cog id returned from start function.
147  */
148 void vgatext_stop(int id);
149 
150 /*
151  * VGA_Text public API
152  */
153 
176 vgatext *vgatext_open(int basepin);
177 
184 void vgatext_close(vgatext *device);
185 
203 int vgatext_out(int c);
204 
211 int vgatext_putchar(vgatext *vga, int c);
212 
234 void vgatext_setColorPalette(char* palette);
235 
239 void vgatext_clear(void);
240 
244 void vgatext_home(void);
245 
246 
251 void vgatext_clearEOL(void);
252 
253 
261 void vgatext_setXY(int x, int y);
262 
268 void vgatext_setX(int x);
269 
275 void vgatext_setY(int y);
276 
284 void vgatext_setCoordPosition(int x, int y);
285 
291 int vgatext_getX(void);
292 
298 int vgatext_getY(void);
299 
306 void vgatext_setColors(int value);
307 
314 int vgatext_getColors(void);
315 
321 int vgatext_getColumns(void);
322 
327 int vgatext_getRows(void);
328 
329 #ifdef __cplusplus
330 }
331 #endif
332 
333 #endif
334 //__VGATEXT_H
335 
336