oLED.h 2.5 KB

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