Implementing a sequencer
In this chapter, we introduced etl::delegate
– an alternative to std::function
and fixed size vector implementation from ETL. As ETL avoids dynamic memory allocation, we will use these components for the implementation of the sequencer. Below is an updated UML diagram:

Figure 14.2 – UML sequencer diagram using ETL components
Figure 14.2 depicts a UML diagram of the sequencer using delegate and vector ETL components and the priority queue from the standard library. This code implements sequencer
:
template<typename Task, std::size_t Size>
struct sequencer {
sequencer() = delete;
static void add(Task task) {
if(pq.size() < Size) {
__disable_irq();
pq.push(task);
__enable_irq();
}
}
static void run() {
if(!pq.empty()) {
__disable_irq();
auto task = pq.top();
pq.pop();
__enable_irq();
task...