Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jwellbelove committed Dec 19, 2020
1 parent 5adb2d7 commit 4e45149
Show file tree
Hide file tree
Showing 258 changed files with 107,394 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/etl/.vscode/settings.json
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# etl-arduino
Embedded Template Library (ETL)-------------------------![GitHub release (latest by date)](https://img.shields.io/github/v/release/jwellbelove/etl-arduino)[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)![CI](https://github.com/ETLCPP/etl/workflows/vs2019/badge.svg)![CI](https://github.com/ETLCPP/etl/workflows/gcc/badge.svg)![CI](https://github.com/ETLCPP/etl/workflows/clang/badge.svg)[![Codacy Badge](https://api.codacy.com/project/badge/Grade/3c14cd918ccf40008d0bcd7b083d5946)](https://www.codacy.com/manual/jwellbelove/etl?utm_source=github.com&utm_medium=referral&utm_content=ETLCPP/etl&utm_campaign=Badge_Grade)**This repository is an Arduino compatible clone of the Embedded Template Library (ETL)**https://github.com/ETLCPP/etlSee (https://www.etlcpp.com/arduino) for up-to-date information.
Expand Down
10 changes: 10 additions & 0 deletions library.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name=Embedded Template Library (ETL)
version=19.3.5
author= John Wellbelove <[email protected]>
maintainer=John Wellbelove <[email protected]>
license=MIT
sentence=ETL. A C++ template library tailored for embedded systems.
paragraph=
category=Other
url=https://www.etlcpp.com/
architectures=*
80 changes: 80 additions & 0 deletions src/Embedded_Template_Library.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@

#ifndef ETL_EMBEDDED_TEMPLATE_LIBRARY_INCLUDED
#define ETL_EMBEDDED_TEMPLATE_LIBRARY_INCLUDED

#if defined(TEENSYDUINO)

#if defined(__AVR_ATmega32U4__)
#define ARDUINO_BOARD "Teensy 2.0"
#elif defined(__AVR_AT90USB1286__)
#define ARDUINO_BOARD "Teensy++ 2.0"
#elif defined(__MK20DX128__)
#define ARDUINO_BOARD "Teensy 3.0"
#elif defined(__MK20DX256__)
#define ARDUINO_BOARD "Teensy 3.2" // and Teensy 3.1
#elif defined(__MKL26Z64__)
#define ARDUINO_BOARD "Teensy LC"
#elif defined(__MK64FX512__)
#define ARDUINO_BOARD "Teensy 3.5"
#elif defined(__MK66FX1M0__)
#define ARDUINO_BOARD "Teensy 3.6"
#else
#error "Unknown"
#endif

#else // --------------- Arduino ------------------

#if defined(ARDUINO_AVR_ADK)
#define ARDUINO_BOARD "Mega Adk"
#elif defined(ARDUINO_AVR_BT)
#define ARDUINO_BOARD "Bt"
#elif defined(ARDUINO_AVR_DUEMILANOVE)
#define ARDUINO_BOARD "Duemilanove"
#elif defined(ARDUINO_AVR_ESPLORA)
#define ARDUINO_BOARD "Esplora"
#elif defined(ARDUINO_AVR_ETHERNET)
#define ARDUINO_BOARD "Ethernet"
#elif defined(ARDUINO_AVR_FIO)
#define ARDUINO_BOARD "Fio"
#elif defined(ARDUINO_AVR_GEMMA)
#define ARDUINO_BOARD "Gemma"
#elif defined(ARDUINO_AVR_LEONARDO)
#define ARDUINO_BOARD "Leonardo"
#elif defined(ARDUINO_AVR_LILYPAD)
#define ARDUINO_BOARD "Lilypad"
#elif defined(ARDUINO_AVR_LILYPAD_USB)
#define ARDUINO_BOARD "Lilypad Usb"
#elif defined(ARDUINO_AVR_MEGA)
#define ARDUINO_BOARD "Mega"
#elif defined(ARDUINO_AVR_MEGA2560)
#define ARDUINO_BOARD "Mega 2560"
#elif defined(ARDUINO_AVR_MICRO)
#define ARDUINO_BOARD "Micro"
#elif defined(ARDUINO_AVR_MINI)
#define ARDUINO_BOARD "Mini"
#elif defined(ARDUINO_AVR_NANO)
#define ARDUINO_BOARD "Nano"
#elif defined(ARDUINO_AVR_NG)
#define ARDUINO_BOARD "NG"
#elif defined(ARDUINO_AVR_PRO)
#define ARDUINO_BOARD "Pro"
#elif defined(ARDUINO_AVR_ROBOT_CONTROL)
#define ARDUINO_BOARD "Robot Ctrl"
#elif defined(ARDUINO_AVR_ROBOT_MOTOR)
#define ARDUINO_BOARD "Robot Motor"
#elif defined(ARDUINO_AVR_UNO)
#define ARDUINO_BOARD "Uno"
#elif defined(ARDUINO_AVR_YUN)
#define ARDUINO_BOARD "Yun"
#elif defined(ARDUINO_SAM_DUE)
#define ARDUINO_BOARD "Due"
#elif defined(ARDUINO_SAMD_ZERO)
#define ARDUINO_BOARD "Zero"
#elif defined(ARDUINO_ARC32_TOOLS)
#define ARDUINO_BOARD "101"
#else
#error "Unknown"
#endif
#endif

#endif
60 changes: 60 additions & 0 deletions src/etl/absolute.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
///\file

/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/

#ifndef ETL_ABSOLUTE_INCLUDED
#define ETL_ABSOLUTE_INCLUDED

#include "type_traits.h"

namespace etl
{
//***************************************************************************
// For signed types.
//***************************************************************************
template <typename T>
ETL_CONSTEXPR typename etl::enable_if<etl::is_signed<T>::value, T>::type
absolute(T value)
{
return (value < T(0)) ? -value : value;
}

//***************************************************************************
// For unsigned types.
//***************************************************************************
template <typename T>
ETL_CONSTEXPR typename etl::enable_if<etl::is_unsigned<T>::value, T>::type
absolute(T value)
{
return value;
}
}

#endif

Loading

0 comments on commit 4e45149

Please sign in to comment.