Skip to content

Commit 3548014

Browse files
committed
Add support for the OLED display on GIGA R1
1 parent 53e6c0c commit 3548014

File tree

135 files changed

+473343
-22
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+473343
-22
lines changed

.codespellrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
ignore-words-list = ,
55
check-filenames =
66
check-hidden =
7-
skip = ./.git,./src/Grove_Temperature_And_Humidity_Sensor,./src/Grove_-_Barometer_Sensor_BMP280
7+
skip = ./.git,./src/Grove_Temperature_And_Humidity_Sensor,./src/Grove_-_Barometer_Sensor_BMP280,./src/U8g2

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ category=Sensors
88
url=https://sensorkit.arduino.cc/
99
architectures=avr,mbed_giga
1010
precompiled=false
11-
depends=Grove Temperature And Humidity Sensor,Grove - Barometer Sensor BMP280,U8g2,Grove-3-Axis-Digital-Accelerometer-2g-to-16g-LIS3DHTR
11+
depends=Grove-3-Axis-Digital-Accelerometer-2g-to-16g-LIS3DHTR

src/Arduino_SensorKit.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
11
#include "Arduino_SensorKit.h"
22

3-
#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_MEGAAVR) || defined(ARDUINO_UNOR4_MINIMA) || defined(ARDUINO_UNOR4_WIFI)
4-
#define _PIN_SDA SDA
5-
#define _PIN_SCL SCL
6-
#define _WIRE Wire
7-
#elif defined(ARDUINO_GIGA)
8-
#define _PIN_SDA I2C_SDA1
9-
#define _PIN_SCL I2C_SCL1
10-
#define _WIRE Wire1
11-
#else
12-
#error "This board is not supported by Arduino_SensorKit"
13-
#endif
14-
153
//Declare component's classes
16-
U8X8_SSD1306_128X64_NONAME_SW_I2C Oled_SW(_PIN_SCL, _PIN_SDA, U8X8_PIN_NONE);
17-
U8X8_SSD1306_128X64_NONAME_HW_I2C Oled_HW(U8X8_PIN_NONE, _PIN_SCL, _PIN_SDA);
4+
SensorKit_Oled Oled;
185
SensorKit_DHT Environment(3,DHT11);
196
DHT Environment_I2C(DHT20);
207
SensorKit_LIS3DHTR Accelerometer(_WIRE);

src/Arduino_SensorKit.h

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,46 @@
1414
#include "Arduino_SensorKit_BMP280.h" // Pressure
1515
#include "Arduino_SensorKit_LIS3DHTR.h" // Accel
1616
#include "Grove_Temperature_And_Humidity_Sensor/DHT.h" // Temp & Humidity
17-
#include "U8x8lib.h" // OLED Display
17+
#include "U8g2/src/U8x8lib.h" // OLED Display
18+
19+
#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_MEGAAVR) || defined(ARDUINO_UNOR4_MINIMA) || defined(ARDUINO_UNOR4_WIFI)
20+
#define _PIN_SDA SDA
21+
#define _PIN_SCL SCL
22+
#define _WIRE Wire
23+
#elif defined(ARDUINO_GIGA)
24+
#define _PIN_SDA I2C_SDA1
25+
#define _PIN_SCL I2C_SCL1
26+
#define _WIRE Wire1
27+
#else
28+
#error "This board is not supported by Arduino_SensorKit"
29+
#endif
1830

1931
class SensorKit_DHT;
2032

21-
//Make the declared components from the .cpp to the sketch available
22-
extern U8X8_SSD1306_128X64_NONAME_SW_I2C Oled_SW;
23-
extern U8X8_SSD1306_128X64_NONAME_HW_I2C Oled_HW;
33+
// The upstream U8X8 library provides two variants, one for hardware I2C (using
34+
// the Wire object provided by Arduino) and one for software I2C. The latter
35+
// doesn't seem to work. However it seems that when breaking the sensors from
36+
// the big PCB, the software I2C variant works better, so we support both
37+
// letting the user define SENSORKIT_USE_SW_I2C.
2438
#ifdef SENSORKIT_USE_SW_I2C
25-
#define Oled Oled_SW
39+
#define _Oled_class U8X8_SSD1306_128X64_NONAME_SW_I2C
2640
#else
27-
#define Oled Oled_HW
41+
#define _Oled_class U8X8_SSD1306_128X64_NONAME_HW_I2C
2842
#endif
43+
class SensorKit_Oled : public _Oled_class {
44+
public:
45+
#ifdef SENSORKIT_USE_SW_I2C
46+
SensorKit_Oled() : _Oled_class(_PIN_SCL, _PIN_SDA, U8X8_PIN_NONE) {};
47+
#else
48+
SensorKit_Oled() : _Oled_class(U8X8_PIN_NONE, _PIN_SCL, _PIN_SDA) {};
49+
bool begin(void) {
50+
_Oled_class::wire = &_WIRE;
51+
return _Oled_class::begin();
52+
};
53+
#endif
54+
};
55+
extern SensorKit_Oled Oled;
56+
2957
extern SensorKit_LIS3DHTR Accelerometer;
3058
extern SensorKit_BMP280 Pressure;
3159
extern SensorKit_DHT Environment;

src/U8g2/.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"files.associations": {
3+
"*.scss": "scss",
4+
"chrono": "cpp"
5+
}
6+
}

src/U8g2/LICENSE

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
2+
The U8g2lib code (http://code.google.com/p/u8g2/) is licensed under the terms of
3+
the new-bsd license (two-clause bsd license).
4+
See also: http://www.opensource.org/licenses/bsd-license.php
5+
6+
Fonts are licensed under different conditions.
7+
See
8+
https://github.com/olikraus/u8g2/wiki/fntgrp
9+
for detailed information on the licensing conditions for each font.
10+
11+
The example code in sys/raspi_gpio/hal will use the bcm2835 lib from Mike McCauley
12+
which is licensed under GPL V3: http://www.airspayce.com/mikem/bcm2835/
13+
14+
============ X11 Fonts COUR, HELV, NCEN, TIM, SYMB ============
15+
16+
For fonts derived from the following files, the license below applies.
17+
COURB08.BDF COURB10.BDF COURB12.BDF COURB14.BDF COURB18.BDF
18+
COURB24.BDF COURR08.BDF COURR10.BDF COURR12.BDF COURR14.BDF
19+
COURR18.BDF COURR24.BDF HELVB08.BDF HELVB10.BDF HELVB12.BDF HELVB14.BDF
20+
HELVB18.BDF HELVB24.BDF HELVR08.BDF HELVR10.BDF HELVR12.BDF HELVR14.BDF
21+
HELVR18.BDF HELVR24.BDF NCENB08.BDF NCENB10.BDF NCENB12.BDF
22+
NCENB14.BDF NCENB18.BDF NCENB24.BDF NCENR08.BDF NCENR10.BDF
23+
NCENR12.BDF NCENR14.BDF NCENR18.BDF NCENR24.BDF SYMB08.BDF SYMB10.BDF
24+
SYMB12.BDF SYMB14.BDF SYMB18.BDF SYMB24.BDF TIMB08.BDF TIMB10.BDF
25+
TIMB12.BDF TIMB14.BDF TIMB18.BDF TIMB24.BDF TIMR08.BDF TIMR10.BDF
26+
TIMR12.BDF TIMR14.BDF TIMR18.BDF TIMR24.BDF
27+
28+
Copyright 1984-1989, 1994 Adobe Systems Incorporated.
29+
Copyright 1988, 1994 Digital Equipment Corporation.
30+
31+
Adobe is a trademark of Adobe Systems Incorporated which may be
32+
registered in certain jurisdictions.
33+
Permission to use these trademarks is hereby granted only in
34+
association with the images described in this file.
35+
36+
Permission to use, copy, modify, distribute and sell this software
37+
and its documentation for any purpose and without fee is hereby
38+
granted, provided that the above copyright notices appear in all
39+
copies and that both those copyright notices and this permission
40+
notice appear in supporting documentation, and that the names of
41+
Adobe Systems and Digital Equipment Corporation not be used in
42+
advertising or publicity pertaining to distribution of the software
43+
without specific, written prior permission. Adobe Systems and
44+
Digital Equipment Corporation make no representations about the
45+
suitability of this software for any purpose. It is provided "as
46+
is" without express or implied warranty.
47+
48+
49+
============ BSD License for U8g2lib Code ============
50+
51+
Universal 8bit Graphics Library (http://code.google.com/p/u8g2/)
52+
53+
Copyright (c) 2016, [email protected]
54+
All rights reserved.
55+
56+
Redistribution and use in source and binary forms, with or without modification,
57+
are permitted provided that the following conditions are met:
58+
59+
* Redistributions of source code must retain the above copyright notice, this list
60+
of conditions and the following disclaimer.
61+
62+
* Redistributions in binary form must reproduce the above copyright notice, this
63+
list of conditions and the following disclaimer in the documentation and/or other
64+
materials provided with the distribution.
65+
66+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
67+
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
68+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
69+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
70+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
71+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
72+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
73+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
74+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
75+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
76+
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
77+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
78+
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
79+

src/U8g2/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# U8g2_Arduino: Arduino Monochrome Graphics Library
2+
3+
![https://raw.githubusercontent.com/wiki/olikraus/u8g2/img/uc1701_dogs102_uno_board_320.jpg](https://raw.githubusercontent.com/wiki/olikraus/u8g2/img/uc1701_dogs102_uno_board_320.jpg)
4+
5+
U8glib V2 library for Arduino
6+
7+
Description: https://github.com/olikraus/u8g2/wiki
8+
9+
Issue Tracker: https://github.com/olikraus/u8g2/issues
10+
11+
Download (2.34.22): https://github.com/olikraus/U8g2_Arduino/archive/master.zip
12+

0 commit comments

Comments
 (0)