discoverpixy
tft.h
Go to the documentation of this file.
1 /**************************************************************************************************************************************
2 * Project: discoverpixy
3 * Website: https://github.com/t-moe/discoverpixy
4 * Authors: Aaron Schmocker, Timo Lang
5 * Institution: BFH Bern University of Applied Sciences
6 * File: common/tft/tft.h
7 *
8 * Version History:
9 * Date Autor Email SHA Changes
10 * 2015-04-03 timolang@gmail.com 51089aa Refactored Project Structure for use with emulator
11 * 2015-04-03 timolang@gmail.com 1f2af9f Added more tft functions to common and emulator. Fixed eventloop.
12 * 2015-04-03 timolang@gmail.com 1aa9194 Fixed Drawing of rects in Emulator. Got frames from pixy to emulator. Slooooow.
13 * 2015-04-27 aaron@duckpond.ch aed90ef Drawcircle added (emulator)
14 * 2015-04-27 timolang@gmail.com e249fb2 Added font support
15 * 2015-04-30 timolang@gmail.com 76ea9d8 Added num up down support.
16 * 2015-05-04 aaron@duckpond.ch c224d40 Changed display init
17 * 2015-05-10 timolang@gmail.com 21edc56 Added doxyfile (doxygen) for the common folder. Started with doxygen comments for app and tft module.
18 * 2015-05-11 timolang@gmail.com a175a2f Added doxygen docu for touch module
19 * 2015-05-11 timolang@gmail.com 08d9fe0 More work on doxygen module structure
20 * 2015-05-12 timolang@gmail.com 1402598 Added doxygen stuff for button module and some minor changes to touch, screen_main and tft module.
21 * 2015-05-15 timolang@gmail.com 9a16865 Added doxgen comments to filesyste, checkbox, numupdown and screen module. And some minor changes to the other modules.
22 * 2015-05-15 timolang@gmail.com b08a897 Added tft method to draw a bmp from filesystem. Added another font to emulator.
23 *
24 **************************************************************************************************************************************/
25 
26 #ifndef TFT_H
27 #define TFT_H
28 
29 #include<stdbool.h>
30 #include<stdint.h>
31 
42 
43 
48 #define RGB(r,g,b) ((((r) & 0xF8) << 8) | (((g) & 0xFC) << 3) | (((b) & 0xF8) >> 3))
49 
50 #define RED RGB(255,0,0)
51 #define GREEN RGB(0,255,0)
52 #define BLUE RGB(0,0,255)
53 #define WHITE 0xF7BE
54 #define BLACK RGB(0,0,0)
55 
60 #define HEX(h) (RGB(((h)>>16),((h)>>8),(h)))
61 
66 #define TRANSPARENT ((uint16_t)0x80C2)
67 
73 bool tft_init();
74 
79 void tft_clear(uint16_t color);
80 
89 void tft_draw_line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);
90 
97 void tft_draw_pixel(uint16_t x, uint16_t y, uint16_t color);
98 
108 void tft_draw_rectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);
109 
118 void tft_fill_rectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);
119 
129 void tft_draw_bitmap_unscaled(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint16_t* dat);
130 
131 
140 bool tft_draw_bitmap_file_unscaled(uint16_t x, uint16_t y, const char* filename);
141 
142 
150 void tft_draw_circle(uint16_t x, uint16_t y, uint16_t r, uint16_t color);
151 
156 uint8_t tft_num_fonts();
157 
163 uint8_t tft_font_height(uint8_t fontnum);
164 
170 uint8_t tft_font_width(uint8_t fontnum);
171 
181 void tft_print_line(uint16_t x, uint16_t y, uint16_t color, uint16_t bgcolor, uint8_t font, const char* text);
182 
193 void tft_print_formatted(uint16_t x, uint16_t y, uint16_t color, uint16_t bgcolor, uint8_t font, const char* format, ...);
194 
197 #endif /* TFT_H */
uint8_t tft_font_height(uint8_t fontnum)
Definition: tft.c:87
uint8_t tft_font_width(uint8_t fontnum)
Definition: tft.c:92
void tft_draw_circle(uint16_t x, uint16_t y, uint16_t r, uint16_t color)
Definition: tft.c:77
void tft_draw_line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color)
Definition: tft.c:50
void tft_print_formatted(uint16_t x, uint16_t y, uint16_t color, uint16_t bgcolor, uint8_t font, const char *format,...)
Definition: tft.c:111
void tft_print_line(uint16_t x, uint16_t y, uint16_t color, uint16_t bgcolor, uint8_t font, const char *text)
Definition: tft.c:98
uint8_t tft_num_fonts()
Definition: tft.c:82
void tft_draw_bitmap_unscaled(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint16_t *dat)
Definition: tft.c:72
void tft_draw_pixel(uint16_t x, uint16_t y, uint16_t color)
Definition: tft.c:56
bool tft_draw_bitmap_file_unscaled(uint16_t x, uint16_t y, const char *filename)
Definition: tft.c:123
void tft_clear(uint16_t color)
Definition: tft.c:45
void tft_fill_rectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color)
Definition: tft.c:67
void tft_draw_rectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color)
Definition: tft.c:61
bool tft_init()
Definition: tft.c:39