Skip to content

Commit 7210e34

Browse files
committed
First commit
1 parent fe6a403 commit 7210e34

18 files changed

+1387
-1
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.pioenvs
2+
.piolibdeps
3+
.vscode
4+
.vscode/c_cpp_properties.json
5+
src/settings.cpp
6+
.vscode/launch.json

.travis.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Continuous Integration (CI) is the practice, in software
2+
# engineering, of merging all developer working copies with a shared mainline
3+
# several times a day < http://docs.platformio.org/page/ci/index.html >
4+
#
5+
# Documentation:
6+
#
7+
# * Travis CI Embedded Builds with PlatformIO
8+
# < https://docs.travis-ci.com/user/integration/platformio/ >
9+
#
10+
# * PlatformIO integration with Travis CI
11+
# < http://docs.platformio.org/page/ci/travis.html >
12+
#
13+
# * User Guide for `platformio ci` command
14+
# < http://docs.platformio.org/page/userguide/cmd_ci.html >
15+
#
16+
#
17+
# Please choice one of the following templates (proposed below) and uncomment
18+
# it (remove "# " before each line) or use own configuration according to the
19+
# Travis CI documentation (see above).
20+
#
21+
22+
23+
#
24+
# Template #1: General project. Test it using existing `platformio.ini`.
25+
#
26+
27+
# language: python
28+
# python:
29+
# - "2.7"
30+
#
31+
# install:
32+
# - pip install -U platformio
33+
#
34+
# script:
35+
# - platformio run
36+
37+
38+
#
39+
# Template #2: The project is intended to by used as a library with examples
40+
#
41+
42+
# language: python
43+
# python:
44+
# - "2.7"
45+
#
46+
# env:
47+
# - PLATFORMIO_CI_SRC=path/to/test/file.c
48+
# - PLATFORMIO_CI_SRC=examples/file.ino
49+
# - PLATFORMIO_CI_SRC=path/to/test/directory
50+
#
51+
# install:
52+
# - pip install -U platformio
53+
#
54+
# script:
55+
# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# thermostat
2-
Thermostat ESP2866 project
2+
Wemos D1 mini WiFi thermostat

lib/Adafruit_SSD1306/Adafruit_SSD1306.cpp

+774
Large diffs are not rendered by default.
+184
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
/*********************************************************************
2+
This is a library for our Monochrome OLEDs based on SSD1306 drivers
3+
4+
Pick one up today in the adafruit shop!
5+
------> http://www.adafruit.com/category/63_98
6+
7+
These displays use SPI to communicate, 4 or 5 pins are required to
8+
interface
9+
10+
Adafruit invests time and resources providing this open source code,
11+
please support Adafruit and open-source hardware by purchasing
12+
products from Adafruit!
13+
14+
Written by Limor Fried/Ladyada for Adafruit Industries.
15+
BSD license, check license.txt for more information
16+
All text above, and the splash screen must be included in any redistribution
17+
*********************************************************************/
18+
#ifndef _Adafruit_SSD1306_H_
19+
#define _Adafruit_SSD1306_H_
20+
21+
#if ARDUINO >= 100
22+
#include "Arduino.h"
23+
#define WIRE_WRITE Wire.write
24+
#else
25+
#include "WProgram.h"
26+
#define WIRE_WRITE Wire.send
27+
#endif
28+
29+
#if defined(__SAM3X8E__)
30+
typedef volatile RwReg PortReg;
31+
typedef uint32_t PortMask;
32+
#define HAVE_PORTREG
33+
#elif defined(ARDUINO_ARCH_SAMD)
34+
// not supported
35+
#elif defined(ESP8266) || defined(ARDUINO_STM32_FEATHER)
36+
typedef volatile uint32_t PortReg;
37+
typedef uint32_t PortMask;
38+
#else
39+
typedef volatile uint8_t PortReg;
40+
typedef uint8_t PortMask;
41+
#define HAVE_PORTREG
42+
#endif
43+
44+
#include <SPI.h>
45+
#include <Adafruit_GFX.h>
46+
47+
#define BLACK 0
48+
#define WHITE 1
49+
#define INVERSE 2
50+
51+
#define SSD1306_I2C_ADDRESS 0x3C // 011110+SA0+RW - 0x3C or 0x3D
52+
// Address for 128x32 is 0x3C
53+
// Address for 128x64 is 0x3D (default) or 0x3C (if SA0 is grounded)
54+
55+
/*=========================================================================
56+
SSD1306 Displays
57+
-----------------------------------------------------------------------
58+
The driver is used in multiple displays (128x64, 128x32, etc.).
59+
Select the appropriate display below to create an appropriately
60+
sized framebuffer, etc.
61+
62+
SSD1306_128_64 128x64 pixel display
63+
64+
SSD1306_128_32 128x32 pixel display
65+
66+
SSD1306_96_16
67+
68+
-----------------------------------------------------------------------*/
69+
#define SSD1306_64_48
70+
// #define SSD1306_128_64
71+
// #define SSD1306_128_32
72+
// #define SSD1306_96_16
73+
/*=========================================================================*/
74+
75+
#if defined SSD1306_128_64 && defined SSD1306_128_32
76+
#error "Only one SSD1306 display can be specified at once in Adafruit_SSD1306.h"
77+
#endif
78+
#if !defined SSD1306_128_64 && !defined SSD1306_128_32 && !defined SSD1306_96_16 && !defined SSD1306_64_48
79+
#error "At least one SSD1306 display must be specified in Adafruit_SSD1306.h"
80+
#endif
81+
82+
#if defined SSD1306_128_64
83+
#define SSD1306_LCDWIDTH 128
84+
#define SSD1306_LCDHEIGHT 64
85+
#elif defined SSD1306_128_32
86+
#define SSD1306_LCDWIDTH 128
87+
#define SSD1306_LCDHEIGHT 32
88+
#elif defined SSD1306_96_16
89+
#define SSD1306_LCDWIDTH 96
90+
#define SSD1306_LCDHEIGHT 16
91+
#elif defined SSD1306_64_48
92+
#define SSD1306_LCDWIDTH 64
93+
#define SSD1306_LCDHEIGHT 48
94+
#endif
95+
96+
#define SSD1306_SETCONTRAST 0x81
97+
#define SSD1306_DISPLAYALLON_RESUME 0xA4
98+
#define SSD1306_DISPLAYALLON 0xA5
99+
#define SSD1306_NORMALDISPLAY 0xA6
100+
#define SSD1306_INVERTDISPLAY 0xA7
101+
#define SSD1306_DISPLAYOFF 0xAE
102+
#define SSD1306_DISPLAYON 0xAF
103+
104+
#define SSD1306_SETDISPLAYOFFSET 0xD3
105+
#define SSD1306_SETCOMPINS 0xDA
106+
107+
#define SSD1306_SETVCOMDETECT 0xDB
108+
109+
#define SSD1306_SETDISPLAYCLOCKDIV 0xD5
110+
#define SSD1306_SETPRECHARGE 0xD9
111+
112+
#define SSD1306_SETMULTIPLEX 0xA8
113+
114+
#define SSD1306_SETLOWCOLUMN 0x00
115+
#define SSD1306_SETHIGHCOLUMN 0x10
116+
117+
#define SSD1306_SETSTARTLINE 0x40
118+
119+
#define SSD1306_MEMORYMODE 0x20
120+
#define SSD1306_COLUMNADDR 0x21
121+
#define SSD1306_PAGEADDR 0x22
122+
123+
#define SSD1306_COMSCANINC 0xC0
124+
#define SSD1306_COMSCANDEC 0xC8
125+
126+
#define SSD1306_SEGREMAP 0xA0
127+
128+
#define SSD1306_CHARGEPUMP 0x8D
129+
130+
#define SSD1306_EXTERNALVCC 0x1
131+
#define SSD1306_SWITCHCAPVCC 0x2
132+
133+
// Scrolling #defines
134+
#define SSD1306_ACTIVATE_SCROLL 0x2F
135+
#define SSD1306_DEACTIVATE_SCROLL 0x2E
136+
#define SSD1306_SET_VERTICAL_SCROLL_AREA 0xA3
137+
#define SSD1306_RIGHT_HORIZONTAL_SCROLL 0x26
138+
#define SSD1306_LEFT_HORIZONTAL_SCROLL 0x27
139+
#define SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL 0x29
140+
#define SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL 0x2A
141+
142+
class Adafruit_SSD1306 : public Adafruit_GFX {
143+
public:
144+
Adafruit_SSD1306(int8_t SID, int8_t SCLK, int8_t DC, int8_t RST, int8_t CS);
145+
Adafruit_SSD1306(int8_t DC, int8_t RST, int8_t CS);
146+
Adafruit_SSD1306(int8_t RST = -1);
147+
148+
void begin(uint8_t switchvcc = SSD1306_SWITCHCAPVCC, uint8_t i2caddr = SSD1306_I2C_ADDRESS, bool reset=true);
149+
void ssd1306_command(uint8_t c);
150+
151+
void clearDisplay(void);
152+
void invertDisplay(uint8_t i);
153+
void display();
154+
155+
void startscrollright(uint8_t start, uint8_t stop);
156+
void startscrollleft(uint8_t start, uint8_t stop);
157+
158+
void startscrolldiagright(uint8_t start, uint8_t stop);
159+
void startscrolldiagleft(uint8_t start, uint8_t stop);
160+
void stopscroll(void);
161+
162+
void dim(boolean dim);
163+
164+
void drawPixel(int16_t x, int16_t y, uint16_t color);
165+
166+
virtual void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
167+
virtual void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
168+
169+
private:
170+
int8_t _i2caddr, _vccstate, sid, sclk, dc, rst, cs;
171+
void fastSPIwrite(uint8_t c);
172+
173+
boolean hwSPI;
174+
#ifdef HAVE_PORTREG
175+
PortReg *mosiport, *clkport, *csport, *dcport;
176+
PortMask mosipinmask, clkpinmask, cspinmask, dcpinmask;
177+
#endif
178+
179+
inline void drawFastVLineInternal(int16_t x, int16_t y, int16_t h, uint16_t color) __attribute__((always_inline));
180+
inline void drawFastHLineInternal(int16_t x, int16_t y, int16_t w, uint16_t color) __attribute__((always_inline));
181+
182+
};
183+
184+
#endif /* _Adafruit_SSD1306_H_ */

lib/Adafruit_SSD1306/README.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Adafruit_SSD1306
2+
<!-- START COMPATIBILITY TABLE -->
3+
4+
## Compatibility
5+
6+
MCU | Tested Works | Doesn't Work | Not Tested | Notes
7+
----------------- | :----------: | :----------: | :---------: | -----
8+
Atmega328 @ 16MHz | X | | |
9+
Atmega328 @ 12MHz | X | | |
10+
Atmega32u4 @ 16MHz | X | | |
11+
Atmega32u4 @ 8MHz | X | | |
12+
ESP8266 | X | | | change OLED_RESET to different pin if using default I2C pins D4/D5.
13+
Atmega2560 @ 16MHz | X | | |
14+
ATSAM3X8E | X | | |
15+
ATSAM21D | X | | |
16+
ATtiny85 @ 16MHz | | X | |
17+
ATtiny85 @ 8MHz | | X | |
18+
19+
* ATmega328 @ 16MHz : Arduino UNO, Adafruit Pro Trinket 5V, Adafruit Metro 328, Adafruit Metro Mini
20+
* ATmega328 @ 12MHz : Adafruit Pro Trinket 3V
21+
* ATmega32u4 @ 16MHz : Arduino Leonardo, Arduino Micro, Arduino Yun, Teensy 2.0
22+
* ATmega32u4 @ 8MHz : Adafruit Flora, Bluefruit Micro
23+
* ESP8266 : Adafruit Huzzah
24+
* ATmega2560 @ 16MHz : Arduino Mega
25+
* ATSAM3X8E : Arduino Due
26+
* ATSAM21D : Arduino Zero, M0 Pro
27+
* ATtiny85 @ 16MHz : Adafruit Trinket 5V
28+
* ATtiny85 @ 8MHz : Adafruit Gemma, Arduino Gemma, Adafruit Trinket 3V
29+
30+
<!-- END COMPATIBILITY TABLE -->

lib/Adafruit_SSD1306/README.txt

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
This is a library for our Monochrome OLEDs based on SSD1306 drivers
2+
3+
Pick one up today in the adafruit shop!
4+
------> http://www.adafruit.com/category/63_98
5+
6+
These displays use SPI to communicate, 4 or 5 pins are required to
7+
interface
8+
9+
Adafruit invests time and resources providing this open source code,
10+
please support Adafruit and open-source hardware by purchasing
11+
products from Adafruit!
12+
13+
Written by Limor Fried/Ladyada for Adafruit Industries.
14+
Scrolling code contributed by Michael Gregg
15+
BSD license, check license.txt for more information
16+
All text above must be included in any redistribution
17+
18+
To download. click the DOWNLOADS button in the top right corner, rename the uncompressed folder Adafruit_SSD1306. Check that the Adafruit_SSD1306 folder contains Adafruit_SSD1306.cpp and Adafruit_SSD1306.h
19+
20+
Place the Adafruit_SSD1306 library folder your <arduinosketchfolder>/libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE.
21+
22+
You will also have to download the Adafruit GFX Graphics core which does all the circles, text, rectangles, etc. You can get it from
23+
https://github.com/adafruit/Adafruit-GFX-Library
24+
and download/install that library as well
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name=Adafruit SSD1306
2+
version=1.1.0
3+
author=Adafruit
4+
maintainer=Adafruit <info@adafruit.com>
5+
sentence=SSD1306 oled driver library for 'monochrome' 128x64 and 128x32 OLEDs!
6+
paragraph=SSD1306 oled driver library for 'monochrome' 128x64 and 128x32 OLEDs!
7+
category=Display
8+
url=https://github.com/adafruit/Adafruit_SSD1306
9+
architectures=*

lib/Adafruit_SSD1306/license.txt

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Software License Agreement (BSD License)
2+
3+
Copyright (c) 2012, Adafruit Industries
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
1. Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
2. Redistributions in binary form must reproduce the above copyright
11+
notice, this list of conditions and the following disclaimer in the
12+
documentation and/or other materials provided with the distribution.
13+
3. Neither the name of the copyright holders nor the
14+
names of its contributors may be used to endorse or promote products
15+
derived from this software without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
18+
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
21+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)