SSD1306 OLED display driver
1.6.99
This library is developed to control SSD1306/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
src
ssd1306_hal
template
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/template/io.h This is template file for new platform with detailed instructions
27
*/
28
29
#ifndef _SSD1306_TEMPLATE_IO_H_
30
#define _SSD1306_TEMPLATE_IO_H_
31
32
//========================== I. Include libraries =========================
33
/* 1. Include all required headers, specific for your platform here */
34
#include <stdint.h>
35
#include <stdlib.h>
36
#include <string.h>
37
38
#define LOW 0
39
#define HIGH 1
40
#define INPUT 0
41
#define OUTPUT 1
42
/* Progmem attribute for data, located in Flash */
43
#define PROGMEM
44
45
//========================== II. Define options ===========================
46
/* 2. Uncomment all options, you have support for on your platform *
47
* Remember that you will need to implement low level intf/i2c or *
48
* intf/spi layers for your platform */
49
50
//#define CONFIG_SOFTWARE_I2C_AVAILABLE
51
//#define CONFIG_TWI_I2C_AVAILABLE
52
//#define CONFIG_ARDUINO_WIRE_LIBRARY_AVAILABLE
53
//#define CONFIG_AVR_SPI_AVAILABLE
54
//#define CONFIG_ARDUINO_SPI_LIBRARY_AVAILABLE
55
//#define CONFIG_AVR_UART_AVAILABLE
56
//#define CONFIG_VGA_AVAILABLE
57
58
#ifdef __cplusplus
59
extern
"C"
{
60
#endif
61
62
//========================== III. Implement functions =====================
63
/* Implement functions below the way you like. You can make them non-static */
64
// !!! MANDATORY !!!
65
static
inline
int
digitalRead(
int
pin)
// digitalRead()
66
{
67
return
LOW;
68
}
69
70
static
inline
void
digitalWrite(
int
pin,
int
level)
// digitalWrite()
71
{
72
}
73
74
static
inline
void
pinMode(
int
pin,
int
mode)
// pinMode()
75
{
76
}
77
78
static
inline
int
analogRead(
int
pin)
// analogRead()
79
{
80
return
0;
81
}
82
83
static
inline
uint32_t millis(
void
)
// millis()
84
{
85
return
0;
86
}
87
88
static
inline
uint32_t micros(
void
)
// micros()
89
{
90
return
0;
91
};
92
93
static
inline
void
delay(uint32_t ms)
// delay()
94
{
95
}
96
97
static
inline
void
delayMicroseconds(uint32_t us)
// delayMicroseconds()
98
{
99
}
100
101
// !!! OPTIONAL !!!
102
static
inline
void
randomSeed(
int
seed)
// randomSeed() - can be skipped
103
{
104
}
105
106
static
inline
void
attachInterrupt(
int
pin,
void
(*interrupt)(),
int
level)
// attachInterrupt() - can be skipped
107
{
108
}
109
110
static
inline
uint8_t pgm_read_byte(
const
void
*ptr)
// pgm_read_byte() - can be skipped
111
{
112
return
*((
const
uint8_t *)ptr);
113
}
114
115
static
inline
uint16_t eeprom_read_word(
const
void
*ptr)
// eeprom_read_word() - can be skipped
116
{
117
return
0;
118
}
119
120
static
inline
void
eeprom_write_word(
const
void
*ptr, uint16_t val)
// eeprom_write_word() - can be skipped
121
{
122
}
123
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
max
#define max(a, b)
Definition:
nano_gfx_types.h:40
min
#define min(a, b)
Definition:
nano_gfx_types.h:35
Generated by
1.8.11