LCDGFX LCD display driver
1.0.5
This library is developed to control SSD1306/SSD1325/SSD1327/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays
lcd_hal
arduino
io.h
1
/*
2
MIT License
3
4
Copyright (c) 2018-2020, 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 lcd_hal/arduino/io.h ARDUINO IO communication functions
27
*/
28
29
#pragma once
30
31
#include "../UserSettings.h"
32
#include "../interface.h"
33
34
#if defined(ARDUINO_ARCH_STM32) // stm32duino support
35
#include <Arduino.h>
36
#include <avr/pgmspace.h>
37
#elif defined(ESP8266) || defined(ESP32) || defined(ESP31B) // esp arduino support
38
#include <Arduino.h>
39
#include <pgmspace.h>
40
#else // AVR support
41
#include <Arduino.h>
42
#include <avr/pgmspace.h>
43
#include <avr/interrupt.h>
44
#if !defined(ARDUINO_ARCH_SAMD) && defined(__AVR__)
45
#include <avr/sleep.h>
46
#endif
47
#endif
48
49
#if defined(ARDUINO_ARCH_STM32)
50
51
#define CONFIG_ARDUINO_I2C_AVAILABLE
52
53
#define SSD1306_WIRE_CLOCK_CONFIGURABLE
54
55
#define CONFIG_ARDUINO_SPI_AVAILABLE
56
57
#define CONFIG_STM32_I2C_AVAILABLE
58
59
#elif defined(ARDUINO_AVR_DIGISPARK) || defined(ARDUINO_AVR_DIGISPARKPRO)
60
61
#define CONFIG_ARDUINO_I2C_AVAILABLE
62
#if defined(ARDUINO_AVR_DIGISPARKPRO)
63
64
#define CONFIG_ARDUINO_SPI_AVAILABLE
65
#else
66
67
#define CONFIG_SOFTWARE_I2C_AVAILABLE
68
/* Define lcdint as smallest types to reduce memo usage on tiny controllers. *
69
* Remember, that this can cause issues with large lcd displays, i.e. 320x240*/
70
#define LCDINT_TYPES_DEFINED
71
typedef
int8_t
lcdint_t
;
72
typedef
uint8_t
lcduint_t
;
73
#endif
74
75
#elif defined(ARDUINO_AVR_ATTINYX5) || defined(ARDUINO_AVR_ATTINYX4)
76
78
#define CONFIG_SOFTWARE_I2C_AVAILABLE
79
80
#define CONFIG_ARDUINO_I2C_AVAILABLE
81
82
#define CONFIG_USI_SPI_AVAILABLE
83
84
#define CONFIG_ARDUINO_SPI_AVAILABLE
85
87
#define LCDINT_TYPES_DEFINED
88
89
typedef
int8_t
lcdint_t
;
91
typedef
uint8_t
lcduint_t
;
93
#define CONFIG_MULTIPLICATION_NOT_SUPPORTED
94
95
#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || \
96
defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
97
99
#define CONFIG_SOFTWARE_I2C_AVAILABLE
100
101
#define CONFIG_USI_SPI_AVAILABLE
102
104
#define LCDINT_TYPES_DEFINED
105
106
typedef
int8_t
lcdint_t
;
108
typedef
uint8_t
lcduint_t
;
110
#define CONFIG_MULTIPLICATION_NOT_SUPPORTED
111
112
#elif defined(ESP8266) || defined(ESP32) || defined(ESP31B) || defined(ARDUINO_ARCH_SAMD)
113
/* SW implementation of i2c isn't supported on ESP platforms */
115
#define CONFIG_ARDUINO_I2C_AVAILABLE
116
117
#define SSD1306_WIRE_CLOCK_CONFIGURABLE
118
119
#define CONFIG_ARDUINO_SPI_AVAILABLE
120
121
#if defined(ESP32)
122
123
#define CONFIG_ARDUINO_SPI2_AVAILABLE
124
125
#define CONFIG_VGA_AVAILABLE
126
#endif
127
128
#elif defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168P__)
129
130
#define CONFIG_SOFTWARE_I2C_AVAILABLE
131
132
#define CONFIG_ARDUINO_I2C_AVAILABLE
133
134
#define SSD1306_WIRE_CLOCK_CONFIGURABLE
135
136
#define CONFIG_TWI_I2C_AVAILABLE
137
138
#define CONFIG_ARDUINO_SPI_AVAILABLE
139
140
#define CONFIG_AVR_SPI_AVAILABLE
141
142
#define CONFIG_AVR_UART_AVAILABLE
143
144
#define CONFIG_VGA_AVAILABLE
145
146
#elif defined(NRF52) || defined(NRF5)
147
148
#define CONFIG_ARDUINO_I2C_AVAILABLE
149
150
#define SSD1306_WIRE_CLOCK_CONFIGURABLE
151
152
#define CONFIG_ARDUINO_SPI_AVAILABLE
153
154
#else
155
156
//#define CONFIG_SOFTWARE_I2C_AVAILABLE
158
#define CONFIG_ARDUINO_I2C_AVAILABLE
159
160
#define SSD1306_WIRE_CLOCK_CONFIGURABLE
161
162
// #define CONFIG_TWI_I2C_AVAILABLE
164
#define CONFIG_ARDUINO_SPI_AVAILABLE
165
166
//#define CONFIG_AVR_SPI_AVAILABLE
167
#endif
168
lcdint_t
int lcdint_t
Definition:
io.h:102
lcduint_t
unsigned int lcduint_t
Definition:
io.h:104
Generated by
1.8.13