Skip to content

Commit

Permalink
updated examples
Browse files Browse the repository at this point in the history
  • Loading branch information
camilo committed Nov 18, 2024
1 parent 3c2ab96 commit c8800f8
Show file tree
Hide file tree
Showing 18 changed files with 71 additions and 12 deletions.
1 change: 1 addition & 0 deletions check/qlibs_cpp_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <include/mat.hpp>

using namespace std;
using namespace qlibs;

void test_fis( void );
void test_fis2( void );
Expand Down
2 changes: 2 additions & 0 deletions doc/qbitfield.dox
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
* #include <iostream>
* #include <qlibs.h>
*
* using namespace qlibs;
*
* int main( int argc, char *argv[] )
* {
* bitfield vPort; // create the bitfield instance
Expand Down
2 changes: 2 additions & 0 deletions doc/qfis.dox
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@
* #include "tipper_fis.h"
* #include <qlibs.h>
*
* using namespace qlibs;
*
* // I/O Names
* enum : fis::tag { service, food};
* enum : fis::tag { tip};
Expand Down
8 changes: 8 additions & 0 deletions doc/qltisys.dox
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
* #include <thread>
* #include <qlibs.h>
*
* using namespace qlibs;
*
* void xTaskSystemSimulate( void )
* {
* const real_t dt = 0.05f; // Time step
Expand Down Expand Up @@ -74,6 +76,8 @@
* #include <thread>
* #include <qlibs.h>
*
* using namespace qlibs;
*
* void xTaskSystemSimulate( void )
* {
* const real_t dt = 0.05f; // Time step
Expand Down Expand Up @@ -125,6 +129,8 @@
* #include <thread>
* #include <qlibs.h>
*
* using namespace qlibs;
*
* void xTaskSystemSimulate( void )
* {
* real_t num[] = { 0.1f 0.2f, 0.3f };
Expand All @@ -151,6 +157,8 @@
* #include <thread>
* #include <qlibs.h>
*
* using namespace qlibs;
*
* void xTaskSystemSimulate( void )
* {
* discreteTF<3,3> dtf= {
Expand Down
5 changes: 5 additions & 0 deletions doc/qpid.dox
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@
* #include "bsp.h"
* #include <qlibs.h>
*
* using namespace qlibs;
*
* const TickType_t dt = 50; //50mS time-step
* void xTaskPIDspeedControl( void *arg );
* real_t SetPoint = 300.0f; // desired motor speed 300rpm
Expand Down Expand Up @@ -215,6 +217,8 @@
* #include "bsp.h"
* #include <qlibs.h>
*
* using namespace qlibs;
*
* #define REF_MODEL_ORDER ( 1 )
*
* const TickType_t dt = 50; //50mS time-step
Expand Down Expand Up @@ -328,6 +332,7 @@
* #include "bsp.h"
* #include <qlibs.h>
*
* using namespace qlibs;
*
* const TickType_t dt = 50; //50mS time-step
* void xTaskPIDspeedControl( void *arg );
Expand Down
5 changes: 3 additions & 2 deletions doc/qrms.dox
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
* #include "hal_timer.h"
* #include <qlibs.h>
*
*
* using namespace qlibs;
*
* static rms rms_instance;
* static volatile real_t rms_value = 0.0f;
* static real_t window[ 8 ] = { 0.0f };
Expand Down Expand Up @@ -57,7 +58,7 @@
*
* #ifndef RMS_COMPUTE_H
* #define RMS_COMPUTE_H
*
*
* #ifdef __cplusplus
* extern "C" {
* #endif
Expand Down
2 changes: 2 additions & 0 deletions doc/qssmoother.dox
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,8 @@
* #include "AppSignalProcessing.h"
* #include <qlibs.h>
*
* using namespace qlibs;
*
* constexpr size_t SMOOTHER_WINDOW_SIZE = 10;
* constexpr uint32_t SMOOTHER_SAMPLE_TIME = 100;
* constexpr real_t GAUSS_SIGMA = 0.5f;
Expand Down
2 changes: 2 additions & 0 deletions examples/continuous_system/continuous_system.ino
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include <qlibs.h>

using namespace qlibs;

continuousTF<3> ctf= {
{ 0.0f, 2.0f, 3.0f, 6.0f },
{ 1.0f, 6.0f, 11.0f, 16.0f },
Expand Down
2 changes: 2 additions & 0 deletions examples/discrete_system/discrete_system.ino
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include <qlibs.h>

using namespace qlibs;

discreteTF<3,3> dtf= {
{ 0.1f, 0.2f, 0.3f },
{ 1.0f, -0.85f, 0.02f },
Expand Down
2 changes: 2 additions & 0 deletions examples/gaussian_smoother/gaussian_smoother.ino
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include <qlibs.h>

using namespace qlibs;

smootherGMWF filter;
constexpr real_t SMOOTHER_SAMPLE_TIME = 20; /*mS*/
int inputPin = A0; // select the input pin for the potentiometer that will drive the system
Expand Down
2 changes: 2 additions & 0 deletions examples/mamdani_tipper/mamdani_tipper.ino
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include <qlibs.h>

using namespace qlibs;

enum : fis::tag { service, food};
enum : fis::tag { tip};
// I/O Membership functions tags
Expand Down
2 changes: 2 additions & 0 deletions examples/simple_pid_controller/simple_pid_controller.ino
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include <qlibs.h>

using namespace qlibs;

continuousTF<1> processTransferFunction= {
{ 0.0f, 1.5f, },
{ 2.0f, 1.0f, },
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"maintainer": true
}
],
"version": "1.3.1",
"version": "1.3.2",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*"
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=qlibs
version=1.3.1
version=1.3.2
license=MIT
author=J. Camilo Gomez C. <[email protected]>
maintainer=J. Camilo Gomez C. <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required( VERSION 3.2 )
project( qlibs-cpp
VERSION 1.3.1
VERSION 1.3.2
DESCRIPTION "A collection of useful C++ libraries for embedded systems"
LANGUAGES CXX )

Expand Down
10 changes: 6 additions & 4 deletions src/ffmath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,7 @@ static float poly_laguerre_recursion( size_t n,
{
const float l0 = 1.0F;
float y;

/*cstat -MISRAC++2008-0-1-2_b*/
if ( 0U == n ) {
y = l0;
}
Expand All @@ -1328,7 +1328,7 @@ static float poly_laguerre_recursion( size_t n,
y = ln;
}
}

/*cstat +MISRAC++2008-0-1-2_b*/
return y;
}
/*============================================================================*/
Expand Down Expand Up @@ -1366,7 +1366,9 @@ static float poly_laguerre_hyperg( size_t n,
{
const float b = alpha + 1.0F;
const float mx = -x;
/*cstat -MISRAC++2008-0-1-2_b*/
const float tc_sgn = ( x < 0.0F ) ? 1.0F : ( ( 1 == ( n % 2 ) ) ? -1.0F : 1.0F );
/*cstat +MISRAC++2008-0-1-2_b*/
const float ax = absolute( x );
float tc = 1.0F;

Expand Down Expand Up @@ -2017,7 +2019,7 @@ static float expint_Ei_asymp( float x )
static float expint_E1( float x )
{
float y;

/*cstat -MISRAC++2008-0-1-2_b*/
if ( x < 0.0F ) {
y = -expint_Ei( -x );
}
Expand All @@ -2030,7 +2032,7 @@ static float expint_E1( float x )
else {
y = expint_E1_asymp( x );
}

/*cstat +MISRAC++2008-0-1-2_b*/
return y;
}
/*============================================================================*/
Expand Down
2 changes: 2 additions & 0 deletions src/fp16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,9 @@ fp16Raw_t fp16::sqrt( fp16Raw_t x ) noexcept
x <<= 16;
retValue <<= 16;
}
/*cstat -ATH-shift-bounds -MISRAC++2008-5-8-1 -CERT-INT34-C_b*/
bit = 1U << 14U;
/*cstat +ATH-shift-bounds +MISRAC++2008-5-8-1 +CERT-INT34-C_b*/
}
}
}
Expand Down
30 changes: 27 additions & 3 deletions src/qlibs.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ This file is part of the QuarkTS++ OS distribution.
#ifndef QLIBS_CPP_H
#define QLIBS_CPP_H

#define QLIBS_CPP_VERSION "1.3.1"
#define QLIBS_CPP_VERNUM ( 131 )
#define QLIBS_CPP_VERSION "1.3.2"
#define QLIBS_CPP_VERNUM ( 132 )
#define QLIBS_CPP_CAPTION "qLibs++" QLIBS_CPP_VERSION

#include <include/qlibs_types.hpp>
Expand All @@ -60,6 +60,30 @@ This file is part of the QuarkTS++ OS distribution.
#include <include/interp1.hpp>
#include <include/algorithm.hpp>

using namespace qlibs;
namespace qlibs {
namespace build {
constexpr const uint32_t number = 2351;
constexpr const char* date = __DATE__;
constexpr const char* time = __TIME__;
constexpr const char* std = "c++11";
}
namespace version {
constexpr const char* str = QLIBS_CPP_VERSION;
constexpr const uint8_t number = QLIBS_CPP_VERNUM;
constexpr const uint8_t mayor = 1U;
constexpr const uint8_t minor = 3U;
constexpr const uint8_t rev = 2U;
}
namespace product {
constexpr const char* author = "J. Camilo Gomez C.";
constexpr const char* copyright = "Copyright (C) 2012 J. Camilo Gomez C. All Rights Reserved.";
constexpr const char* name = "qLibs++";
constexpr const char* category = "Library";
constexpr const char* caption = QLIBS_CPP_CAPTION;
constexpr const char* compliance = "MISRAC++2008,SEI-CERT";
constexpr const char* license = "MIT";
constexpr const char* source_model = "Open Source";
}
};

#endif /*QOS_CPP_H*/

0 comments on commit c8800f8

Please sign in to comment.