aboutsummaryrefslogtreecommitdiffstats
path: root/source/sharp.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/sharp.hpp')
-rw-r--r--source/sharp.hpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/source/sharp.hpp b/source/sharp.hpp
index 2775711..155acec 100644
--- a/source/sharp.hpp
+++ b/source/sharp.hpp
@@ -1,3 +1,23 @@
+/**
+ * @file sharp.hpp
+ * @brief Handles all drawing to the display.
+ *
+ * Copyright (C) 2019 Clyne Sullivan
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
#ifndef SHARP_HPP_
#define SHARP_HPP_
@@ -9,12 +29,18 @@
#define BLACK 0
#define WHITE 1
+constexpr int SHARP_WIDTH = 144;
+constexpr int SHARP_HEIGHT = 168;
+
class Sharp {
private:
static Adafruit_SharpMem display;
static TaskHandle_t taskHandle;
static std::vector<Widget *> widgets;
+
+ static int topY;
+
public:
static void begin(void);
@@ -23,6 +49,17 @@ public:
widgets.emplace_back(new T(args...));
}
+ inline static void setScroll(int scr = 0) {
+ static int oldTopY = 0;
+ if (scr == 0) {
+ oldTopY = topY;
+ } else {
+ topY = minof(0, oldTopY + scr);
+ }
+ }
+
+ static void sendInput(int ypos);
+
private:
static void updateTask(void *);
};