OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 Gurjant Kalsi <me@gurjantkalsi.com> | 2 * Copyright (c) 2015 Gurjant Kalsi <me@gurjantkalsi.com> |
3 * | 3 * |
4 * Permission is hereby granted, free of charge, to any person obtaining | 4 * Permission is hereby granted, free of charge, to any person obtaining |
5 * a copy of this software and associated documentation files | 5 * a copy of this software and associated documentation files |
6 * (the "Software"), to deal in the Software without restriction, | 6 * (the "Software"), to deal in the Software without restriction, |
7 * including without limitation the rights to use, copy, modify, merge, | 7 * including without limitation the rights to use, copy, modify, merge, |
8 * publish, distribute, sublicense, and/or sell copies of the Software, | 8 * publish, distribute, sublicense, and/or sell copies of the Software, |
9 * and to permit persons to whom the Software is furnished to do so, | 9 * and to permit persons to whom the Software is furnished to do so, |
10 * subject to the following conditions: | 10 * subject to the following conditions: |
(...skipping 11 matching lines...) Expand all Loading... |
22 */ | 22 */ |
23 | 23 |
24 // 1.33 Inch 3-Bit RGB Sharp Color LCD | 24 // 1.33 Inch 3-Bit RGB Sharp Color LCD |
25 #include <target/display/LS013B7DH06.h> | 25 #include <target/display/LS013B7DH06.h> |
26 #include <string.h> | 26 #include <string.h> |
27 | 27 |
28 #define SET_BIT(BUF, BITNUM) ((BUF)[(BITNUM) >> 3] |= (0xff & (0x1 << ((BITNUM)
& 0x07)))) | 28 #define SET_BIT(BUF, BITNUM) ((BUF)[(BITNUM) >> 3] |= (0xff & (0x1 << ((BITNUM)
& 0x07)))) |
29 | 29 |
30 uint8_t lcd_get_line(uint8_t *framebuffer, uint8_t idx, uint8_t *result) | 30 uint8_t lcd_get_line(uint8_t *framebuffer, uint8_t idx, uint8_t *result) |
31 { | 31 { |
32 framebuffer += MLCD_WIDTH * idx; | 32 framebuffer += FB_STRIDE * idx; |
33 | 33 |
34 memset(result, 0, MLCD_BYTES_LINE); | 34 memset(result, 0, MLCD_BYTES_LINE); |
35 | 35 |
36 for (int i = 0; i < MLCD_WIDTH; ++i) { | 36 for (int i = 0; i < MLCD_WIDTH; ++i) { |
37 uint8_t inpix = framebuffer[i]; | 37 uint8_t inpix = framebuffer[i]; |
38 | 38 |
39 int j = i * 3; | 39 int j = i * 3; |
40 | 40 |
41 if (inpix & 0x80) { | 41 if (inpix & 0x80) { |
42 SET_BIT(result, j); | 42 SET_BIT(result, j); |
43 } | 43 } |
44 if (inpix & 0x10) { | 44 if (inpix & 0x10) { |
45 SET_BIT(result, j + 1); | 45 SET_BIT(result, j + 1); |
46 } | 46 } |
47 if (inpix & 0x02) { | 47 if (inpix & 0x02) { |
48 SET_BIT(result, j + 2); | 48 SET_BIT(result, j + 2); |
49 } | 49 } |
50 | 50 |
51 } | 51 } |
52 return MLCD_BYTES_LINE; | 52 return MLCD_BYTES_LINE; |
53 } | 53 } |
OLD | NEW |