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

ssd1306_i2c.c
1 /*
2 MIT License
3
4 Copyright (c) 2017-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 #include "ssd1306_i2c.h"
26 #include "intf/ssd1306_interface.h"
27
28 void ssd1306_i2cInitEx(int8_t scl, int8_t sda, int8_t sa)
29 {
30 #if defined(CONFIG_PLATFORM_I2C_AVAILABLE) && defined(CONFIG_PLATFORM_I2C_ENABLE)
31 ssd1306_platform_i2cConfig_t cfg;
32 cfg.scl = scl;
33 cfg.sda = sda;
34 ssd1306_platform_i2cInit(-1, sa, &cfg);
35 #elif defined(CONFIG_TWI_I2C_AVAILABLE) && defined(CONFIG_TWI_I2C_ENABLE)
36 ssd1306_i2cConfigure_Twi(0);
37 ssd1306_i2cInit_Twi(sa);
38 #elif defined(CONFIG_SOFTWARE_I2C_AVAILABLE) && defined(CONFIG_SOFTWARE_I2C_ENABLE)
39 ssd1306_i2cInit_Embedded(scl, sda, sa);
40 #else
41 #warning "ssd1306 library: no i2c support for the target platform"
42 #endif
43 }
44
45 void ssd1306_i2cInit()
46 {
47 ssd1306_i2cInitEx(-1, -1, SSD1306_SA);
48 }
ssd1306_i2cInit_Twi
void ssd1306_i2cInit_Twi(uint8_t sa)
Definition: ssd1306_i2c_twi.c:160
ssd1306_i2cInit
void ssd1306_i2cInit()
Definition: ssd1306_i2c.c:45
ssd1306_platform_i2cConfig_t::scl
int8_t scl
clock pin number
Definition: io.h:82
ssd1306_platform_i2cConfig_t
Definition: io.h:80
ssd1306_i2c.h
ssd1306_i2cConfigure_Twi
void ssd1306_i2cConfigure_Twi(uint8_t arg)
Definition: ssd1306_i2c_twi.c:111
ssd1306_platform_i2cInit
void ssd1306_platform_i2cInit(int8_t busId, uint8_t addr, ssd1306_platform_i2cConfig_t *cfg)
Initializes i2c interface for platform being used.
ssd1306_platform_i2cConfig_t::sda
int8_t sda
data pin number
Definition: io.h:81
SSD1306_SA
#define SSD1306_SA
Definition: ssd1306_i2c_conf.h:47
ssd1306_i2cInitEx
void ssd1306_i2cInitEx(int8_t scl, int8_t sda, int8_t sa)
Definition: ssd1306_i2c.c:28
ssd1306_i2cInit_Embedded
void ssd1306_i2cInit_Embedded(int8_t scl, int8_t sda, uint8_t sa)
Definition: ssd1306_i2c_embedded.c:178
ssd1306_interface.h