From ed58cfb0c0e46c6faa8c3d9db4d8e50f6c0c12c8 Mon Sep 17 00:00:00 2001 From: Domoticsduino Date: Fri, 17 Sep 2021 00:06:53 +0200 Subject: [PATCH] first release --- README.md | 4 ++-- ddcommon.cpp | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++ ddcommon.h | 22 ++++++++++++++++++ 3 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 ddcommon.cpp create mode 100644 ddcommon.h diff --git a/README.md b/README.md index ad584e9..4d78e47 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# smarthome-fw-lib-ddcommon -Library with common functions for all projects +# Smarthome firmware library for ESP8266 - DDCommon +Library with common functions for all projects based on ESP8266 board diff --git a/ddcommon.cpp b/ddcommon.cpp new file mode 100644 index 0000000..0d2228c --- /dev/null +++ b/ddcommon.cpp @@ -0,0 +1,64 @@ +/* 1.0.0 VERSION */ + +#include +#include "ddcommon.h" + +void writeToSerial(String msg, bool nl) +{ + if (SERIAL_ENABLED) + { + Serial.print(msg); + if (nl) + Serial.println(); + } +} + +void writeToSerial(const char *msg, bool nl) +{ + if (SERIAL_ENABLED) + { + Serial.print(msg); + if (nl) + Serial.println(); + } +} + +void writeToSerial(float msg, bool nl) +{ + if (SERIAL_ENABLED) + { + Serial.print(msg); + if (nl) + Serial.println(); + } +} + +void writeToSerial(int msg, bool nl) +{ + if (SERIAL_ENABLED) + { + Serial.print(msg); + if (nl) + Serial.println(); + } +} + +void writeToSerial(unsigned int msg, bool nl) +{ + if (SERIAL_ENABLED) + { + Serial.print(msg); + if (nl) + Serial.println(); + } +} + +void writeToSerial(double msg, bool nl) +{ + if (SERIAL_ENABLED) + { + Serial.print(msg); + if (nl) + Serial.println(); + } +} diff --git a/ddcommon.h b/ddcommon.h new file mode 100644 index 0000000..4dcd302 --- /dev/null +++ b/ddcommon.h @@ -0,0 +1,22 @@ +/* 1.0.0 VERSION */ + +#ifndef ddcommon_h +#define ddcommon_h + +#include + +#define SERIAL_ENABLED false + +void writeToSerial(String, bool); + +void writeToSerial(const char *, bool); + +void writeToSerial(float, bool); + +void writeToSerial(int, bool); + +void writeToSerial(unsigned int, bool); + +void writeToSerial(double, bool); + +#endif \ No newline at end of file