SSD1306 I2C Display Driver
1.2.1
This library is developed to control SSD1306 I2C OLED Display
src
i2c
ssd1306_i2c_wire.cpp
1
/*
2
Copyright (C) 2016-2017 Alexey Dynda
3
4
This file is part of SSD1306 library.
5
6
This program is free software: you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
10
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License
17
along with this program. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
21
#include "
ssd1306_i2c.h
"
22
23
#include "
intf/ssd1306_interface.h
"
24
#include "ssd1306_i2c_conf.h"
25
26
#if !defined(SSD1306_EMBEDDED_I2C)
27
/* STANDARD branch */
28
#include <Wire.h>
29
30
uint8_t s_bytesWritten = 0;
31
32
void
ssd1306_i2cStart
(
void
)
33
{
34
Wire.beginTransmission(SSD1306_SA);
35
s_bytesWritten = 0;
36
}
37
38
void
ssd1306_i2cStop
(
void
)
39
{
40
Wire.endTransmission();
41
}
42
47
void
ssd1306_i2cSendByte
(uint8_t data)
48
{
49
// Do not write too many bytes for standard Wire.h. It may become broken
50
if
(s_bytesWritten >= (BUFFER_LENGTH >> 1))
51
{
52
ssd1306_i2cStop
();
53
ssd1306_i2cStart
();
54
/* Commands never require many bytes. Thus assume that user tries to send data */
55
Wire.write(0x40);
56
s_bytesWritten++;
57
}
58
Wire.write(data);
59
s_bytesWritten++;
60
}
61
62
63
#endif
64
65
ssd1306_i2cStop
void ssd1306_i2cStop()
Definition:
ssd1306_i2c_wire.cpp:38
ssd1306_i2c.h
ssd1306_i2cStart
void ssd1306_i2cStart()
Definition:
ssd1306_i2c_wire.cpp:32
ssd1306_i2cSendByte
void ssd1306_i2cSendByte(uint8_t data)
Definition:
ssd1306_i2c_wire.cpp:47
ssd1306_interface.h
Generated by
1.8.12