oled_config.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef __OLED_CONFIG_H
  2. #define __OLED_CONFIG_H
  3. // Интерфейс экрана
  4. //#define I2C_BRIDGE
  5. // Интерфейс экрана
  6. #define SPI_BRIDGE
  7. #define OLED_RST_PIN GPIO_PIN_5
  8. #define OLED_RST_PORT GPIOA
  9. #define OLED_DC_PIN GPIO_PIN_6
  10. #define OLED_DC_PORT GPIOA
  11. #define OLED_CS_PIN GPIO_PIN_7
  12. #define OLED_CS_PORT GPIOA
  13. #define OLED_RST_0 HAL_GPIO_WritePin(OLED_RST_PORT, OLED_RST_PIN, GPIO_PIN_RESET)
  14. #define OLED_RST_1 HAL_GPIO_WritePin(OLED_RST_PORT, OLED_RST_PIN, GPIO_PIN_SET)
  15. #define OLED_DC_0 HAL_GPIO_WritePin(OLED_DC_PORT, OLED_DC_PIN, GPIO_PIN_RESET)
  16. #define OLED_DC_1 HAL_GPIO_WritePin(OLED_DC_PORT, OLED_DC_PIN, GPIO_PIN_SET)
  17. #define OLED_CS_0 HAL_GPIO_WritePin(OLED_CS_PORT, OLED_CS_PIN, GPIO_PIN_RESET)
  18. #define OLED_CS_1 HAL_GPIO_WritePin(OLED_CS_PORT, OLED_CS_PIN, GPIO_PIN_SET)
  19. // SPI settings
  20. #define OLED_SPI_SCK_PORT GPIOB
  21. #define OLED_SPI_SCK_PIN GPIO_PIN_13
  22. #define OLED_SPI_SCK_AF GPIO_AF5_SPI2
  23. #define OLED_SPI_CS_PORT GPIOB
  24. #define OLED_SPI_CS_PIN GPIO_PIN_12
  25. #define OLED_SPI_MOSI_PORT GPIOB
  26. #define OLED_SPI_MOSI_PIN GPIO_PIN_15
  27. #define OLED_SPI_MOSI_AF GPIO_AF5_SPI2
  28. #define OLED_SPI_MISO_PORT GPIOB
  29. #define OLED_SPI_MISO_PIN GPIO_PIN_14
  30. #define OLED_SPI_MISO_AF GPIO_AF5_SPI2
  31. // OLED settings
  32. #define OLED_I2C_ADDR 0x7A
  33. #define OLED_HEIGHT 128
  34. #define OLED_WIDTH 128
  35. #define OLED_BUF_SIZE 8192 // OLED_HEIGHT * OLED_WIDTH / 2
  36. #endif // __OLED_CONFIG_H