diff --git a/AP-Remote-Software/ArduinoPilotNano433WindNGSoftSerial/ArduinoPilotNano433WindNGSoftSerial.ino b/AP-Remote-Software/ArduinoPilotNano433WindNGSoftSerial/ArduinoPilotNano433WindNGSoftSerial.ino index 395f5c0..3c0101e 100644 --- a/AP-Remote-Software/ArduinoPilotNano433WindNGSoftSerial/ArduinoPilotNano433WindNGSoftSerial.ino +++ b/AP-Remote-Software/ArduinoPilotNano433WindNGSoftSerial/ArduinoPilotNano433WindNGSoftSerial.ino @@ -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 #include @@ -22,23 +24,33 @@ #include // May impact the display .... #include -#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 -#define SCREEN_WIDTH 128 // OLED display width, in pixels -#define SCREEN_HEIGHT 64 // OLED display height, in pixels +// 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 +#define Auto_Standby_Support 1 // Set this to 1 to support Standby and Auto for Key 5 and 6 -#define KEY_DELAY 300 // 300 ms break between keys -#define BEEP_DURATION 150 // 150 ms beep time +#define KEY_DELAY 300 // 300 ms break between keys +#define BEEP_DURATION 150 // 150 ms beep time #define DEBUG @@ -83,11 +95,10 @@ unsigned long key_time = 0; // time of last key detected unsigned long beep_time = 0; // timer for beep duration bool beep_status = false; -uint32_t value_rf = 0; +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");