SSD1306 OLED display driver  1.8.2
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/stm32/io.h This is stm32 platform file
27  */
28 
29 #ifndef _SSD1306_STM32_IO_H_
30 #define _SSD1306_STM32_IO_H_
31 
32 // TODO: To add support. Any help is welcome
33 
34 #define SSD1306_STM32_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 static inline int digitalRead(int pin) // digitalRead()
65 {
66  return LOW;
67 }
68 
69 static inline void digitalWrite(int pin, int level) // digitalWrite()
70 {
71 }
72 
73 static inline void pinMode(int pin, int mode) // pinMode()
74 {
75 }
76 
77 static inline int analogRead(int pin) // analogRead()
78 {
79  return 0;
80 }
81 
82 static inline uint32_t millis(void) // millis()
83 {
84  return 0;
85 }
86 
87 static inline uint32_t micros(void) // micros()
88 {
89  return 0;
90 };
91 
92 static inline void delay(uint32_t ms) // delay()
93 {
94 }
95 
96 static inline void delayMicroseconds(uint32_t us) // delayMicroseconds()
97 {
98 }
99 
100 // !!! OPTIONAL !!!
101 static inline void randomSeed(int seed) // randomSeed() - can be skipped
102 {
103 }
104 
105 static inline void attachInterrupt(int pin, void (*interrupt)(), int level) // attachInterrupt() - can be skipped
106 {
107 }
108 
109 static inline uint8_t pgm_read_byte(const void *ptr) // pgm_read_byte() - can be skipped
110 {
111  return *((const uint8_t *)ptr);
112 }
113 
114 static inline uint16_t eeprom_read_word(const void *ptr) // eeprom_read_word() - can be skipped
115 {
116  return 0;
117 }
118 
119 static inline void eeprom_write_word(const void *ptr, uint16_t val) // eeprom_write_word() - can be skipped
120 {
121 }
122 
123 // utoa is already defined in stdlib c
124 //static inline char *utoa(unsigned int num, char *str, int radix) // util utoa() - can be skipped
125 //{
126 // *str = '\0';
127 // return str;
128 //}
129 
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 #ifdef __cplusplus
135 static inline int random(int max) // random(n) - can be skipped if you don't use it
136 {
137  return 0;
138 }
139 
140 static inline int random(int min, int max) // random(a,b) - can be skipped if you don't use it
141 {
142  return 0;
143 }
144 #endif
145 
146 #endif
147 
#define max(a, b)
#define min(a, b)