Use etl::clamp for setting value in cyclic_value (#1104)

* Add Zephyr build system module.yml (#1074)

The Zephyr build system requires that modules have a `module.yml` file to specify where the module cmake and kconfig files are located. 
These can also be explicitly set as "external" meaning that they do not exist within the module tree, itself. These build file can still be specified elsewhere via cmake variables, explained more in-depth here: https://docs.zephyrproject.org/latest/develop/modules.html#modules-module-ext-root
This change makes it such that ETL can be included more easily in zephyr projects running on embedded systems. A similar change can be observed in the public nanopb repository, where the repo only requires its own `zephyr/module.yml` file to be found by the zephyr build system, but the kconfig and cmake additions can exist outside of the library repository.

* Add full West support for ETL (#1075)

This will allow ETL to be included via west in a zephyr build without any additional wrappers or external kconfigs.

Signed-off-by: Zach Van Camp <zach.vancamp@etcconnect.com>
Co-authored-by: Zach Van Camp <zach.vancamp@etcconnect.com>

* refactor: use etl::clamp for clamping the set value

---------

Signed-off-by: Zach Van Camp <zach.vancamp@etcconnect.com>
Co-authored-by: Zach Van Camp <marshmilo100@gmail.com>
Co-authored-by: Zach Van Camp <zach.vancamp@etcconnect.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
This commit is contained in:
Drew Rife 2025-05-21 07:29:07 -04:00 committed by GitHub
parent 95a4b107c7
commit 8496e71e6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -109,16 +109,7 @@ namespace etl
//*************************************************************************
void set(T value_)
{
if (value_ > Last)
{
value_ = Last;
}
else if (value_ < First)
{
value_ = First;
}
value = value_;
value = clamp(value_, First, Last);
}
//*************************************************************************
@ -398,16 +389,7 @@ namespace etl
//*************************************************************************
void set(T value_)
{
if (value_ > last_value)
{
value_ = last_value;
}
else if (value_ < first_value)
{
value_ = first_value;
}
value = value_;
value = clamp(value_, first_value, last_value);
}
//*************************************************************************