diff --git a/include/etl/timer.h b/include/etl/timer.h index c3ce017b..681180c3 100644 --- a/include/etl/timer.h +++ b/include/etl/timer.h @@ -142,24 +142,42 @@ namespace etl #endif // Timer owner. - struct owner - { - typedef void* type; - #if ETL_USING_CPP11 - static ETL_CONSTANT type No_Owner = ETL_NULLPTR; + namespace private_timer + { + template + struct owner_static + { + using type = const void*; + static constexpr type No_Owner = nullptr; + }; + + template + constexpr typename owner_static::type owner_static::No_Owner; + } // namespace private_timer #else - static ETL_CONSTANT type No_Owner; + namespace private_timer + { + template + struct owner_static + { + typedef const void* type; + + static const type No_Owner; + }; + + template + const typename owner_static::type owner_static::No_Owner = ETL_NULLPTR; + } #endif + + struct owner : private_timer::owner_static + { }; #if ETL_USING_CPP11 using owner_t = owner::type; #endif - -#if ETL_NOT_USING_CPP11 - owner::type const owner::No_Owner = ETL_NULLPTR; -#endif } // namespace timer } // namespace etl diff --git a/include/etl/timer_lock_policy.h b/include/etl/timer_lock_policy.h index 11927f3d..534083f5 100644 --- a/include/etl/timer_lock_policy.h +++ b/include/etl/timer_lock_policy.h @@ -97,7 +97,8 @@ namespace etl etl::atomic_bool lock_flag; }; +#endif } } -#endif + #endif diff --git a/include/etl/timer_node.h b/include/etl/timer_node.h index 8bbac3c3..a5924fbb 100644 --- a/include/etl/timer_node.h +++ b/include/etl/timer_node.h @@ -289,7 +289,7 @@ namespace etl node* registered_next; ///< The next timer in the registered timer list. unlinked() if the timer is not registered. node* active_next; ///< The next timer in the active timer list. unlinked() if the timer is not active. node* expired_next; ///< The next timer in the expired timer list. unlinked() if the timer is not expired. - void* owner; ///< The owner of the timer. + const void* owner; ///< The owner of the timer. etl::timer::config config; ///< The configuration of the timer. etl::timer::interval::type delta; ///< The time remaining until the timer expires. }; diff --git a/include/etl/timer_notifications.h b/include/etl/timer_notifications.h deleted file mode 100644 index 54886cab..00000000 --- a/include/etl/timer_notifications.h +++ /dev/null @@ -1,59 +0,0 @@ -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2017 John Wellbelove - -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_TIMER_NOTIFICATION_INCLUDED -#define ETL_TIMER_NOTIFICATION_INCLUDED - -#include "platform.h" - -//***************************************************************************** -// Definitions common to timers. -//***************************************************************************** - -namespace etl -{ - namespace timer - { - //*************************************************************************** - /// Default class for time to next notification - //*************************************************************************** - class timer_time_to_next_notification - { - public: - - virtual ~timer_time_to_next_notification() ETL_NOEXCEPT {} - - virtual void invoke(uint32_t) - { - // Do nothing by default. - } - }; - }; // namespace timer -} // namespace etl - -#endif