Вс фев 25, 2018 12:08:55
Вс фев 25, 2018 14:04:06
void OLED_init(void)
{
i2c_init();
// Turn display off
sendCommand(OLED_DISPLAYOFF);
sendCommand(OLED_SETDISPLAYCLOCKDIV);
sendCommand(0x80);
sendCommand(OLED_SETMULTIPLEX);
sendCommand(0x1F);//128x32
//sendCommand(0x3F);//128x64
sendCommand(OLED_SETDISPLAYOFFSET);
sendCommand(0x00);
sendCommand(OLED_SETSTARTLINE | 0x00);//0
// We use internal charge pump
sendCommand(OLED_CHARGEPUMP);
sendCommand(0x14);
// Horizontal memory mode
sendCommand(OLED_MEMORYMODE);
sendCommand(0x00);
sendCommand(OLED_SEGREMAP | 0x1);
sendCommand(OLED_COMSCANDEC);
sendCommand(OLED_SETCOMPINS);
sendCommand(0x02);//128x32
//sendCommand(0x12);//128x64
// Max contrast
sendCommand(OLED_SETCONTRAST);
sendCommand(0xCF);//0xCF
sendCommand(OLED_SETPRECHARGE);
sendCommand(0xF1);
sendCommand(OLED_SETVCOMDETECT);
sendCommand(0x40);//0x40
sendCommand(OLED_DISPLAYALLON_RESUME);
// Non-inverted display
sendCommand(OLED_NORMALDISPLAY);
// Turn display back on
sendCommand(OLED_DISPLAYON);
}
Вс фев 25, 2018 14:17:04
Вс фев 25, 2018 18:29:50
Вс фев 25, 2018 19:56:15
0x00, 0x00, 0xF8, 0xF8, 0x98, 0x98, 0x98, 0x98, //5
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x19,
0x19, 0x19, 0x19, 0x1F, 0x0F, 0x00, 0x00, 0x00,
Вс фев 25, 2018 20:19:30
Вт янв 15, 2019 11:18:08
Пн окт 07, 2019 13:07:54
Вт окт 08, 2019 07:51:18
Вт окт 08, 2019 13:17:23
Вт окт 08, 2019 15:54:55
Вт окт 08, 2019 20:17:53
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
Вт окт 08, 2019 20:46:52
NStorm писал(а):У вас диспл к дуине к каким пинам как подключается?
NStorm писал(а):Если пин 13 будет болтаться в HIGH-Z (как он и есть по-умолчанию на INPUT), будет светик мигать.
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
Ср окт 09, 2019 06:48:59
Трогать не буду, мне он не мешает.
Хочу понять, каким образом можно сделать RESET контроллера дисплея, если он подключен по шине I2C и вывод RES# подключен к питанию?
/*!
@brief DEPRECATED constructor for I2C SSD1306 displays. Provided for
older code to maintain compatibility with the current library.
Screen size is determined by enabling one of the SSD1306_* size
defines in Adafruit_SSD1306.h. New code should NOT use this.
Only the primary I2C bus is supported.
@param rst_pin
Reset pin (using Arduino pin numbering), or -1 if not used
(some displays might be wired to share the microcontroller's
reset pin).
@return Adafruit_SSD1306 object.
@note Call the object's begin() function before use -- buffer
allocation is performed there!
*/
Adafruit_SSD1306::Adafruit_SSD1306(int8_t rst_pin) :
Adafruit_GFX(SSD1306_LCDWIDTH, SSD1306_LCDHEIGHT), spi(NULL), wire(&Wire),
buffer(NULL), mosiPin(-1), clkPin(-1), dcPin(-1), csPin(-1),
rstPin(rst_pin) {
}
/*!
@brief Constructor for I2C-interfaced SSD1306 displays.
@param w
Display width in pixels
@param h
Display height in pixels
@param twi
Pointer to an existing TwoWire instance (e.g. &Wire, the
microcontroller's primary I2C bus).
@param rst_pin
Reset pin (using Arduino pin numbering), or -1 if not used
(some displays might be wired to share the microcontroller's
reset pin).
@param clkDuring
Speed (in Hz) for Wire transmissions in SSD1306 library calls.
Defaults to 400000 (400 KHz), a known 'safe' value for most
microcontrollers, and meets the SSD1306 datasheet spec.
Some systems can operate I2C faster (800 KHz for ESP32, 1 MHz
for many other 32-bit MCUs), and some (perhaps not all)
SSD1306's can work with this -- so it's optionally be specified
here and is not a default behavior. (Ignored if using pre-1.5.7
Arduino software, which operates I2C at a fixed 100 KHz.)
@param clkAfter
Speed (in Hz) for Wire transmissions following SSD1306 library
calls. Defaults to 100000 (100 KHz), the default Arduino Wire
speed. This is done rather than leaving it at the 'during' speed
because other devices on the I2C bus might not be compatible
with the faster rate. (Ignored if using pre-1.5.7 Arduino
software, which operates I2C at a fixed 100 KHz.)
@return Adafruit_SSD1306 object.
@note Call the object's begin() function before use -- buffer
allocation is performed there!
*/
Adafruit_SSD1306::Adafruit_SSD1306(uint8_t w, uint8_t h, TwoWire *twi,
int8_t rst_pin, uint32_t clkDuring, uint32_t clkAfter) :
Adafruit_GFX(w, h), spi(NULL), wire(twi ? twi : &Wire), buffer(NULL),
mosiPin(-1), clkPin(-1), dcPin(-1), csPin(-1), rstPin(rst_pin),
wireClk(clkDuring), restoreClk(clkAfter) {
}
Ср окт 09, 2019 08:50:18
Ср дек 23, 2020 17:25:28
Чт дек 24, 2020 21:32:35
Чт дек 24, 2020 22:10:21
Пт дек 25, 2020 06:57:09