SSD1306 OLED display driver 1.7.8 This library is developed to control SSD1306/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays

io.h
1 /*
2 MIT License
3
4 Copyright (c) 2018, 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 ssd1306_hal/esp/io.h This is stm32 platform file
27 */
28
29 #ifndef _SSD1306_ESP_IO_H_
30 #define _SSD1306_ESP_IO_H_
31
32 // TODO: To complete support. Any help is welcome
33
34 #define SSD1306_ESP_PLATFORM
35 //========================== I. Include libraries =========================
36 /* 1. Include all required headers, specific for your platform here */
37 #include <stdint.h>
38 #include <stdlib.h>
39 #include <string.h>
40
41 #define LOW 0
42 #define HIGH 1
43 #define INPUT 0
44 #define OUTPUT 1
45 /* Progmem attribute for data, located in Flash */
46 #define PROGMEM
47
48 //========================== II. Define options ===========================
49 /* 2. Uncomment all options, you have support for on your platform *
50 * Remember that you will need to implement low level intf/i2c or *
51 * intf/spi layers for your platform */
52
54 #define CONFIG_PLATFORM_I2C_AVAILABLE
55 #define CONFIG_PLATFORM_SPI_AVAILABLE
56
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60
61 //========================== III. Implement functions =====================
62 /* Implement functions below the way you like. You can make them non-static */
63 // !!! MANDATORY !!!
64 int digitalRead(int pin);
65
66 void digitalWrite(int pin, int level);
67
68 void pinMode(int pin, int mode);
69
70 static inline int analogRead(int pin) // analogRead()
71 {
72 return 0;
73 }
74
75 uint32_t millis(void);
76
77 static inline uint32_t micros(void) // micros()
78 {
79 return 0;
80 };
81
82 void delay(uint32_t ms);
83
84 static inline void delayMicroseconds(uint32_t us) // delayMicroseconds()
85 {
86 }
87
88 // !!! OPTIONAL !!!
89 static inline void randomSeed(int seed) // randomSeed() - can be skipped
90 {
91 }
92
93 static inline void attachInterrupt(int pin, void (*interrupt)(), int level) // attachInterrupt() - can be skipped
94 {
95 }
96
97 static inline uint8_t pgm_read_byte(const void *ptr) // pgm_read_byte() - can be skipped
98 {
99 return *((const uint8_t *)ptr);
100 }
101
102 static inline uint16_t eeprom_read_word(const void *ptr) // eeprom_read_word() - can be skipped
103 {
104 return 0;
105 }
106
107 static inline void eeprom_write_word(const void *ptr, uint16_t val) // eeprom_write_word() - can be skipped
108 {
109 }
110
111 // utoa is already defined in stdlib c
112 //static inline char *utoa(unsigned int num, char *str, int radix) // util utoa() - can be skipped
113 //{
114 // *str = '\0';
115 // return str;
116 //}
117
118 #ifdef __cplusplus
119 }
120 #endif
121
122 #ifdef __cplusplus
123 static inline int random(int max) // random(n) - can be skipped if you don't use it
124 {
125 return 0;
126 }
127
128 static inline int random(int min, int max) // random(a,b) - can be skipped if you don't use it
129 {
130 return 0;
131 }
132 #endif
133
134 #endif
135
max
#define max(a, b)
Definition: nano_gfx_types.h:40
min
#define min(a, b)
Definition: nano_gfx_types.h:35