Skip to content

Commit dd8ff8f

Browse files
committed
add section about colors to the documentation
1 parent 0a85848 commit dd8ff8f

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

src/epd_driver/include/epd_driver.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ void epd_copy_to_framebuffer(EpdRect image_area, const uint8_t *image_data,
252252
*
253253
* @param x: Horizontal position in pixels.
254254
* @param y: Vertical position in pixels.
255-
* @param color: The gray value of the line (0-255);
255+
* @param color: The gray value of the line (see [Colors](#Colors));
256256
* @param framebuffer: The framebuffer to draw to,
257257
*/
258258
void epd_draw_pixel(int x, int y, uint8_t color, uint8_t *framebuffer);
@@ -263,7 +263,7 @@ void epd_draw_pixel(int x, int y, uint8_t color, uint8_t *framebuffer);
263263
* @param x: Horizontal start position in pixels.
264264
* @param y: Vertical start position in pixels.
265265
* @param length: Length of the line in pixels.
266-
* @param color: The gray value of the line (0-255);
266+
* @param color: The gray value of the line (see [Colors](#Colors));
267267
* @param framebuffer: The framebuffer to draw to,
268268
* which must be `EPD_WIDTH / 2 * EPD_HEIGHT` bytes large.
269269
*/
@@ -276,7 +276,7 @@ void epd_draw_hline(int x, int y, int length, uint8_t color,
276276
* @param x: Horizontal start position in pixels.
277277
* @param y: Vertical start position in pixels.
278278
* @param length: Length of the line in pixels.
279-
* @param color: The gray value of the line (0-255);
279+
* @param color: The gray value of the line (see [Colors](#Colors));
280280
* @param framebuffer: The framebuffer to draw to,
281281
* which must be `EPD_WIDTH / 2 * EPD_HEIGHT` bytes large.
282282
*/
@@ -292,7 +292,7 @@ void epd_fill_circle_helper(int x0, int y0, int r, int corners, int delta,
292292
* @param x: Center-point x coordinate
293293
* @param y: Center-point y coordinate
294294
* @param r: Radius of the circle in pixels
295-
* @param color: The gray value of the line (0-255);
295+
* @param color: The gray value of the line (see [Colors](#Colors));
296296
* @param framebuffer: The framebuffer to draw to,
297297
*/
298298
void epd_draw_circle(int x, int y, int r, uint8_t color, uint8_t *framebuffer);
@@ -303,7 +303,7 @@ void epd_draw_circle(int x, int y, int r, uint8_t color, uint8_t *framebuffer);
303303
* @param x: Center-point x coordinate
304304
* @param y: Center-point y coordinate
305305
* @param r: Radius of the circle in pixels
306-
* @param color: The gray value of the line (0-255);
306+
* @param color: The gray value of the line (see [Colors](#Colors));
307307
* @param framebuffer: The framebuffer to draw to,
308308
*/
309309
void epd_fill_circle(int x, int y, int r, uint8_t color, uint8_t *framebuffer);
@@ -312,7 +312,7 @@ void epd_fill_circle(int x, int y, int r, uint8_t color, uint8_t *framebuffer);
312312
* Draw a rectanle with no fill color
313313
*
314314
* @param rect: The rectangle to draw.
315-
* @param color: The gray value of the line (0-255);
315+
* @param color: The gray value of the line (see [Colors](#Colors));
316316
* @param framebuffer: The framebuffer to draw to,
317317
*/
318318
void epd_draw_rect(EpdRect rect, uint8_t color, uint8_t *framebuffer);
@@ -321,7 +321,7 @@ void epd_draw_rect(EpdRect rect, uint8_t color, uint8_t *framebuffer);
321321
* Draw a rectanle with fill color
322322
*
323323
* @param rect: The rectangle to fill.
324-
* @param color: The gray value of the line (0-255);
324+
* @param color: The gray value of the line (see [Colors](#Colors));
325325
* @param framebuffer: The framebuffer to draw to,
326326
*/
327327
void epd_fill_rect(EpdRect rect, uint8_t color, uint8_t *framebuffer);
@@ -333,7 +333,7 @@ void epd_fill_rect(EpdRect rect, uint8_t color, uint8_t *framebuffer);
333333
* @param y0 Start point y coordinate
334334
* @param x1 End point x coordinate
335335
* @param y1 End point y coordinate
336-
* @param color: The gray value of the line (0-255);
336+
* @param color: The gray value of the line (see [Colors](#Colors));
337337
* @param framebuffer: The framebuffer to draw to,
338338
*/
339339
void epd_draw_line(int x0, int y0, int x1, int y1, uint8_t color,
@@ -348,7 +348,7 @@ void epd_draw_line(int x0, int y0, int x1, int y1, uint8_t color,
348348
* @param y1 Vertex #1 y coordinate
349349
* @param x2 Vertex #2 x coordinate
350350
* @param y2 Vertex #2 y coordinate
351-
* @param color: The gray value of the line (0-255);
351+
* @param color: The gray value of the line (see [Colors](#Colors));
352352
* @param framebuffer: The framebuffer to draw to,
353353
*/
354354
void epd_draw_triangle(int x0, int y0, int x1, int y1, int x2, int y2,
@@ -363,7 +363,7 @@ void epd_draw_triangle(int x0, int y0, int x1, int y1, int x2, int y2,
363363
* @param y1 Vertex #1 y coordinate
364364
* @param x2 Vertex #2 x coordinate
365365
* @param y2 Vertex #2 y coordinate
366-
* @param color: The gray value of the line (0-255);
366+
* @param color: The gray value of the line (see [Colors](#Colors));
367367
* @param framebuffer: The framebuffer to draw to,
368368
*/
369369
void epd_fill_triangle(int x0, int y0, int x1, int y1, int x2, int y2,

src/epd_driver/include/epd_highlevel.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@
4444
* That's it! For many application, this will be enough.
4545
* For special applications and requirements, have a
4646
* closer look at the `epd_driver.h` header.
47+
*
48+
* Colors
49+
* ======
50+
*
51+
* Since most displays only support 16 colors, we're only using the upper 4 bits (nibble) of a byte to detect the color.
52+
*
53+
* char pixel_color = color & 0xF0;
54+
*
55+
* So keep in mind, when passing a color to any function, to always set the upper 4 bits, otherwise the color would be black.
56+
*
57+
* Possible colors are `0xF0` (white) through `0x80` (median gray) til `0x00` (black).
4758
*/
4859

4960

0 commit comments

Comments
 (0)