| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- #ifndef __OLED_CONFIG_H
- #define __OLED_CONFIG_H
- // Интерфейс экрана
- #define I2C_BRIDGE
- // Интерфейс экрана
- //#define SPI_BRIDGE
- #define OLED_RST_PIN GPIO_PIN_5
- #define OLED_RST_PORT GPIOA
- #define OLED_DC_PIN GPIO_PIN_6
- #define OLED_DC_PORT GPIOA
- #define OLED_RST_0 HAL_GPIO_WritePin(OLED_RST_PORT, OLED_RST_PIN, GPIO_PIN_RESET)
- #define OLED_RST_1 HAL_GPIO_WritePin(OLED_RST_PORT, OLED_RST_PIN, GPIO_PIN_SET)
- #define OLED_DC_0 HAL_GPIO_WritePin(OLED_DC_PORT, OLED_DC_PIN, GPIO_PIN_RESET)
- #define OLED_DC_1 HAL_GPIO_WritePin(OLED_DC_PORT, OLED_DC_PIN, GPIO_PIN_SET)
- #define OLED_CS_0 HAL_GPIO_WritePin(OLED_SPI_CS_PORT, OLED_SPI_CS_PIN, GPIO_PIN_RESET)
- #define OLED_CS_1 HAL_GPIO_WritePin(OLED_SPI_CS_PORT, OLED_SPI_CS_PIN, GPIO_PIN_SET)
- // SPI settings
- #define OLED_SPI_SCK_PORT GPIOB
- #define OLED_SPI_SCK_PIN GPIO_PIN_13
- #define OLED_SPI_SCK_AF GPIO_AF5_SPI2
- #define OLED_SPI_CS_PORT GPIOB
- #define OLED_SPI_CS_PIN GPIO_PIN_12
- #define OLED_SPI_MOSI_PORT GPIOB
- #define OLED_SPI_MOSI_PIN GPIO_PIN_15
- #define OLED_SPI_MOSI_AF GPIO_AF5_SPI2
- #define OLED_SPI_MISO_PORT GPIOB
- #define OLED_SPI_MISO_PIN GPIO_PIN_14
- #define OLED_SPI_MISO_AF GPIO_AF5_SPI2
- // OLED settings
- #define OLED_I2C_ADDR 0x7A
- #define OLED_HEIGHT 128
- #define OLED_WIDTH 128
- #define OLED_BUF_SIZE 8192 // OLED_HEIGHT * OLED_WIDTH / 2
- #define SSD1327_SETCOLUMNADDRESS 0x15
- #define SSD1327_SETROWADDRESS 0x75
- #define SSD1327_SETCONTRASTCURRENT 0x81
- #define SSD1327_NOP 0x84
- #define SSD1327_SEGREMAP 0xA0
- #define SSD1327_SETDISPLAYSTARTLINE 0xA1
- #define SSD1327_SETDISPLAYOFFSET 0xA2
- #define SSD1327_DISPLAYALLON_RESUME 0xA4
- #define SSD1327_DISPLAYALLON 0xA5
- #define SSD1327_NORMALDISPLAY 0xA6
- #define SSD1327_INVERTDISPLAY 0xA7
- #define SSD1327_SETMULTIPLEX 0xA8
- #define SSD1327_FUNCTIONSELECTIONA 0xAB
- #define SSD1327_DISPLAYOFF 0xAE
- #define SSD1327_DISPLAYON 0xAF
- #define SSD1327_SETPHASELENGTH 0xB1
- #define SSD1327_SETFRONTCLOCKDIVIDER_OSCILLATORFREQUENCY 0xB3
- #define SSD1327_SETGPIO 0xB5
- #define SSD1327_SETSECONDPRECHARGEPERTIOD 0xB6
- #define SSD1327_SETGRAYSCALETABLE 0xB8
- #define SSD1327_SELECTDEFAULTLINEARGRAYSCALETABLE 0xB9
- #define SSD1327_SETPRECHARGEVOLTAGE 0xBC
- #define SSD1327_SETSETVCOMVOLTAGE 0xBE
- #define SSD1327_FUNCTIONSELECTIONB 0xD5
- #define SSD1327_SETCOMMANDLOCK 0xFD
- //
- // Scrolling #defines
- //
- #define SSD1327_ACTIVATE_SCROLL 0x2F
- #define SSD1327_DEACTIVATE_SCROLL 0x2E
- #define SSD1327_RIGHT_HORIZONTAL_SCROLL 0x26
- #define SSD1327_LEFT_HORIZONTAL_SCROLL 0x27
- // Colors
- #define BLACK 0
- #define WHITE 15
- // Scrolling enums
- typedef enum
- {
- SCROLL_EVERY_5_FRAMES,
- SCROLL_EVERY_64_FRAMES,
- SCROLL_EVERY_128_FRAMES,
- SCROLL_EVERY_256_FRAMES,
- SCROLL_EVERY_3_FRAMES,
- SCROLL_EVERY_4_FRAMES,
- SCROLL_EVERY_25_FRAMES,
- SCROLL_EVERY_2_FRAMES,
- } scroll_horizontal_speed;
- // -----------------------------------------------------------------------------
- // Настройки меню
- // Высота строки в меню настроек
- #define MENU_STR_HEIGHT 16
- #define MENU_OFF_BETWEEN_DOUBLE_STR 4
- // Координата Y первой и остальных строк в меню настроек
- #define MENU_1_STR_Y 6
- #define MENU_2_STR_Y (MENU_1_STR_Y + MENU_STR_HEIGHT)
- #define MENU_3_STR_Y (MENU_1_STR_Y + 2*MENU_STR_HEIGHT)
- #define MENU_4_STR_Y (MENU_1_STR_Y + 3*MENU_STR_HEIGHT)
- #define MENU_5_STR_Y (MENU_1_STR_Y + 4*MENU_STR_HEIGHT)
- #define MENU_6_STR_Y (MENU_1_STR_Y + 5*MENU_STR_HEIGHT)
- #endif // __OLED_CONFIG_H
|