SSD1306 OLED display driver
1.8.2
This library is developed to control SSD1306/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays
ssd1306_hal
arduino
io.h
1
/*
2
MIT License
3
4
Copyright (c) 2018-2019, Alexey Dynda
5
6
Permission is hereby granted, free of charge, to any person obtaining a copy
7
of this software and associated documentation files (the "Software"), to deal
8
in the Software without restriction, including without limitation the rights
9
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
copies of the Software, and to permit persons to whom the Software is
11
furnished to do so, subject to the following conditions:
12
13
The above copyright notice and this permission notice shall be included in all
14
copies or substantial portions of the Software.
15
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
SOFTWARE.
23
*/
24
25
/*
26
* @file hal/arduino/io.h SSD1306 ARDUINO IO communication functions
27
*/
28
29
#ifndef _SSD1306_ARDUINO_IO_H_
30
#define _SSD1306_ARDUINO_IO_H_
31
32
#if defined(ARDUINO_ARCH_STM32) // stm32duino support
33
#include <Arduino.h>
34
#include <avr/pgmspace.h>
35
#elif defined(ESP8266) || defined(ESP32) || defined(ESP31B) // esp arduino support
36
#include <Arduino.h>
37
#include <pgmspace.h>
38
#else // AVR support
39
#include <Arduino.h>
40
#include <avr/pgmspace.h>
41
#include <avr/interrupt.h>
42
#if !defined(ARDUINO_ARCH_SAMD) && defined(__AVR__)
43
#include <avr/sleep.h>
44
#endif
45
#endif
46
47
#if defined(ARDUINO_ARCH_STM32)
48
49
#define CONFIG_PLATFORM_I2C_AVAILABLE
50
51
#define SSD1306_WIRE_CLOCK_CONFIGURABLE
52
53
#define CONFIG_PLATFORM_SPI_AVAILABLE
54
55
#define CONFIG_STM32_I2C_AVAILABLE
56
57
#elif defined(ARDUINO_AVR_DIGISPARK) || defined(ARDUINO_AVR_DIGISPARKPRO)
58
59
#define CONFIG_PLATFORM_I2C_AVAILABLE
60
#if defined(ARDUINO_AVR_DIGISPARKPRO)
61
62
#define CONFIG_PLATFORM_SPI_AVAILABLE
63
#else
64
65
#define CONFIG_SOFTWARE_I2C_AVAILABLE
66
/* Define lcdint as smallest types to reduce memo usage on tiny controllers. *
67
* Remember, that this can cause issues with large lcd displays, i.e. 320x240*/
68
#define LCDINT_TYPES_DEFINED
69
typedef
int8_t
lcdint_t
;
70
typedef
uint8_t
lcduint_t
;
71
#endif
72
73
#elif defined(ARDUINO_AVR_ATTINYX5) || defined(ARDUINO_AVR_ATTINYX4)
74
76
#define CONFIG_SOFTWARE_I2C_AVAILABLE
77
78
#define CONFIG_PLATFORM_I2C_AVAILABLE
79
80
#define CONFIG_USI_SPI_AVAILABLE
81
82
#define CONFIG_PLATFORM_SPI_AVAILABLE
83
85
#define LCDINT_TYPES_DEFINED
86
87
typedef
int8_t
lcdint_t
;
89
typedef
uint8_t
lcduint_t
;
91
#define CONFIG_MULTIPLICATION_NOT_SUPPORTED
92
93
#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || \
94
defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
95
97
#define CONFIG_SOFTWARE_I2C_AVAILABLE
98
99
#define CONFIG_USI_SPI_AVAILABLE
100
102
#define LCDINT_TYPES_DEFINED
103
104
typedef
int8_t
lcdint_t
;
106
typedef
uint8_t
lcduint_t
;
108
#define CONFIG_MULTIPLICATION_NOT_SUPPORTED
109
110
#elif defined(ESP8266) || defined(ESP32) || defined(ESP31B) || \
111
defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
112
/* SW implementation of i2c isn't supported on ESP platforms */
114
#define CONFIG_PLATFORM_I2C_AVAILABLE
115
116
#define SSD1306_WIRE_CLOCK_CONFIGURABLE
117
118
#define CONFIG_PLATFORM_SPI_AVAILABLE
119
#if defined(ESP32)
120
121
#define CONFIG_VGA_AVAILABLE
122
#endif
123
124
#elif defined(__AVR_ATmega328P__)
125
126
#define CONFIG_SOFTWARE_I2C_AVAILABLE
127
128
#define CONFIG_PLATFORM_I2C_AVAILABLE
129
130
#define SSD1306_WIRE_CLOCK_CONFIGURABLE
131
132
#define CONFIG_TWI_I2C_AVAILABLE
133
134
#define CONFIG_PLATFORM_SPI_AVAILABLE
135
136
#define CONFIG_AVR_SPI_AVAILABLE
137
138
#define CONFIG_AVR_UART_AVAILABLE
139
140
#define CONFIG_VGA_AVAILABLE
141
142
#elif defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)
143
144
#define CONFIG_SOFTWARE_I2C_AVAILABLE
145
146
#define CONFIG_PLATFORM_I2C_AVAILABLE
147
148
#define SSD1306_WIRE_CLOCK_CONFIGURABLE
149
150
#define CONFIG_TWI_I2C_AVAILABLE
151
152
#define CONFIG_PLATFORM_SPI_AVAILABLE
153
// Disable internal AVR SPI implementation for ATMEGA 2560 since,
154
// it doesn't work for now
155
// #define CONFIG_AVR_SPI_AVAILABLE
156
157
#elif defined(NRF52) || defined(NRF5)
158
159
#define CONFIG_PLATFORM_I2C_AVAILABLE
160
161
#define SSD1306_WIRE_CLOCK_CONFIGURABLE
162
163
#define CONFIG_PLATFORM_SPI_AVAILABLE
164
165
#else
166
167
#define CONFIG_SOFTWARE_I2C_AVAILABLE
168
169
#define CONFIG_PLATFORM_I2C_AVAILABLE
170
171
#define SSD1306_WIRE_CLOCK_CONFIGURABLE
172
173
#define CONFIG_TWI_I2C_AVAILABLE
174
175
#define CONFIG_PLATFORM_SPI_AVAILABLE
176
177
#define CONFIG_AVR_SPI_AVAILABLE
178
#endif
179
180
//#ifdef CONFIG_PLATFORM_I2C_AVAILABLE
181
//#ifdef __cplusplus
182
//#include <Wire.h>
183
//#endif
184
//#endif
185
186
#endif // _SSD1306_ARDUINO_IO_H_
187
lcdint_t
int lcdint_t
Definition:
io.h:63
lcduint_t
unsigned int lcduint_t
Definition:
io.h:65
Generated by
1.8.13