From 78450e9e6a1e91a6c7b3cfa5fad9e69b96223bf0 Mon Sep 17 00:00:00 2001 From: mattmcw Date: Sat, 4 Mar 2023 18:52:51 -0500 Subject: [PATCH] Add mcopy_serial library --- ino/lib/mcopy_serial/mcopy_serial.cpp | 20 ++++++++++++++++++++ ino/lib/mcopy_serial/mcopy_serial.h | 20 ++++++++++++++++++++ ino/mcopy_cam_canon/.gitignore | 3 ++- ino/mcopy_cam_canon/mcopy_cam_canon.ino | 1 + ino/mcopy_cam_canon/mcopy_serial.cpp | 1 + ino/mcopy_cam_canon/mcopy_serial.h | 1 + 6 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 ino/lib/mcopy_serial/mcopy_serial.cpp create mode 100644 ino/lib/mcopy_serial/mcopy_serial.h create mode 120000 ino/mcopy_cam_canon/mcopy_serial.cpp create mode 120000 ino/mcopy_cam_canon/mcopy_serial.h diff --git a/ino/lib/mcopy_serial/mcopy_serial.cpp b/ino/lib/mcopy_serial/mcopy_serial.cpp new file mode 100644 index 0000000..03e30e8 --- /dev/null +++ b/ino/lib/mcopy_serial/mcopy_serial.cpp @@ -0,0 +1,20 @@ +#include "mcopy_serial.h" + +void McopySerial::begin (int baudRate) { + baud = baudRate; + begin(); +} + +void McopySerial::begin () { + +} + +void McopySerial::debug (bool state) { + debugOn = state; +} + +void McopySerial::log (String message) { + if (debugOn) { + Serial.println(message); + } +} \ No newline at end of file diff --git a/ino/lib/mcopy_serial/mcopy_serial.h b/ino/lib/mcopy_serial/mcopy_serial.h new file mode 100644 index 0000000..de3c700 --- /dev/null +++ b/ino/lib/mcopy_serial/mcopy_serial.h @@ -0,0 +1,20 @@ +#ifndef MCOPY_SERIAL +#define MCOPY_SERIAL + +#include "Arduino.h" + +class McopySerial { + + private: + volatile int baud = 57600; + volatile bool debugOn = false; + + public: + void begin(); + void begin(int baudRate); + + void debug (bool state); + void log (String message); +}; + +#endif \ No newline at end of file diff --git a/ino/mcopy_cam_canon/.gitignore b/ino/mcopy_cam_canon/.gitignore index 0a5cc89..4fee890 100644 --- a/ino/mcopy_cam_canon/.gitignore +++ b/ino/mcopy_cam_canon/.gitignore @@ -1 +1,2 @@ -debug* \ No newline at end of file +debug* +bin diff --git a/ino/mcopy_cam_canon/mcopy_cam_canon.ino b/ino/mcopy_cam_canon/mcopy_cam_canon.ino index 6512073..a0a9283 100644 --- a/ino/mcopy_cam_canon/mcopy_cam_canon.ino +++ b/ino/mcopy_cam_canon/mcopy_cam_canon.ino @@ -17,6 +17,7 @@ #include "CanonBLERemote.h" #include #include "TickTwo.h" +#include "mcopy_serial.h" #define LOG_LOCAL_LEVEL ESP_LOG_INFO #include "esp_log.h" diff --git a/ino/mcopy_cam_canon/mcopy_serial.cpp b/ino/mcopy_cam_canon/mcopy_serial.cpp new file mode 120000 index 0000000..d09c529 --- /dev/null +++ b/ino/mcopy_cam_canon/mcopy_serial.cpp @@ -0,0 +1 @@ +ino/lib/mcopy_serial/mcopy_serial.cpp \ No newline at end of file diff --git a/ino/mcopy_cam_canon/mcopy_serial.h b/ino/mcopy_cam_canon/mcopy_serial.h new file mode 120000 index 0000000..15f2d9f --- /dev/null +++ b/ino/mcopy_cam_canon/mcopy_serial.h @@ -0,0 +1 @@ +ino/lib/mcopy_serial/mcopy_serial.h \ No newline at end of file