Skip to content

Commit

Permalink
first release
Browse files Browse the repository at this point in the history
  • Loading branch information
domoticsduino committed Sep 16, 2021
1 parent 4d0888d commit ed58cfb
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
64 changes: 64 additions & 0 deletions ddcommon.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/* 1.0.0 VERSION */

#include <Arduino.h>
#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();
}
}
22 changes: 22 additions & 0 deletions ddcommon.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* 1.0.0 VERSION */

#ifndef ddcommon_h
#define ddcommon_h

#include <Arduino.h>

#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

0 comments on commit ed58cfb

Please sign in to comment.