Вс фев 25, 2018 12:08:55
Вс фев 25, 2018 14:04:06
#define OLED_DEFAULT_ADDRESS 0x78
#define OLED_SETCONTRAST 0x81
#define OLED_DISPLAYALLON_RESUME 0xA4
#define OLED_DISPLAYALLON 0xA5
#define OLED_NORMALDISPLAY 0xA6
#define OLED_INVERTDISPLAY 0xA7
#define OLED_DISPLAYOFF 0xAE
#define OLED_DISPLAYON 0xAF
#define OLED_SETDISPLAYOFFSET 0xD3
#define OLED_SETCOMPINS 0xDA
#define OLED_SETVCOMDETECT 0xDB
#define OLED_SETDISPLAYCLOCKDIV 0xD5
#define OLED_SETPRECHARGE 0xD9
#define OLED_SETMULTIPLEX 0xA8
#define OLED_SETLOWCOLUMN 0x00
#define OLED_SETHIGHCOLUMN 0x10
#define OLED_SETSTARTLINE 0x40
#define OLED_MEMORYMODE 0x20
#define OLED_COLUMNADDR 0x21
#define OLED_PAGEADDR 0x22
#define OLED_COMSCANINC 0xC0
#define OLED_COMSCANDEC 0xC8
#define OLED_SEGREMAP 0xA0
#define OLED_CHARGEPUMP 0x8D
#define OLED_SWITCHCAPVCC 0x2
#define OLED_NOP 0xE3
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
unsigned char const PROGMEM init[18]=
{
0xA8,0x3F,0xD3,0x00,0x40,0xA1,0xC8,0xDA,0x02,
0x81,0x7F,0xA4,0xA6,0xD5,0x80,0x8D,0x14,0xAF,
};
Вс фев 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
// Defines controlling timing limits
#define TWI_FAST_MODE
//max Fck/2
#define SYS_CLK 4000.0 // [kHz]
//#define SYS_CLK 1000.0 // [kHz] ATtiny2313
#ifdef TWI_FAST_MODE // TWI FAST mode timing limits. SCL = 100-400kHz
#define T2_TWI ((SYS_CLK *1300) /1000000) +1 // >1,3us
#define T4_TWI ((SYS_CLK * 600) /1000000) +1 // >0,6us
#else // TWI STANDARD mode timing limits. SCL <= 100kHz
#define T2_TWI ((SYS_CLK *4700) /1000000) +1 // >4,7us
#define T4_TWI ((SYS_CLK *4000) /1000000) +1 // >4,0us
#endif
// Defines controling code generating
//#define PARAM_VERIFICATION
//#define NOISE_TESTING
#define SIGNAL_VERIFY
//USI_TWI messages and flags and bit masks
//#define SUCCESS 7
//#define MSG 0
0xAE, // Выключить дисплей
0xD5, // Настройка частоты обновления дисплея
0x80,
///+----- делитель 0-F/ 0 - деление на 1
//+------ частота генератора. по умочанию 0x80
0xA8, // Установить multiplex ratio
0x1F, // 1/64 duty (значение по умолчанию), 0x1F - 128x32, 0x3F - 128x64
0xD3, // Смещение дисплея (offset)
0x00, // Нет смещения
0x40, // Начала строки начала разверки 0x40 с начала RAM
0x8D, // Управление внутреним преобразователем
0x14, // 0x10 - отключить (VCC подается извне) 0x14 - запустить внутрений DC/DC
0x20, // Режим автоматической адресации
0x00, // 0-по горизонтали с переходом на новую страницу (строку)
// 1 - по вертикали с переходом на новую строку
// 2 - только по выбранной странице без перехода
0xA1, // Режим разверки по странице (по X)
// A1 - нормальный режим (слева/направо) A0 - обратный (справа/налево)
0xC8, // Режим сканирования озу дисплея
// для изменения системы координат
// С0 - снизу/верх (начало нижний левый угол)
// С8 - сверху/вниз (начало верний левый угол)
0xDA, // Аппаратная конфигурация COM
0x02, // 0x02 - 128x32, 0x12 - 128x64
0x81, // Установка яркости дисплея
0xСF, // 0x8F..0xCF
0xD9, // Настройка фаз DC/DC преоразователя
0xF1, // 0x22 - VCC подается извне / 0xF1 для внутренего
0xDB, // Установка уровня VcomH
0x40, // Влияет на яркость дисплея 0x00..0x70
0xA4, // Режим нормальный
0xA6, // 0xA6 - нет инверсии, 0xA7 - инверсия дисплея
0xAF // Дисплей включен
Вт окт 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