Skip to content

Commit 521fa8a

Browse files
author
camilo
committed
bump to 1.3.5
1 parent d97fec5 commit 521fa8a

File tree

7 files changed

+55
-12
lines changed

7 files changed

+55
-12
lines changed

check/qlibs_cpp_test.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,7 @@ void test_ltisys( void )
268268
{ 0.0f, 2.0f, 3.0f, 6.0f },
269269
{ 1.0f, 6.0f, 11.0f, 16.0f },
270270
};
271-
transportDelay<delayFromTime(1.3f, dt )> delay;
272-
273-
271+
transportDelay< (1.3_td,dt) > delay;
274272
continuousSystem gc( ctf, dt );
275273

276274
real_t t = 0.0;

examples/continuous_system/continuous_system.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ continuousTF<3> ctf= {
66
{ 0.0f, 2.0f, 3.0f, 6.0f },
77
{ 1.0f, 6.0f, 11.0f, 16.0f },
88
};
9-
real_t dt = 0.05f;
9+
constexpr real_t dt = 0.05f;
1010
continuousSystem gc( ctf, dt );
1111

1212
int inputPin = A0; // select the input pin for the potentiometer that will drive the system

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"maintainer": true
1717
}
1818
],
19-
"version": "1.3.4",
19+
"version": "1.3.5",
2020
"license": "MIT",
2121
"frameworks": "arduino",
2222
"platforms": "*"

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=qlibs
2-
version=1.3.4
2+
version=1.3.5
33
license=MIT
44
author=J. Camilo Gomez C. <[email protected]>
55
maintainer=J. Camilo Gomez C. <[email protected]>

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required( VERSION 3.2 )
22
project( qlibs-cpp
3-
VERSION 1.3.4
3+
VERSION 1.3.5
44
DESCRIPTION "A collection of useful C++ libraries for embedded systems"
55
LANGUAGES CXX )
66

src/include/ltisys.hpp

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,33 @@ namespace qlibs {
8282
}
8383
};
8484

85+
86+
struct timeDelay {
87+
real_t value;
88+
constexpr explicit timeDelay(real_t v) : value(v) {}
89+
/** @cond **/
90+
constexpr size_t operator()(const real_t dt) const {
91+
return static_cast<size_t>((value / dt) + 0.5f);
92+
}
93+
constexpr size_t operator[](const real_t dt) const {
94+
return static_cast<size_t>((value / dt) + 0.5f);
95+
}
96+
/** @endcond **/
97+
};
98+
/** @cond **/
99+
constexpr timeDelay operator"" _td(long double v) {
100+
return timeDelay(static_cast<real_t>(v));
101+
}
102+
103+
constexpr size_t operator,(const timeDelay td, const real_t dt) {
104+
return static_cast<size_t>( ( td.value/dt ) + 0.5_re );
105+
}
106+
107+
constexpr size_t operator+(const timeDelay td, const real_t dt) {
108+
return static_cast<size_t>( ( td.value/dt ) + 0.5_re );
109+
}
110+
/** @endcond **/
111+
85112
/**
86113
* @brief Computes the number of discrete delays required for a specified
87114
* amount of time using a defined time-step.
@@ -96,6 +123,20 @@ namespace qlibs {
96123
return static_cast<size_t>( ( Time/dt ) + 0.5_re );
97124
}
98125

126+
/**
127+
* @brief Computes the number of discrete delays required for a specified
128+
* amount of time using a defined time-step.
129+
* @see transportDelay
130+
* @param[in] Time The amount of time to delay
131+
* @param[in] dt The time step
132+
* @return The number of discrete delays required to delay @a Time seconds
133+
* using the time step @a dt
134+
*/
135+
constexpr size_t delayFromTime( const timeDelay Time, const real_t dt )
136+
{
137+
return static_cast<size_t>( ( Time.value/dt ) + 0.5_re );
138+
}
139+
99140
/**
100141
* @brief Delays the input by a specified amount of time. You can use this
101142
* class to simulate a time delay.
@@ -134,6 +175,10 @@ namespace qlibs {
134175
delay.insertSample( xInput );
135176
return delay.getOldest();
136177
}
178+
179+
constexpr size_t getNumberOfDelays() const noexcept {
180+
return numberOfDelays;
181+
}
137182
};
138183

139184
/**

src/qlibs.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ This file is part of the QuarkTS++ OS distribution.
4141
#ifndef QLIBS_CPP_H
4242
#define QLIBS_CPP_H
4343

44-
#define QLIBS_CPP_VERSION "1.3.4"
45-
#define QLIBS_CPP_VERNUM ( 134 )
46-
#define QLIBS_CPP_CAPTION "qLibs++" QLIBS_CPP_VERSION
44+
#define QLIBS_CPP_VERSION "1.3.5"
45+
#define QLIBS_CPP_VERNUM ( 135 )
46+
#define QLIBS_CPP_CAPTION "qLibs++ " QLIBS_CPP_VERSION
4747

4848
#include <include/qlibs_types.hpp>
4949
#include <include/tdl.hpp>
@@ -62,7 +62,7 @@ This file is part of the QuarkTS++ OS distribution.
6262

6363
namespace qlibs {
6464
namespace build {
65-
constexpr const uint32_t number = 2374;
65+
constexpr const uint32_t number = 2382;
6666
constexpr const char* date = __DATE__;
6767
constexpr const char* time = __TIME__;
6868
constexpr const char* std = "c++11";
@@ -72,7 +72,7 @@ This file is part of the QuarkTS++ OS distribution.
7272
constexpr const uint8_t number = QLIBS_CPP_VERNUM;
7373
constexpr const uint8_t mayor = 1U;
7474
constexpr const uint8_t minor = 3U;
75-
constexpr const uint8_t rev = 4U;
75+
constexpr const uint8_t rev = 5U;
7676
}
7777
namespace product {
7878
constexpr const char* author = "J. Camilo Gomez C.";

0 commit comments

Comments
 (0)