| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_SSD1306}""/> | <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_SSD1306}""/> | ||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_GFX_Library}""/> | <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_GFX_Library}""/> | ||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_BusIO}""/> | <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_BusIO}""/> | ||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/U8g2_for_Adafruit_GFX/src}""/> | |||||
| </option> | </option> | ||||
| <inputType id="io.sloeber.compiler.cpp.sketch.input.1777418047" name="CPP source files" superClass="io.sloeber.compiler.cpp.sketch.input"/> | <inputType id="io.sloeber.compiler.cpp.sketch.input.1777418047" name="CPP source files" superClass="io.sloeber.compiler.cpp.sketch.input"/> | ||||
| </tool> | </tool> | ||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_SSD1306}""/> | <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_SSD1306}""/> | ||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_GFX_Library}""/> | <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_GFX_Library}""/> | ||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_BusIO}""/> | <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_BusIO}""/> | ||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/U8g2_for_Adafruit_GFX/src}""/> | |||||
| </option> | </option> | ||||
| <inputType id="io.sloeber.compiler.c.sketch.input.1282698896" name="C Source Files" superClass="io.sloeber.compiler.c.sketch.input"/> | <inputType id="io.sloeber.compiler.c.sketch.input.1282698896" name="C Source Files" superClass="io.sloeber.compiler.c.sketch.input"/> | ||||
| </tool> | </tool> | ||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_SSD1306}""/> | <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_SSD1306}""/> | ||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_GFX_Library}""/> | <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_GFX_Library}""/> | ||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_BusIO}""/> | <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_BusIO}""/> | ||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/U8g2_for_Adafruit_GFX/src}""/> | |||||
| </option> | </option> | ||||
| <inputType id="io.sloeber.compiler.S.sketch.input.1238595277" name="Assembly source files" superClass="io.sloeber.compiler.S.sketch.input"/> | <inputType id="io.sloeber.compiler.S.sketch.input.1238595277" name="Assembly source files" superClass="io.sloeber.compiler.S.sketch.input"/> | ||||
| </tool> | </tool> |
| <type>2</type> | <type>2</type> | ||||
| <locationURI>ECLIPSE_HOME/arduinoPlugin/libraries/Simple_Repository_IO/1.0.3</locationURI> | <locationURI>ECLIPSE_HOME/arduinoPlugin/libraries/Simple_Repository_IO/1.0.3</locationURI> | ||||
| </link> | </link> | ||||
| <link> | |||||
| <name>libraries/U8g2_for_Adafruit_GFX</name> | |||||
| <type>2</type> | |||||
| <locationURI>ECLIPSE_HOME/arduinoPlugin/libraries/U8g2_for_Adafruit_GFX/1.8.0</locationURI> | |||||
| </link> | |||||
| <link> | <link> | ||||
| <name>libraries/Wire</name> | <name>libraries/Wire</name> | ||||
| <type>2</type> | <type>2</type> |
| eclipse.preferences.version=1 | |||||
| encoding/<project>=UTF-8 |
| #include "Display.h" | #include "Display.h" | ||||
| /***************** | /***************** | ||||
| ** Constructors. | ** Constructors. | ||||
| ****************/ | ****************/ | ||||
| Display::Display() { | Display::Display() { | ||||
| ssd1306 = Adafruit_SSD1306(SCREEN_WIDTH, SCREEN_HEIGHT); | ssd1306 = Adafruit_SSD1306(SCREEN_WIDTH, SCREEN_HEIGHT); | ||||
| u8g2_gfx.begin(ssd1306); | |||||
| } | } | ||||
| /****************** | /****************** | ||||
| case CONFIGURATION: | case CONFIGURATION: | ||||
| ssd1306.drawLine(37, SCREEN_HEIGHT / 2 - 1, SCREEN_WIDTH - 1, SCREEN_HEIGHT / 2 - 1, SSD1306_WHITE); | ssd1306.drawLine(37, SCREEN_HEIGHT / 2 - 1, SCREEN_WIDTH - 1, SCREEN_HEIGHT / 2 - 1, SSD1306_WHITE); | ||||
| drawStatusText (STATUS_TXT_CFG); | drawStatusText (STATUS_TXT_CFG); | ||||
| drawConfigText("Steigung"); | |||||
| drawConfigText("Höhe WLS"); | |||||
| drawConfigOption("03.00 mm"); | drawConfigOption("03.00 mm"); | ||||
| break; | break; | ||||
| case IDLE: | case IDLE: | ||||
| h = h1; | h = h1; | ||||
| } | } | ||||
| void Display::drawStatusText(String txt) { | void Display::drawStatusText(String txt) { | ||||
| uint16_t w = 0, h = 0; | |||||
| ssd1306.setFont(&titillium_web_regular8pt7b); | |||||
| calculateWH(txt, w, h); | |||||
| ssd1306.setCursor((37 - w) / 2, 11); | |||||
| ssd1306.println(txt); | |||||
| char *s; | |||||
| s = &txt[0]; | |||||
| int16_t w = 0; | |||||
| u8g2_gfx.setFont(u8g2_font_helvR08_tf); // select u8g2 font from here: https://github.com/olikraus/u8g2/wiki/fntlistall | |||||
| w = u8g2_gfx.getUTF8Width(s); | |||||
| u8g2_gfx.setCursor((37 - w) / 2, 12); | |||||
| u8g2_gfx.println(F(s)); | |||||
| } | } | ||||
| void Display::drawConfigText(String txt) { | void Display::drawConfigText(String txt) { | ||||
| uint16_t w = 0, h = 0; | |||||
| ssd1306.setFont(&titillium_web_semibold12pt7b); | |||||
| calculateWH(txt, w, h); | |||||
| ssd1306.setCursor((SCREEN_WIDTH + 37 - w) / 2, SCREEN_HEIGHT / 4 + h / 2 - 1); | |||||
| ssd1306.println(txt); | |||||
| char *s; | |||||
| s = &txt[0]; | |||||
| int16_t w = 0, h = 0; | |||||
| u8g2_gfx.setFont(u8g2_font_helvB12_tf); // select u8g2 font from here: https://github.com/olikraus/u8g2/wiki/fntlistall | |||||
| w = u8g2_gfx.getUTF8Width(s); | |||||
| h = u8g2_gfx.getFontAscent() - u8g2_gfx.getFontDescent(); | |||||
| u8g2_gfx.setCursor((SCREEN_WIDTH + 37 - w) / 2, SCREEN_HEIGHT / 4 + h / 2 - 1); // start writing at this position | |||||
| u8g2_gfx.println(F(s)); | |||||
| } | } | ||||
| void Display::drawConfigOption(String txt) { | void Display::drawConfigOption(String txt) { | ||||
| uint16_t w = 0, h = 0; | |||||
| ssd1306.setFont(&titillium_web_semibold12pt7b); | |||||
| calculateWH(txt, w, h); | |||||
| ssd1306.setCursor((SCREEN_WIDTH + 37 - w) / 2, SCREEN_HEIGHT / 4 * 3 + h / 2 - 1); | |||||
| ssd1306.println(txt); | |||||
| char *s; | |||||
| s = &txt[0]; | |||||
| int16_t w = 0, h = 0; | |||||
| u8g2_gfx.setFont(u8g2_font_helvB12_tf); | |||||
| w = u8g2_gfx.getUTF8Width(s); | |||||
| h = u8g2_gfx.getFontAscent() - u8g2_gfx.getFontDescent(); | |||||
| u8g2_gfx.setCursor((SCREEN_WIDTH + 37 - w) / 2, SCREEN_HEIGHT / 4 * 3 + h / 2 - 1); | |||||
| u8g2_gfx.println(F(s)); | |||||
| } | } |
| #define DISPLAY_H_ | #define DISPLAY_H_ | ||||
| #include <Adafruit_SSD1306.h> | #include <Adafruit_SSD1306.h> | ||||
| #include <U8g2_for_Adafruit_GFX.h> | |||||
| #include <stdint.h> | #include <stdint.h> | ||||
| #include "fonts/titillium_web_6pt7b.h" | #include "fonts/titillium_web_6pt7b.h" | ||||
| #include "fonts/titillium_web_8pt7b.h" | #include "fonts/titillium_web_8pt7b.h" | ||||
| class Display { | class Display { | ||||
| private: | private: | ||||
| Adafruit_SSD1306 ssd1306; | Adafruit_SSD1306 ssd1306; | ||||
| U8G2_FOR_ADAFRUIT_GFX u8g2_gfx; | |||||
| void calculateWH(String units, uint16_t &w, uint16_t &h); | void calculateWH(String units, uint16_t &w, uint16_t &h); | ||||
| void drawStatusText(String txt); | void drawStatusText(String txt); | ||||
| void drawConfigText(String txt); | void drawConfigText(String txt); |
| /* | |||||
| * RotaryControler.cpp | |||||
| * | |||||
| * Created on: 04.02.2022 | |||||
| * Author: FSmilari | |||||
| */ | |||||
| #include "RotaryControler.h" | |||||
| /***************** | |||||
| ** Constructors. | |||||
| ****************/ | |||||
| RotaryControler::RotaryControler(int RotEnc_Dta_Pin, int RotEnc_Clk_Pin, int RotEnc_Switch_Pin) : Encoder(RotEnc_Dta_Pin, RotEnc_Clk_Pin, | |||||
| RotaryEncoder::LatchMode::FOUR3), RotarySwitch(RotEnc_Switch_Pin, true, 2000) { | |||||
| } | |||||
| /****************** | |||||
| ** Public methods | |||||
| *****************/ | |||||
| void RotaryControler::tick(void) { | |||||
| Encoder.tick(); | |||||
| } | |||||
| void RotaryControler::resetPosition(void) { | |||||
| Encoder.setPosition(0L); | |||||
| } | |||||
| long RotaryControler::getPosition(void) { | |||||
| return Encoder.getPosition(); | |||||
| } | |||||
| int RotaryControler::getDirection(void) { | |||||
| return (int) Encoder.getPosition(); | |||||
| } | |||||
| bool RotaryControler::isSwitchPressed(void) { | |||||
| return RotarySwitch.isPressed(); | |||||
| } | |||||
| bool RotaryControler::isSwitchLongPressed(void) { | |||||
| return RotarySwitch.isLongPressed(); | |||||
| } | |||||
| void RotaryControler::setDebounceTime(unsigned long time) { | |||||
| RotarySwitch.setDebounceTime(time); | |||||
| } | |||||
| void RotaryControler::loop(void) { | |||||
| RotarySwitch.loop(); | |||||
| Encoder.tick(); | |||||
| } |
| /* | |||||
| * RotaryControler.h | |||||
| * | |||||
| * Created on: 04.02.2022 | |||||
| * Author: FSmilari | |||||
| */ | |||||
| #ifndef ROTARYCONTROLER_H_ | |||||
| #define ROTARYCONTROLER_H_ | |||||
| #include "RotaryEncoder.h" | |||||
| #include "ExEzButton.h" | |||||
| class RotaryControler { | |||||
| private: | |||||
| RotaryEncoder Encoder; | |||||
| ExEzButton RotarySwitch; | |||||
| public: | |||||
| RotaryControler(int RotEnc_Dta_Pin, int RotEnc_Clk_Pin, int RotEnc_Switch_Pin); | |||||
| void tick(void); | |||||
| void resetPosition(void); | |||||
| bool isSwitchPressed(void); | |||||
| bool isSwitchLongPressed(void); | |||||
| long getPosition(void); | |||||
| int getDirection(void); | |||||
| void setDebounceTime(unsigned long time); | |||||
| void loop(void); | |||||
| }; | |||||
| #endif /* ROTARYCONTROLER_H_ */ |
| //This is a automatic generated file | //This is a automatic generated file | ||||
| //Please do not modify this file | //Please do not modify this file | ||||
| //If you touch this file your change will be overwritten during the next build | //If you touch this file your change will be overwritten during the next build | ||||
| //This file has been generated on 2022-02-04 21:44:36 | |||||
| //This file has been generated on 2022-02-05 01:05:00 | |||||
| #include "Arduino.h" | #include "Arduino.h" | ||||
| #include <Arduino.h> | #include <Arduino.h> |