Skip to content

Commit 1aaca18

Browse files
committed
added rotation conversion/validation method
1 parent 11b1576 commit 1aaca18

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/controller/Display.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,25 @@
1010
namespace udd {
1111
#define swap(t, a, b) {t tmp=a; a=b; b=tmp;}
1212

13+
Rotation validateRotation(char* rotation) {
14+
15+
int r;
16+
if (sscanf(rotation, "%d", &r) != 1) {
17+
r = -1;
18+
}
19+
20+
switch (r) {
21+
case 0: return DEGREE_0;
22+
case 90: return DEGREE_90;
23+
case 180: return DEGREE_180;
24+
case 270: return DEGREE_270;
25+
26+
default:
27+
fprintf(stderr, "Invalid rotation specified\n");
28+
return DEGREE_INVALID;
29+
}
30+
}
31+
1332
std::recursive_mutex screenLock;
1433

1534
Display::Display() {

src/controller/Metadata.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace udd {
55

66
// screen stuff
77
enum DisplayType {
8-
UNKNOWN_DISPLAY, ST7789, ST7735
8+
UNKNOWN_DISPLAY, ST7789, ST7735, NeoPixel
99
};
1010

1111
enum InterfaceType {

0 commit comments

Comments
 (0)