oLED.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // 1-channel LoRa Gateway for ESP8266
  2. // Copyright (c) 2016-2020 Maarten Westenberg version for ESP8266
  3. //
  4. // based on work done by Thomas Telkamp for Raspberry PI 1ch gateway
  5. // and many others.
  6. //
  7. // All rights reserved. This program and the accompanying materials
  8. // are made available under the terms of the MIT License
  9. // which accompanies this distribution, and is available at
  10. // https://opensource.org/licenses/mit-license.php
  11. //
  12. // NO WARRANTY OF ANY KIND IS PROVIDED
  13. //
  14. // Author: Maarten Westenberg (mw12554@hotmail.com)
  15. //
  16. // This file contains a number of compile-time settings and definitions for OLED support.
  17. //
  18. // ----------------------------------------------------------------------------------------
  19. // OLEDs supported by this program must be I2C.
  20. // This is because we do not want any disturbance in the SPI area
  21. // which is also interfacing the LORA tranceiver.
  22. //
  23. // The following OLEDs are supported:
  24. // 0. No OLED connected
  25. // 1. 0.9" OLED (cheap)
  26. // 2. 1.3" OLED with much better and larger display
  27. // 4. TTGO board
  28. #if OLED>=1 // If OLED is used
  29. // ----------------------------------------------------------------------------------------
  30. // Define the different PIN's used for SCL/SDA for each arch.
  31. //
  32. #if _PIN_OUT==1 // HALLARD
  33. #define OLED_SCL 5 // GPIO5 / D1
  34. #define OLED_SDA 4 // GPIO4 / D2
  35. #elif _PIN_OUT==2 // COMRESULT
  36. #define OLED_SCL 0 // GPIO0 / D3
  37. #define OLED_SDA 2 // GPIO2 / D4
  38. #elif _PIN_OUT==4 // TTGO (onboard version used, also for DIY)
  39. #define OLED_SCL 15 // GPIO15 /
  40. #define OLED_SDA 4 // GPIO4 /
  41. #define OLED_RST 16 // Reset pin (Some OLED displays do not have it)
  42. #elif _PIN_OUT==5 // TTGO with external OLED
  43. #define OLED_SCL 22 // GPIO22 / SCL
  44. #define OLED_SDA 21 // GPIO21 / SDA
  45. #define OLED_RST 16 // Reset pin (Some OLED displays do not have it)
  46. #endif
  47. // ----------------------------------------------------------------------------------------
  48. // Define the different OLED versions
  49. //
  50. #if OLED==1
  51. #include "SSD1306.h"
  52. #define OLED_ADDR 0x3C // Default 0x3C for 0.9", for 1.3" it is 0x78
  53. SSD1306 display(OLED_ADDR, OLED_SDA, OLED_SCL);// i2c ADDR & SDA, SCL on wemos
  54. #endif
  55. // This is an 1.3" OLED display which is running on I2C
  56. #if OLED==2
  57. #include "SH1106.h"
  58. #define OLED_ADDR 0x3C // Default 0x3C for 1.3" SH1106
  59. SH1106 display(OLED_ADDR, OLED_SDA, OLED_SCL); // i2c ADDR & SDA, SCL on wemos
  60. #endif
  61. #endif//OLED>=1