Add Schematics - Formating Code

This commit is contained in:
2021-03-24 14:39:37 +01:00
parent dbc9ea571a
commit ef5e0f8792

View File

@@ -12,7 +12,9 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// Version 1.5, 16.12.2020, AK-Homberger
// Based on the AK-Homberger work
// By Laurent D.
// Version 1.0
#include <avr/pgmspace.h>
#include <SPI.h>
@@ -22,18 +24,28 @@
#include <RCSwitch.h> // May impact the display ....
#include <SoftwareSerial.h>
#define PIN_SOFTSERIAL_RX 3
#define PIN_SOFTSERIAL_TX 4
#define PIN_RF_433 0 // THIS IS THE INTERUPT. 0 = pin2
#define PIN_LED 6
#define PIN_BUZZ 7
/* PINNOUT */
#define I2C_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
// Definition Value // ATMEGA HW PIN // GPIO // Role
// ================================== // =============== // ==== // =========
// Hardware SERIAL RX // ATMEGA328 #2 // // SeaTalk
// Hardware SERIAL TX // ATMEGA328 #3 // // SeaTalk
#define PIN_SOFTSERIAL_RX 3 // ATMEGA328 #5 // 3 // Debug Serial RW
#define PIN_SOFTSERIAL_TX 4 // ATMEGA328 #6 // 4 // Debug Serial TX
#define PIN_RF_433 0 // ATMEGA328 #4 // 2 // Interrupt 0 , RF433 Input Data
#define PIN_LED 6 // ATMEGA328 #12 // 6 // LED PIN
#define PIN_BUZZ 7 // ATMEGA328 #13 // 7 // Buzzer PIN
// SSD1306 SCL // ATMEGA328 #28 // // oled SSD1306 SCL Pin
// SSD1306 SDA // ATMEGA328 #27 // // oled SSD1306 SDA Pin
/* OTHER CONFIGS */
#define I2C_ADDRESS 0x3C // Addresses can be 0x3D OR 0x3C depending of manufacturer
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define RST_PIN -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SSD1306_RST_PIN -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define Auto_Standby_Support 1 // Set this to 1 to support Standby and Auto for Key 5 and 6
@@ -87,7 +99,6 @@ uint32_t value_rf = 0;
char AWS[4];
RCSwitch mySwitch = RCSwitch();
SSD1306AsciiWire oled;
SoftwareSerial SerialSoft(PIN_SOFTSERIAL_RX, PIN_SOFTSERIAL_TX); // RX, TX
@@ -234,11 +245,11 @@ void setup() {
Wire.begin();
Wire.setClock(400000L);
#if RST_PIN >= 0
oled.begin(&Adafruit128x64, I2C_ADDRESS, RST_PIN);
#else // RST_PIN >= 0
#if SSD1306_RST_PIN >= 0
oled.begin(&Adafruit128x64, I2C_ADDRESS, SSD1306_RST_PIN);
#else // SSD1306_RST_PIN >= 0
oled.begin(&Adafruit128x64, I2C_ADDRESS);
#endif // RST_PIN >= 0
#endif // SSD1306_RST_PIN >= 0
oled.setFont(Cooper19);
oled.clear();
oled.println("Starting");