mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
Update templates for potential macro name conflicts
This commit is contained in:
parent
fa25b8cd5e
commit
5a2aeb683e
@ -41,11 +41,11 @@ namespace etl
|
||||
{
|
||||
//***************************************************************************
|
||||
/// An indexed callback service.
|
||||
/// \tparam RANGE The number of callbacks to handle.
|
||||
/// \tparam OFFSET The lowest callback id value.
|
||||
/// The callback ids must range between OFFSET and OFFSET + RANGE - 1.
|
||||
/// \tparam Range The number of callbacks to handle.
|
||||
/// \tparam Offset The lowest callback id value.
|
||||
/// The callback ids must range between Offset and Offset + Range - 1.
|
||||
//***************************************************************************
|
||||
template <size_t RANGE, size_t OFFSET = 0U>
|
||||
template <size_t Range, size_t Offset = 0U>
|
||||
class callback_service
|
||||
{
|
||||
public:
|
||||
@ -70,10 +70,10 @@ namespace etl
|
||||
template <size_t Id>
|
||||
void register_callback(etl::ifunction<size_t>& callback)
|
||||
{
|
||||
ETL_STATIC_ASSERT(Id < (OFFSET + RANGE), "Callback Id out of range");
|
||||
ETL_STATIC_ASSERT(Id >= OFFSET, "Callback Id out of range");
|
||||
ETL_STATIC_ASSERT(Id < (Offset + Range), "Callback Id out of range");
|
||||
ETL_STATIC_ASSERT(Id >= Offset, "Callback Id out of range");
|
||||
|
||||
lookup[Id - OFFSET] = &callback;
|
||||
lookup[Id - Offset] = &callback;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
@ -84,9 +84,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void register_callback(size_t id, etl::ifunction<size_t>& callback)
|
||||
{
|
||||
if ((id >= OFFSET) && (id < (OFFSET + RANGE)))
|
||||
if ((id >= Offset) && (id < (Offset + Range)))
|
||||
{
|
||||
lookup[id - OFFSET] = &callback;
|
||||
lookup[id - Offset] = &callback;
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,10 +107,10 @@ namespace etl
|
||||
template <size_t Id>
|
||||
void callback()
|
||||
{
|
||||
ETL_STATIC_ASSERT(Id < (OFFSET + RANGE), "Callback Id out of range");
|
||||
ETL_STATIC_ASSERT(Id >= OFFSET, "Callback Id out of range");
|
||||
ETL_STATIC_ASSERT(Id < (Offset + Range), "Callback Id out of range");
|
||||
ETL_STATIC_ASSERT(Id >= Offset, "Callback Id out of range");
|
||||
|
||||
(*lookup[Id - OFFSET])(Id);
|
||||
(*lookup[Id - Offset])(Id);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
@ -119,9 +119,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void callback(size_t id)
|
||||
{
|
||||
if ((id >= OFFSET) && (id < (OFFSET + RANGE)))
|
||||
if ((id >= Offset) && (id < (Offset + Range)))
|
||||
{
|
||||
(*lookup[id - OFFSET])(id);
|
||||
(*lookup[id - Offset])(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -144,15 +144,15 @@ namespace etl
|
||||
}
|
||||
|
||||
/// The default callback for unhandled ids.
|
||||
etl::function_mp<callback_service<RANGE, OFFSET>,
|
||||
etl::function_mp<callback_service<Range, Offset>,
|
||||
size_t,
|
||||
&callback_service<RANGE, OFFSET>::unhandled> unhandled_callback;
|
||||
&callback_service<Range, Offset>::unhandled> unhandled_callback;
|
||||
|
||||
/// Pointer to the user defined 'unhandled' callback.
|
||||
etl::ifunction<size_t>* p_unhandled;
|
||||
|
||||
/// Lookup table of callbacks.
|
||||
etl::array<etl::ifunction<size_t>*, RANGE> lookup;
|
||||
etl::array<etl::ifunction<size_t>*, Range> lookup;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -761,7 +761,7 @@ namespace etl
|
||||
//*******************************************
|
||||
/// Constructor.
|
||||
//*******************************************
|
||||
icallback_timer(callback_timer_data* const timer_array_, const uint_least8_t MAX_TIMERS_)
|
||||
icallback_timer(callback_timer_data* const timer_array_, const uint_least8_t Max_Timers_)
|
||||
: timer_array(timer_array_),
|
||||
active_list(timer_array_),
|
||||
enabled(false),
|
||||
@ -769,7 +769,7 @@ namespace etl
|
||||
process_semaphore(0),
|
||||
#endif
|
||||
registered_timers(0),
|
||||
MAX_TIMERS(MAX_TIMERS_)
|
||||
MAX_TIMERS(Max_Timers_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -814,24 +814,24 @@ namespace etl
|
||||
//***************************************************************************
|
||||
/// The callback timer
|
||||
//***************************************************************************
|
||||
template <const uint_least8_t MAX_TIMERS_>
|
||||
template <const uint_least8_t Max_Timers_>
|
||||
class callback_timer : public etl::icallback_timer
|
||||
{
|
||||
public:
|
||||
|
||||
ETL_STATIC_ASSERT(MAX_TIMERS_ <= 254, "No more than 254 timers are allowed");
|
||||
ETL_STATIC_ASSERT(Max_Timers_ <= 254, "No more than 254 timers are allowed");
|
||||
|
||||
//*******************************************
|
||||
/// Constructor.
|
||||
//*******************************************
|
||||
callback_timer()
|
||||
: icallback_timer(timer_array, MAX_TIMERS_)
|
||||
: icallback_timer(timer_array, Max_Timers_)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
callback_timer_data timer_array[MAX_TIMERS_];
|
||||
callback_timer_data timer_array[Max_Timers_];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -62,12 +62,12 @@ namespace etl
|
||||
{
|
||||
etl::timer::id::type id = etl::timer::id::NO_TIMER;
|
||||
|
||||
bool is_space = (number_of_registered_timers < MAX_TIMERS);
|
||||
bool is_space = (number_of_registered_timers < Max_Timers);
|
||||
|
||||
if (is_space)
|
||||
{
|
||||
// Search for the free space.
|
||||
for (uint_least8_t i = 0U; i < MAX_TIMERS; ++i)
|
||||
for (uint_least8_t i = 0U; i < Max_Timers; ++i)
|
||||
{
|
||||
timer_data& timer = timer_array[i];
|
||||
|
||||
@ -141,7 +141,7 @@ namespace etl
|
||||
active_list.clear();
|
||||
--process_semaphore;
|
||||
|
||||
for (uint8_t i = 0U; i < MAX_TIMERS; ++i)
|
||||
for (uint8_t i = 0U; i < Max_Timers; ++i)
|
||||
{
|
||||
::new (&timer_array[i]) timer_data();
|
||||
}
|
||||
@ -424,13 +424,13 @@ namespace etl
|
||||
//*******************************************
|
||||
/// Constructor.
|
||||
//*******************************************
|
||||
icallback_timer_atomic(timer_data* const timer_array_, const uint_least8_t MAX_TIMERS_)
|
||||
icallback_timer_atomic(timer_data* const timer_array_, const uint_least8_t Max_Timers_)
|
||||
: timer_array(timer_array_)
|
||||
, active_list(timer_array_)
|
||||
, enabled(false)
|
||||
, process_semaphore(0U)
|
||||
, number_of_registered_timers(0U)
|
||||
, MAX_TIMERS(MAX_TIMERS_)
|
||||
, Max_Timers(Max_Timers_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -441,7 +441,7 @@ namespace etl
|
||||
//*******************************************
|
||||
bool is_valid_timer_id(etl::timer::id::type id_) const
|
||||
{
|
||||
return (id_ < MAX_TIMERS);
|
||||
return (id_ < Max_Timers);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
@ -640,30 +640,30 @@ namespace etl
|
||||
|
||||
public:
|
||||
|
||||
const uint_least8_t MAX_TIMERS;
|
||||
const uint_least8_t Max_Timers;
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
/// The callback timer
|
||||
//***************************************************************************
|
||||
template <uint_least8_t MAX_TIMERS_, typename TSemaphore>
|
||||
template <uint_least8_t Max_Timers_, typename TSemaphore>
|
||||
class callback_timer_atomic : public etl::icallback_timer_atomic<TSemaphore>
|
||||
{
|
||||
public:
|
||||
|
||||
ETL_STATIC_ASSERT(MAX_TIMERS_ <= 254U, "No more than 254 timers are allowed");
|
||||
ETL_STATIC_ASSERT(Max_Timers_ <= 254U, "No more than 254 timers are allowed");
|
||||
|
||||
//*******************************************
|
||||
/// Constructor.
|
||||
//*******************************************
|
||||
callback_timer_atomic()
|
||||
: icallback_timer_atomic<TSemaphore>(timer_array, MAX_TIMERS_)
|
||||
: icallback_timer_atomic<TSemaphore>(timer_array, Max_Timers_)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
typename etl::icallback_timer_atomic<TSemaphore>::timer_data timer_array[MAX_TIMERS_];
|
||||
typename etl::icallback_timer_atomic<TSemaphore>::timer_data timer_array[Max_Timers_];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -40,12 +40,12 @@ namespace etl
|
||||
//***************************************************************************
|
||||
/// The deferred callback timer
|
||||
//***************************************************************************
|
||||
template <uint_least8_t MAX_TIMERS_, uint32_t MAX_HANDLERS_>
|
||||
template <uint_least8_t Max_Timers_, uint32_t Max_Handlers_>
|
||||
class callback_timer_deferred_locked : public etl::icallback_timer_locked
|
||||
{
|
||||
public:
|
||||
|
||||
ETL_STATIC_ASSERT(MAX_TIMERS_ <= 254U, "No more than 254 timers are allowed");
|
||||
ETL_STATIC_ASSERT(Max_Timers_ <= 254U, "No more than 254 timers are allowed");
|
||||
|
||||
typedef icallback_timer_locked::callback_type callback_type;
|
||||
typedef icallback_timer_locked::try_lock_type try_lock_type;
|
||||
@ -77,7 +77,7 @@ namespace etl
|
||||
/// Constructor.
|
||||
//*******************************************
|
||||
callback_timer_deferred_locked()
|
||||
: icallback_timer_locked(timer_array, MAX_TIMERS_)
|
||||
: icallback_timer_locked(timer_array, Max_Timers_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ namespace etl
|
||||
/// Constructor.
|
||||
//*******************************************
|
||||
callback_timer_deferred_locked(try_lock_type try_lock_, lock_type lock_, unlock_type unlock_)
|
||||
: icallback_timer_locked(timer_array, MAX_TIMERS_)
|
||||
: icallback_timer_locked(timer_array, Max_Timers_)
|
||||
{
|
||||
this->set_locks(try_lock_, lock_, unlock_);
|
||||
}
|
||||
@ -211,9 +211,9 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
priority_queue<CallbackNode, MAX_HANDLERS_> handler_queue;
|
||||
uint_least8_t timer_priorities[MAX_TIMERS_];
|
||||
timer_data timer_array[MAX_TIMERS_];
|
||||
priority_queue<CallbackNode, Max_Handlers_> handler_queue;
|
||||
uint_least8_t timer_priorities[Max_Timers_];
|
||||
timer_data timer_array[Max_Timers_];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -61,12 +61,12 @@ namespace etl
|
||||
{
|
||||
etl::timer::id::type id = etl::timer::id::NO_TIMER;
|
||||
|
||||
bool is_space = (number_of_registered_timers < MAX_TIMERS);
|
||||
bool is_space = (number_of_registered_timers < Max_Timers);
|
||||
|
||||
if (is_space)
|
||||
{
|
||||
// Search for the free space.
|
||||
for (uint_least8_t i = 0U; i < MAX_TIMERS; ++i)
|
||||
for (uint_least8_t i = 0U; i < Max_Timers; ++i)
|
||||
{
|
||||
timer_data& timer = timer_array[i];
|
||||
|
||||
@ -148,7 +148,7 @@ namespace etl
|
||||
number_of_registered_timers = 0;
|
||||
}
|
||||
|
||||
for (uint8_t i = 0U; i < MAX_TIMERS; ++i)
|
||||
for (uint8_t i = 0U; i < Max_Timers; ++i)
|
||||
{
|
||||
::new (&timer_array[i]) timer_data();
|
||||
}
|
||||
@ -425,12 +425,12 @@ namespace etl
|
||||
//*******************************************
|
||||
/// Constructor.
|
||||
//*******************************************
|
||||
icallback_timer_interrupt(timer_data* const timer_array_, const uint_least8_t MAX_TIMERS_)
|
||||
icallback_timer_interrupt(timer_data* const timer_array_, const uint_least8_t Max_Timers_)
|
||||
: timer_array(timer_array_)
|
||||
, active_list(timer_array_)
|
||||
, enabled(false)
|
||||
, number_of_registered_timers(0U)
|
||||
, MAX_TIMERS(MAX_TIMERS_)
|
||||
, Max_Timers(Max_Timers_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -441,7 +441,7 @@ namespace etl
|
||||
//*******************************************
|
||||
bool is_valid_timer_id(etl::timer::id::type id_) const
|
||||
{
|
||||
return (id_ < MAX_TIMERS);
|
||||
return (id_ < Max_Timers);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
@ -639,18 +639,18 @@ namespace etl
|
||||
|
||||
public:
|
||||
|
||||
const uint_least8_t MAX_TIMERS;
|
||||
const uint_least8_t Max_Timers;
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
/// The callback timer
|
||||
//***************************************************************************
|
||||
template <uint_least8_t MAX_TIMERS_, typename TInterruptGuard>
|
||||
template <uint_least8_t Max_Timers_, typename TInterruptGuard>
|
||||
class callback_timer_interrupt : public etl::icallback_timer_interrupt<TInterruptGuard>
|
||||
{
|
||||
public:
|
||||
|
||||
ETL_STATIC_ASSERT(MAX_TIMERS_ <= 254U, "No more than 254 timers are allowed");
|
||||
ETL_STATIC_ASSERT(Max_Timers_ <= 254U, "No more than 254 timers are allowed");
|
||||
|
||||
typedef typename icallback_timer_interrupt<TInterruptGuard>::callback_type callback_type;
|
||||
|
||||
@ -658,13 +658,13 @@ namespace etl
|
||||
/// Constructor.
|
||||
//*******************************************
|
||||
callback_timer_interrupt()
|
||||
: icallback_timer_interrupt<TInterruptGuard>(timer_array, MAX_TIMERS_)
|
||||
: icallback_timer_interrupt<TInterruptGuard>(timer_array, Max_Timers_)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
typename icallback_timer_interrupt<TInterruptGuard>::timer_data timer_array[MAX_TIMERS_];
|
||||
typename icallback_timer_interrupt<TInterruptGuard>::timer_data timer_array[Max_Timers_];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -63,12 +63,12 @@ namespace etl
|
||||
{
|
||||
etl::timer::id::type id = etl::timer::id::NO_TIMER;
|
||||
|
||||
bool is_space = (number_of_registered_timers < MAX_TIMERS);
|
||||
bool is_space = (number_of_registered_timers < Max_Timers);
|
||||
|
||||
if (is_space)
|
||||
{
|
||||
// Search for the free space.
|
||||
for (uint_least8_t i = 0U; i < MAX_TIMERS; ++i)
|
||||
for (uint_least8_t i = 0U; i < Max_Timers; ++i)
|
||||
{
|
||||
timer_data& timer = timer_array[i];
|
||||
|
||||
@ -142,7 +142,7 @@ namespace etl
|
||||
active_list.clear();
|
||||
unlock();
|
||||
|
||||
for (uint8_t i = 0U; i < MAX_TIMERS; ++i)
|
||||
for (uint8_t i = 0U; i < Max_Timers; ++i)
|
||||
{
|
||||
::new (&timer_array[i]) timer_data();
|
||||
}
|
||||
@ -388,12 +388,12 @@ namespace etl
|
||||
//*******************************************
|
||||
/// Constructor.
|
||||
//*******************************************
|
||||
icallback_timer_locked(timer_data* const timer_array_, const uint_least8_t MAX_TIMERS_)
|
||||
icallback_timer_locked(timer_data* const timer_array_, const uint_least8_t Max_Timers_)
|
||||
: timer_array(timer_array_),
|
||||
active_list(timer_array_),
|
||||
enabled(false),
|
||||
number_of_registered_timers(0U),
|
||||
MAX_TIMERS(MAX_TIMERS_)
|
||||
Max_Timers(Max_Timers_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -588,7 +588,7 @@ namespace etl
|
||||
//*******************************************
|
||||
bool is_valid_timer_id(etl::timer::id::type id_) const
|
||||
{
|
||||
return (id_ < MAX_TIMERS);
|
||||
return (id_ < Max_Timers);
|
||||
}
|
||||
|
||||
// The array of timer data structures.
|
||||
@ -611,18 +611,18 @@ namespace etl
|
||||
template <uint_least8_t, uint32_t>
|
||||
friend class callback_timer_deferred_locked;
|
||||
|
||||
const uint_least8_t MAX_TIMERS;
|
||||
const uint_least8_t Max_Timers;
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
/// The callback timer
|
||||
//***************************************************************************
|
||||
template <uint_least8_t MAX_TIMERS_>
|
||||
template <uint_least8_t Max_Timers_>
|
||||
class callback_timer_locked : public etl::icallback_timer_locked
|
||||
{
|
||||
public:
|
||||
|
||||
ETL_STATIC_ASSERT(MAX_TIMERS_ <= 254U, "No more than 254 timers are allowed");
|
||||
ETL_STATIC_ASSERT(Max_Timers_ <= 254U, "No more than 254 timers are allowed");
|
||||
|
||||
typedef icallback_timer_locked::callback_type callback_type;
|
||||
typedef icallback_timer_locked::try_lock_type try_lock_type;
|
||||
@ -633,7 +633,7 @@ namespace etl
|
||||
/// Constructor.
|
||||
//*******************************************
|
||||
callback_timer_locked()
|
||||
: icallback_timer_locked(timer_array, MAX_TIMERS_)
|
||||
: icallback_timer_locked(timer_array, Max_Timers_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -641,7 +641,7 @@ namespace etl
|
||||
/// Constructor.
|
||||
//*******************************************
|
||||
callback_timer_locked(try_lock_type try_lock_, lock_type lock_, unlock_type unlock_)
|
||||
: icallback_timer_locked(timer_array, MAX_TIMERS_)
|
||||
: icallback_timer_locked(timer_array, Max_Timers_)
|
||||
{
|
||||
this->set_locks(try_lock_, lock_, unlock_);
|
||||
}
|
||||
@ -700,7 +700,7 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
timer_data timer_array[MAX_TIMERS_];
|
||||
timer_data timer_array[Max_Timers_];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -352,7 +352,7 @@ namespace etl
|
||||
{
|
||||
etl::timer::id::type id = etl::timer::id::NO_TIMER;
|
||||
|
||||
bool is_space = (registered_timers < MAX_TIMERS);
|
||||
bool is_space = (registered_timers < Max_Timers);
|
||||
|
||||
if (is_space)
|
||||
{
|
||||
@ -360,7 +360,7 @@ namespace etl
|
||||
if (!router_.is_null_router())
|
||||
{
|
||||
// Search for the free space.
|
||||
for (uint_least8_t i = 0U; i < MAX_TIMERS; ++i)
|
||||
for (uint_least8_t i = 0U; i < Max_Timers; ++i)
|
||||
{
|
||||
etl::message_timer_data& timer = timer_array[i];
|
||||
|
||||
@ -435,7 +435,7 @@ namespace etl
|
||||
active_list.clear();
|
||||
ETL_ENABLE_TIMER_UPDATES;
|
||||
|
||||
for (int i = 0; i < MAX_TIMERS; ++i)
|
||||
for (int i = 0; i < Max_Timers; ++i)
|
||||
{
|
||||
new (&timer_array[i]) message_timer_data();
|
||||
}
|
||||
@ -624,7 +624,7 @@ namespace etl
|
||||
//*******************************************
|
||||
/// Constructor.
|
||||
//*******************************************
|
||||
imessage_timer(message_timer_data* const timer_array_, const uint_least8_t MAX_TIMERS_)
|
||||
imessage_timer(message_timer_data* const timer_array_, const uint_least8_t Max_Timers_)
|
||||
: timer_array(timer_array_),
|
||||
active_list(timer_array_),
|
||||
enabled(false),
|
||||
@ -632,7 +632,7 @@ namespace etl
|
||||
process_semaphore(0),
|
||||
#endif
|
||||
registered_timers(0),
|
||||
MAX_TIMERS(MAX_TIMERS_)
|
||||
Max_Timers(Max_Timers_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -671,30 +671,30 @@ namespace etl
|
||||
|
||||
public:
|
||||
|
||||
const uint_least8_t MAX_TIMERS;
|
||||
const uint_least8_t Max_Timers;
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
/// The message timer
|
||||
//***************************************************************************
|
||||
template <uint_least8_t MAX_TIMERS_>
|
||||
template <uint_least8_t Max_Timers_>
|
||||
class message_timer : public etl::imessage_timer
|
||||
{
|
||||
public:
|
||||
|
||||
ETL_STATIC_ASSERT(MAX_TIMERS_ <= 254, "No more than 254 timers are allowed");
|
||||
ETL_STATIC_ASSERT(Max_Timers_ <= 254, "No more than 254 timers are allowed");
|
||||
|
||||
//*******************************************
|
||||
/// Constructor.
|
||||
//*******************************************
|
||||
message_timer()
|
||||
: imessage_timer(timer_array, MAX_TIMERS_)
|
||||
: imessage_timer(timer_array, Max_Timers_)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
message_timer_data timer_array[MAX_TIMERS_];
|
||||
message_timer_data timer_array[Max_Timers_];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -407,13 +407,13 @@ namespace etl
|
||||
//*******************************************
|
||||
/// Constructor.
|
||||
//*******************************************
|
||||
imessage_timer_atomic(timer_data* const timer_array_, const uint_least8_t MAX_TIMERS_)
|
||||
imessage_timer_atomic(timer_data* const timer_array_, const uint_least8_t Max_Timers)
|
||||
: timer_array(timer_array_)
|
||||
, active_list(timer_array_)
|
||||
, enabled(false)
|
||||
, process_semaphore(0U)
|
||||
, registered_timers(0U)
|
||||
, MAX_TIMERS(MAX_TIMERS_)
|
||||
, MAX_TIMERS(Max_Timers)
|
||||
{
|
||||
}
|
||||
|
||||
@ -628,24 +628,24 @@ namespace etl
|
||||
//***************************************************************************
|
||||
/// The message timer
|
||||
//***************************************************************************
|
||||
template <uint_least8_t MAX_TIMERS_, typename TSemaphore>
|
||||
template <uint_least8_t Max_Timers, typename TSemaphore>
|
||||
class message_timer_atomic : public etl::imessage_timer_atomic<TSemaphore>
|
||||
{
|
||||
public:
|
||||
|
||||
ETL_STATIC_ASSERT(MAX_TIMERS_ <= 254, "No more than 254 timers are allowed");
|
||||
ETL_STATIC_ASSERT(Max_Timers <= 254, "No more than 254 timers are allowed");
|
||||
|
||||
//*******************************************
|
||||
/// Constructor.
|
||||
//*******************************************
|
||||
message_timer_atomic()
|
||||
: imessage_timer_atomic<TSemaphore>(timer_array, MAX_TIMERS_)
|
||||
: imessage_timer_atomic<TSemaphore>(timer_array, Max_Timers)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
typename etl::imessage_timer_atomic<TSemaphore>::timer_data timer_array[MAX_TIMERS_];
|
||||
typename etl::imessage_timer_atomic<TSemaphore>::timer_data timer_array[Max_Timers];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ namespace etl
|
||||
{
|
||||
etl::timer::id::type id = etl::timer::id::NO_TIMER;
|
||||
|
||||
bool is_space = (number_of_registered_timers < MAX_TIMERS);
|
||||
bool is_space = (number_of_registered_timers < Max_Timers);
|
||||
|
||||
if (is_space)
|
||||
{
|
||||
@ -75,7 +75,7 @@ namespace etl
|
||||
if (!router_.is_null_router())
|
||||
{
|
||||
// Search for the free space.
|
||||
for (uint_least8_t i = 0U; i < MAX_TIMERS; ++i)
|
||||
for (uint_least8_t i = 0U; i < Max_Timers; ++i)
|
||||
{
|
||||
timer_data& timer = timer_array[i];
|
||||
|
||||
@ -157,7 +157,7 @@ namespace etl
|
||||
active_list.clear();
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAX_TIMERS; ++i)
|
||||
for (int i = 0; i < Max_Timers; ++i)
|
||||
{
|
||||
new (&timer_array[i]) timer_data();
|
||||
}
|
||||
@ -415,12 +415,12 @@ namespace etl
|
||||
//*******************************************
|
||||
/// Constructor.
|
||||
//*******************************************
|
||||
imessage_timer_interrupt(timer_data* const timer_array_, const uint_least8_t MAX_TIMERS_)
|
||||
imessage_timer_interrupt(timer_data* const timer_array_, const uint_least8_t Max_Timers_)
|
||||
: timer_array(timer_array_)
|
||||
, active_list(timer_array_)
|
||||
, enabled(false)
|
||||
, number_of_registered_timers(0U)
|
||||
, MAX_TIMERS(MAX_TIMERS_)
|
||||
, Max_Timers(Max_Timers_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -628,18 +628,18 @@ namespace etl
|
||||
|
||||
public:
|
||||
|
||||
const uint_least8_t MAX_TIMERS;
|
||||
const uint_least8_t Max_Timers;
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
/// The message timer
|
||||
//***************************************************************************
|
||||
template <uint_least8_t MAX_TIMERS_, typename TInterruptGuard>
|
||||
template <uint_least8_t Max_Timers_, typename TInterruptGuard>
|
||||
class message_timer_interrupt : public etl::imessage_timer_interrupt<TInterruptGuard>
|
||||
{
|
||||
public:
|
||||
|
||||
ETL_STATIC_ASSERT(MAX_TIMERS_ <= 254, "No more than 254 timers are allowed");
|
||||
ETL_STATIC_ASSERT(Max_Timers_ <= 254, "No more than 254 timers are allowed");
|
||||
|
||||
typedef typename imessage_timer_interrupt<TInterruptGuard>::callback_type callback_type;
|
||||
|
||||
@ -647,13 +647,13 @@ namespace etl
|
||||
/// Constructor.
|
||||
//*******************************************
|
||||
message_timer_interrupt()
|
||||
: imessage_timer_interrupt<TInterruptGuard>(timer_array, MAX_TIMERS_)
|
||||
: imessage_timer_interrupt<TInterruptGuard>(timer_array, Max_Timers_)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
typename etl::imessage_timer_interrupt<TInterruptGuard>::timer_data timer_array[MAX_TIMERS_];
|
||||
typename etl::imessage_timer_interrupt<TInterruptGuard>::timer_data timer_array[Max_Timers_];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ namespace etl
|
||||
{
|
||||
etl::timer::id::type id = etl::timer::id::NO_TIMER;
|
||||
|
||||
bool is_space = (number_of_registered_timers < MAX_TIMERS);
|
||||
bool is_space = (number_of_registered_timers < Max_Timers);
|
||||
|
||||
if (is_space)
|
||||
{
|
||||
@ -77,7 +77,7 @@ namespace etl
|
||||
if (!router_.is_null_router())
|
||||
{
|
||||
// Search for the free space.
|
||||
for (uint_least8_t i = 0U; i < MAX_TIMERS; ++i)
|
||||
for (uint_least8_t i = 0U; i < Max_Timers; ++i)
|
||||
{
|
||||
timer_data& timer = timer_array[i];
|
||||
|
||||
@ -152,7 +152,7 @@ namespace etl
|
||||
active_list.clear();
|
||||
unlock();
|
||||
|
||||
for (int i = 0; i < MAX_TIMERS; ++i)
|
||||
for (int i = 0; i < Max_Timers; ++i)
|
||||
{
|
||||
new (&timer_array[i]) timer_data();
|
||||
}
|
||||
@ -423,12 +423,12 @@ namespace etl
|
||||
//*******************************************
|
||||
/// Constructor.
|
||||
//*******************************************
|
||||
imessage_timer_locked(timer_data* const timer_array_, const uint_least8_t MAX_TIMERS_)
|
||||
imessage_timer_locked(timer_data* const timer_array_, const uint_least8_t Max_Timers_)
|
||||
: timer_array(timer_array_)
|
||||
, active_list(timer_array_)
|
||||
, enabled(false)
|
||||
, number_of_registered_timers(0U)
|
||||
, MAX_TIMERS(MAX_TIMERS_)
|
||||
, Max_Timers(Max_Timers_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -640,18 +640,18 @@ namespace etl
|
||||
|
||||
public:
|
||||
|
||||
const uint_least8_t MAX_TIMERS;
|
||||
const uint_least8_t Max_Timers;
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
/// The message timer
|
||||
//***************************************************************************
|
||||
template <uint_least8_t MAX_TIMERS_>
|
||||
template <uint_least8_t Max_Timers_>
|
||||
class message_timer_locked : public etl::imessage_timer_locked
|
||||
{
|
||||
public:
|
||||
|
||||
ETL_STATIC_ASSERT(MAX_TIMERS_ <= 254, "No more than 254 timers are allowed");
|
||||
ETL_STATIC_ASSERT(Max_Timers_ <= 254, "No more than 254 timers are allowed");
|
||||
|
||||
typedef imessage_timer_locked::callback_type callback_type;
|
||||
typedef imessage_timer_locked::try_lock_type try_lock_type;
|
||||
@ -662,7 +662,7 @@ namespace etl
|
||||
/// Constructor.
|
||||
//*******************************************
|
||||
message_timer_locked()
|
||||
: imessage_timer_locked(timer_array, MAX_TIMERS_)
|
||||
: imessage_timer_locked(timer_array, Max_Timers_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -670,14 +670,14 @@ namespace etl
|
||||
/// Constructor.
|
||||
//*******************************************
|
||||
message_timer_locked(try_lock_type try_lock_, lock_type lock_, unlock_type unlock_)
|
||||
: imessage_timer_locked(timer_array, MAX_TIMERS_)
|
||||
: imessage_timer_locked(timer_array, Max_Timers_)
|
||||
{
|
||||
this->set_locks(try_lock_, lock_, unlock_);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
timer_data timer_array[MAX_TIMERS_];
|
||||
timer_data timer_array[Max_Timers_];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user