Skip to content

Commit 295dbc3

Browse files
TomSawsalkinium
authored andcommitted
[ui] Specialize displays for monochrome and color
1 parent 4c80ba1 commit 295dbc3

File tree

75 files changed

+1407
-1298
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1407
-1298
lines changed

examples/avr/display/dogm128/benchmark/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ main()
161161
while (!timer.execute())
162162
{
163163
// rectangle in left side of screen
164-
display.setColor(Color::black());
164+
// TODO display.setColor(Color::black());
165165
display.drawRectangle(Point(0, 0), 62, 62);
166166

167167
// rounded rectangle around text area
@@ -176,14 +176,14 @@ main()
176176
display.drawCircle(Point(31, 31), 31);
177177

178178
// clear previous spinner position
179-
display.setColor(Color::white());
179+
// TODO display.setColor(Color::white());
180180
display.fillRectangle(Point(87, 40), 16, 16);
181181

182182
static uint8_t loops = 0;
183-
display.setColor(Color::black());
183+
// TODO display.setColor(Color::black());
184184
drawSpinner(Point(95, 48), loops++);
185185

186-
display.setColor(Color::white());
186+
// TODO display.setColor(Color::white());
187187
display.setCursor(Point(25, 40));
188188
display << ++iter;
189189
display.update();
@@ -192,7 +192,7 @@ main()
192192
// print number of iterations in one second
193193
display.clear();
194194
display.setCursor(Point(80, 10));
195-
display.setColor(Color::white());
195+
// TODO display.setColor(Color::white());
196196
display << "FPS=" << iter;
197197
}
198198
}

examples/avr/display/dogm128/draw/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ main()
7171

7272
display.fillRectangle(Point(10, 10), 20, 20);
7373
display.fillCircle(Point(45, 40), 23);
74-
display.setColor(Color::white());
74+
// TODO display.setColor(Color::white());
7575
display.fillRectangle(Point(20, 20), 20, 20);
7676
display.fillCircle(Point(55, 50), 8);
7777

78-
display.setColor(Color::black());
78+
// TODO display.setColor(Color::black());
7979
display.drawLine(Point(0, 0), Point(127, 63));
8080

8181
display.update();

examples/avr/display/dogm128/touch/main.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ modm::DogM128< lcd::SPI, lcd::Cs, lcd::A0, lcd::Reset, true > display;
5353
void
5454
drawCross(uint8_t x, uint8_t y)
5555
{
56-
display.drawPixel(x - 1, y - 1);
57-
display.drawPixel(x - 1, y + 1);
58-
display.drawPixel(x, y);
59-
display.drawPixel(x + 1, y - 1);
60-
display.drawPixel(x + 1, y + 1);
56+
display.setPixel(x - 1, y - 1);
57+
display.setPixel(x - 1, y + 1);
58+
display.setPixel(x, y);
59+
display.setPixel(x + 1, y - 1);
60+
display.setPixel(x + 1, y + 1);
6161
}
6262

6363
int
@@ -152,11 +152,11 @@ main()
152152

153153
if (x >= 0 && y >= 0)
154154
{
155-
display.drawPixel(x, y);
156-
display.drawPixel(x, y+1);
155+
display.setPixel(x, y);
156+
display.setPixel(x, y+1);
157157

158-
display.drawPixel(x+1, y);
159-
display.drawPixel(x+1, y+1);
158+
display.setPixel(x+1, y);
159+
display.setPixel(x+1, y+1);
160160
}
161161

162162
display.update();

examples/stm32_f4ve/gui/main.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ initDisplay()
140140

141141
tft.initialize();
142142
tft.enableBacklight(true);
143-
tft.setRotation(Display::Rotation::Rotate90);
143+
tft.setOrientation(modm::glcd::Orientation::Portrait90);
144144
}
145145

146146

@@ -164,7 +164,7 @@ initTouchscreen()
164164
// ----------------------------------------------------------------------------
165165
/* screen calibration */
166166
static void
167-
drawCross(modm::GraphicDisplay& display, modm::glcd::Point center)
167+
drawCross(modm::ColorGraphicDisplay& display, modm::glcd::Point center)
168168
{
169169
display.setColor(modm::glcd::Color::red());
170170
display.drawLine(center.x - 15, center.y, center.x - 2, center.y);
@@ -187,7 +187,7 @@ drawCross(modm::GraphicDisplay& display, modm::glcd::Point center)
187187
}
188188

189189
static void
190-
calibrateTouchscreen(modm::GraphicDisplay& display, modm::glcd::Point *fixed_samples = NULL)
190+
calibrateTouchscreen(modm::ColorGraphicDisplay& display, modm::glcd::Point *fixed_samples = nullptr)
191191
{
192192
MODM_LOG_DEBUG << __PRETTY_FUNCTION__ << modm::endl;
193193
modm::glcd::Point calibrationPoint[3] = { { 45, 45 }, { 270, 90 }, { 100, 190 } };
@@ -229,10 +229,10 @@ drawPoint(modm::GraphicDisplay& display, modm::glcd::Point point)
229229
return;
230230
}
231231

232-
display.drawPixel(point.x, point.y);
233-
display.drawPixel(point.x + 1, point.y);
234-
display.drawPixel(point.x, point.y + 1);
235-
display.drawPixel(point.x + 1, point.y + 1);
232+
display.setPixel(point.x, point.y);
233+
display.setPixel(point.x + 1, point.y);
234+
display.setPixel(point.x, point.y + 1);
235+
display.setPixel(point.x + 1, point.y + 1);
236236
}
237237

238238
// ----------------------------------------------------------------------------

examples/stm32f469_discovery/display/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ main()
2020
Board::initialize();
2121
Board::initializeDisplay();
2222

23-
modm::GraphicDisplay& display = Board::getDisplay();
23+
modm::ColorGraphicDisplay& display = Board::getDisplay();
2424
display.setFont(modm::font::Assertion);
2525

2626
display.drawRectangle(0,0, 10, 10);

examples/stm32f469_discovery/game_of_life/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ static inline void touch(framebuffer_t buffer)
135135
}
136136
}
137137

138-
static inline void drawPixel(int x, int y, uint8_t color)
138+
static inline void setPixel(int x, int y, uint8_t color)
139139
{
140140
#define DRAW(x, y) displayBuffer[(y) * 800 + (x)] = GET_TRAIL_COLOR(color).getValue();
141141
#if SCALE >= 8
@@ -202,7 +202,7 @@ static inline void drawPixel(int x, int y, uint8_t color)
202202
static inline void drawScreen(framebuffer_t before, framebuffer_t next)
203203
{
204204
for_yx(bw, bh) {
205-
drawPixel(x*SCALE + SCALE/2, y*SCALE + SCALE/2, next[y][x]);
205+
setPixel(x*SCALE + SCALE/2, y*SCALE + SCALE/2, next[y][x]);
206206

207207
before[y][x] = next[y][x];
208208
}

examples/stm32f469_discovery/touchscreen/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class LineDrawer : public modm::pt::Protothread
8484
private:
8585
Touch::Data touchData;
8686
Touch touch;
87-
modm::GraphicDisplay& display;
87+
modm::ColorGraphicDisplay& display;
8888
int16_t px[2], py[2];
8989
Color c[2];
9090
};

examples/stm32f4_discovery/open407v-d/gui/main.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ initTouchscreen()
173173
// ----------------------------------------------------------------------------
174174
/* screen calibration */
175175
static void
176-
drawCross(modm::GraphicDisplay& display, modm::glcd::Point center)
176+
drawCross(modm::ColorGraphicDisplay& display, modm::glcd::Point center)
177177
{
178178
display.setColor(modm::glcd::Color::red());
179179
display.drawLine(center.x - 15, center.y, center.x - 2, center.y);
@@ -196,7 +196,7 @@ drawCross(modm::GraphicDisplay& display, modm::glcd::Point center)
196196
}
197197

198198
static void
199-
calibrateTouchscreen(modm::GraphicDisplay& display, modm::glcd::Point *fixed_samples = NULL)
199+
calibrateTouchscreen(modm::ColorGraphicDisplay& display, modm::glcd::Point *fixed_samples = NULL)
200200
{
201201
modm::glcd::Point calibrationPoint[3] = { { 45, 45 }, { 270, 90 }, { 100, 190 } };
202202
modm::glcd::Point sample[3];
@@ -236,10 +236,10 @@ drawPoint(modm::GraphicDisplay& display, modm::glcd::Point point)
236236
return;
237237
}
238238

239-
display.drawPixel(point.x, point.y);
240-
display.drawPixel(point.x + 1, point.y);
241-
display.drawPixel(point.x, point.y + 1);
242-
display.drawPixel(point.x + 1, point.y + 1);
239+
display.setPixel(point.x, point.y);
240+
display.setPixel(point.x + 1, point.y);
241+
display.setPixel(point.x, point.y + 1);
242+
display.setPixel(point.x + 1, point.y + 1);
243243
}
244244

245245
// ----------------------------------------------------------------------------

examples/stm32f4_discovery/open407v-d/touchscreen/main.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ initTouchscreen()
130130

131131
// ----------------------------------------------------------------------------
132132
static void
133-
drawCross(modm::GraphicDisplay& display, modm::glcd::Point center)
133+
drawCross(modm::ColorGraphicDisplay& display, modm::glcd::Point center)
134134
{
135135
display.setColor(modm::glcd::Color::red());
136136
display.drawLine(center.x - 15, center.y, center.x - 2, center.y);
@@ -153,7 +153,7 @@ drawCross(modm::GraphicDisplay& display, modm::glcd::Point center)
153153
}
154154

155155
static void
156-
calibrateTouchscreen(modm::GraphicDisplay& display)
156+
calibrateTouchscreen(modm::ColorGraphicDisplay& display)
157157
{
158158
modm::glcd::Point calibrationPoint[3] = { { 45, 45 }, { 270, 90 }, { 100, 190 } };
159159
modm::glcd::Point sample[3];
@@ -186,10 +186,10 @@ drawPoint(modm::GraphicDisplay& display, modm::glcd::Point point)
186186
return;
187187
}
188188

189-
display.drawPixel(point.x, point.y);
190-
display.drawPixel(point.x + 1, point.y);
191-
display.drawPixel(point.x, point.y + 1);
192-
display.drawPixel(point.x + 1, point.y + 1);
189+
display.setPixel(point.x, point.y);
190+
display.setPixel(point.x + 1, point.y);
191+
display.setPixel(point.x, point.y + 1);
192+
display.setPixel(point.x + 1, point.y + 1);
193193
}
194194

195195
// ----------------------------------------------------------------------------

src/modm/board/disco_f469ni/board.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#include <modm/platform.hpp>
1818
#include <modm/architecture/interface/clock.hpp>
19-
#include <modm/ui/display/graphic_display.hpp>
19+
#include <modm/ui/display/color_graphic_display.hpp>
2020
#include <modm/driver/touch/ft6x06.hpp>
2121
#include <modm/debug/logger.hpp>
2222

@@ -209,7 +209,7 @@ setDisplayBuffer(void * buffer);
209209
void *
210210
getDisplayBuffer();
211211

212-
modm::GraphicDisplay&
212+
modm::ColorGraphicDisplay&
213213
getDisplay();
214214

215215
inline void

0 commit comments

Comments
 (0)