diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/clock.h | 1 | ||||
-rw-r--r-- | include/display.h | 41 | ||||
-rw-r--r-- | include/display_draw.h | 49 | ||||
l--------- | include/it | 2 | ||||
-rw-r--r-- | include/script.h | 2 |
5 files changed, 90 insertions, 5 deletions
diff --git a/include/clock.h b/include/clock.h index 77ab7e9..c12c41e 100644 --- a/include/clock.h +++ b/include/clock.h @@ -10,7 +10,6 @@ /** * Sets HCLK (system clock) to 80MHz, the maximum. - * @param none */ extern void clock_init(void); diff --git a/include/display.h b/include/display.h index 6004f19..55f6974 100644 --- a/include/display.h +++ b/include/display.h @@ -1,18 +1,55 @@ +/* + * @file display.h + * Display library for ILI9481 display. + */ + #ifndef DISPLAY_H_ #define DISPLAY_H_ #include <stdint.h> +/** + * The screen's width, in pixels. + */ #define LCD_WIDTH 480 -#define LCD_HEIGHT 320 -#define COLOR_MAX 31 +/** + * The screen's height, in pixels. + */ +#define LCD_HEIGHT 320 +/** + * Returns the color integer for the given RGB values. + * Converts 8RGB to 5-6-5. + * @param r red value, 0-255 + * @param g green value, 0-255 + * @param b blue value, 0-255 + * @return the 5-6-5 color value + */ uint16_t dsp_color(uint8_t r, uint8_t g, uint8_t b); +/** + * Sets the direction of IO, for reading or writing to the screen. + * @param mode INPUT or OUPUT (defined in gpio.h) + */ void dsp_dmode(int mode); + +/** + * Writes the command byte to the display. + * @param data the command to write + */ void dsp_write_cmd(uint8_t data); + +/** + * Writes the data byte to the display. + * @param data the data to write + */ void dsp_write_data(uint8_t data); + +/** + * Reads a byte of data from the display. + * @return the data byte + */ uint8_t dsp_read_data(void); void dsp_set_addr(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); diff --git a/include/display_draw.h b/include/display_draw.h index 823c697..9d86437 100644 --- a/include/display_draw.h +++ b/include/display_draw.h @@ -1,16 +1,65 @@ +/** + * @file display_draw.h + * Provides functions for drawing to the display + */ + #ifndef DISPLAY_DRAW_H_ #define DISPLAY_DRAW_H_ #include <stdint.h> +/** + * Starts the task for a blinking text cursor. + */ void dsp_cursoron(void); +/** + * Sets the chosen pixel to the given color. + * @param x x-coord of the pixel + * @param y y-coord of the pixel + * @param color the color to use (5-6-5) + */ void dsp_pixel(int x, int y, uint16_t color); + +/** + * Draws a line between the two coordinates. + * @param x start x-coord + * @param y start y-coord + * @param i end x-coord + * @param j end y-coord + * @param color the color to use (5-6-5) + */ void dsp_line(int x, int y, int i, int j, uint16_t color); + +/** + * Draws a rectangle with the given dimensions. + * @param x top left x-coord + * @param y top left y-coord + * @param w width of the rectangle + * @param h height of the rectangle + * @param color the color to use (5-6-5) + */ void dsp_rect(int x, int y, int w, int h, uint16_t color); +/** + * Sets the text cursor's position, in characters NOT pixels. + * @param x text column to move to + * @param y text row to move to + */ void dsp_cpos(int x, int y); + +/** + * Sets the pixel offset of the text cursor. + * @param x x-pixel offset from (0, 0) + * @param y y-pixel offset from (0, 0) + */ void dsp_coff(int x, int y); + +/** + * Puts a string to the screen. Text position if kept track of internally, so + * multiple calls will print the strings in one line. + * @param s the string to print + */ void dsp_puts(const char *s); #endif // DISPLAY_DRAW_H_ @@ -1 +1 @@ -../../interpreter
\ No newline at end of file +../../interpreter3
\ No newline at end of file diff --git a/include/script.h b/include/script.h index 7901c9c..ab5fa7e 100644 --- a/include/script.h +++ b/include/script.h @@ -12,6 +12,6 @@ * Loads the library for the given interpreter. * @param it the interpreter to use */ -void script_loadlib(interpreter *it); +void script_loadlib(instance *it); #endif // SCRIPT_H_ |