Loom 4 v4.5
Arduino library for Internet of Things Rapid Prototyping in environmental sensing
Loading...
Searching...
No Matches
Loom_OLED.h
1#pragma once
2
3#include "Loom_Manager.h"
4#include "Module.h"
5
6#include <Adafruit_SSD1306.h>
7
8
14class Loom_OLED : public Module{
15 protected:
16
17 void power_up() override {};
18 void power_down() override {};
19
20
21 // Manager controlled functions
22 void measure() override {};
23 void initialize() override;
24 void package() override {};
25 void display_data() override;
26
27 public:
28
32 enum class Version {
33 FEATHERWING, // FeatherWing OLED
34 BREAKOUT // Breakout board
35 };
36
40 enum class Format {
41 FOUR, // 4 Key values
42 EIGHT, // 8 Key values
43 SCROLL // Scrolling
44 };
45
49 enum class FreezeType {
50 DISABLE, // Freeze disabled
51 DATA, // Screen freezes
52 SCROLL // Scroll freezes, data updates
53 };
54
70 Manager& man,
71 const bool enable_rate_filter = true,
72 const uint16_t min_filter_delay = 300,
73 const Version type = Version::FEATHERWING,
74 const byte reset_pin = A2,
75 const Format display_format = Format::SCROLL,
76 const uint16_t scroll_duration = 6000,
77 const byte freeze_pin = 10,
78 const FreezeType freeze_behavior = FreezeType::SCROLL
79 );
80
81 /* Destructor for the display pointer */
82 ~Loom_OLED();
83
84 private:
85 bool canWrite(); // Returns whether or not we can write to the display yet
86 void flattenJSONObject(JsonObject json);// Flattens the given JSON object so we can display it
87
88 Manager* manInst; // Pointer to the manager
89
90 Adafruit_SSD1306* display = nullptr; // Underlying OLED controller
91 uint16_t min_filter_delay; // Time to wait in between updates
92 Version version; // What type the OLED is (FeatherWing or breakout)
93 byte reset_pin; // The reset pin (only applies to breakout version)
94
95 Format display_format; // How to display the data on OLED
96 uint scroll_duration; // The duration to complete a full cycle through a bundle of data (milliseconds)(non-blocking)
97 byte freeze_pin; // Which pin to check if display should freeze
98 FreezeType freeze_behavior; // What 'freezing' behavior should be followed
99
100 unsigned long lastLogTime; // Value of millis() at the last log
101 unsigned long previous_time; // Used to handle scrolling
102 DynamicJsonDocument flattenedDoc; // Flattened object
103
104
105};
Definition: Loom_OLED.h:14
Format
Definition: Loom_OLED.h:40
Version
Definition: Loom_OLED.h:32
FreezeType
Definition: Loom_OLED.h:49
Definition: Loom_Manager.h:18
Definition: Module.h:30