Hanna
Sourcecode Batteriemanagementsystem
gfx_ili9341.c
gehe zur Dokumentation dieser Datei
1 
51 /*
52  * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
53  */
54 
55 #include <gfx_ili9341.h>
56 #include "gfx.h"
57 #include "ili9341.h"
58 #include "ili9341_regs.h"
59 
63 
64 void gfx_ili9341_set_orientation ( uint8_t flags )
65 {
66  ili9341_set_orientation ( flags );
67 
68  /* Switch width and height if XY is switched. */
69  if ( (flags & GFX_SWITCH_XY) != 0x00 )
70  {
73  }
74  else
75  {
78  }
79 
80 #ifdef CONF_GFX_USE_CLIPPING
81  /* Reset clipping region. */
82  gfx_set_clipping ( 0, 0, gfx_width - 1, gfx_height - 1 );
83 #endif
84 }
85 
86 gfx_color_t gfx_ili9341_color ( uint8_t r, uint8_t g, uint8_t b )
87 {
88  return GFX_COLOR( r, g, b );
89 }
90 
92 {
94 
95 #ifdef CONF_GFX_USE_CLIPPING
96  if ( (x < gfx_min_x) || (x > gfx_max_x) || (y < gfx_min_y) || (y > gfx_max_y) )
97  {
98  return GFX_COLOR_INVALID;
99  }
100 #endif
101 
102  /* Set up draw area and read the three bytes of pixel data. */
103  gfx_set_limits( x, y, x, y );
104  color = ili9341_read_gram ();
105 
106  return color;
107 }
108 
110 {
111 #ifdef CONF_GFX_USE_CLIPPING
112  if ( (x < gfx_min_x) || (x > gfx_max_x) || (y < gfx_min_y) || (y > gfx_max_y) )
113  {
114  return;
115  }
116 #endif
117 
118  /* Set up draw area and write the two bytes of pixel data. */
119  gfx_set_limits( x, y, x, y );
120  ili9341_write_gram ( color );
121 }
122 
124 {
125 #ifdef CONF_GFX_USE_CLIPPING
126  if ( (x < gfx_min_x) || (x > gfx_max_x) || (y < gfx_min_y) || (y > gfx_max_y) )
127  {
128  return;
129  }
130 #endif
131 
132  /* Set up top left corner of area and write the two bytes of */
133  /* pixel data. Bottom left corner is already set to max_x/y. */
134  gfx_set_top_left_limit( x, y );
135  ili9341_write_gram ( color );
136 }
137 
138 void gfx_ili9341_init ( void )
139 {
140  /* Initialise globals */
143 
144  ili9341_init ();
145 // ili9341_backlight_on();
146 
147  /* Set clipping area to whole screen initially */
148  gfx_set_clipping ( 0, 0, gfx_width, gfx_height );
149 
151  gfx_draw_filled_rect( 0, 0, gfx_width, gfx_height, GFX_COLOR_BLACK );
152 }
153 
gfx_coord_t gfx_min_y
Definition: gfx_ili9341.c:61
void ili9341_write_gram(ili9341_color_t color)
Write the graphical memory with a single color pixel.
Definition: ili9341.c:335
#define GFX_FLIP_X
Definition: gfx.h:179
#define gfx_set_top_left_limit(x, y)
Definition: gfx_ili9341.h:270
gfx_coord_t gfx_max_x
Definition: gfx_ili9341.c:62
#define GFX_COLOR_INVALID
Value returned by gfx_get_pixel() for pixels outside clipping region.
Definition: gfx_ili9341.h:66
void gfx_ili9341_set_orientation(uint8_t flags)
Set display orientation.
Definition: gfx_ili9341.c:64
void ili9341_set_orientation(uint8_t flags)
Sets the orientation of the display data.
Definition: ili9341.c:707
void ili9341_init(void)
Initialise the controller.
Definition: ili9341.c:683
gfx_color_t color
Definition: gfx_generic.h:94
#define ILI9341_DEFAULT_HEIGHT
Definition: ili9341.h:164
Graphic library configured for the SDT028ATFT LCD panel using the ILI9341 display controller...
#define ILI9341_SWITCH_XY_WIDTH
Definition: ili9341.h:173
IL9341 Display Controller Register und Bitfield Definitionen aus dem ASF 3.26.0.
gfx_coord_t gfx_max_y
Definition: gfx_ili9341.c:62
#define GFX_SWITCH_XY
Definition: gfx.h:185
#define ILI9341_DEFAULT_WIDTH
Definition: ili9341.h:167
ili9341_coord_t gfx_coord_t
Data type representing a coordinate on the screen.
Definition: gfx_ili9341.h:58
gfx_coord_t gfx_min_x
Definition: gfx_ili9341.c:61
gfx_coord_t gfx_height
Definition: gfx_ili9341.c:60
Graphical library API header file.
#define GFX_COLOR(r, g, b)
Generate a display-native color value from constant RGB components.
Definition: gfx_ili9341.h:60
void gfx_ili9341_draw_line_pixel(gfx_coord_t x, gfx_coord_t y, gfx_color_t color)
Draw a single pixel on the screen.
Definition: gfx_ili9341.c:123
gfx_color_t gfx_ili9341_color(uint8_t r, uint8_t g, uint8_t b)
Generate native color value from R/G/B values.
Definition: gfx_ili9341.c:86
void gfx_ili9341_draw_pixel(gfx_coord_t x, gfx_coord_t y, gfx_color_t color)
Draw a single pixel on the screen.
Definition: gfx_ili9341.c:109
gfx_coord_t gfx_width
Definition: gfx_ili9341.c:60
ILI9341 Display Controller Component Driver aus dem ASF 3.26.0.
#define gfx_draw_filled_rect(x, y, width, height, color)
Definition: gfx_ili9341.h:178
ili9341_color_t ili9341_read_gram(void)
Read a single color from the graphical memory.
Definition: ili9341.c:303
#define gfx_set_limits(x1, y1, x2, y2)
Definition: gfx_ili9341.h:282
void gfx_ili9341_init(void)
Initialize the ili9341 display controller.
Definition: gfx_ili9341.c:138
#define ILI9341_SWITCH_XY_HEIGHT
Definition: ili9341.h:170
ili9341_color_t gfx_color_t
Data type for color values native to the display.
Definition: gfx_ili9341.h:57
gfx_color_t gfx_ili9341_get_pixel(gfx_coord_t x, gfx_coord_t y)
Get the color of a pixel on the display.
Definition: gfx_ili9341.c:91
#define gfx_set_orientation(flags)
Definition: gfx_ili9341.h:315