31using miosix::FastInterruptDisableLock;
32using miosix::FastInterruptEnableLock;
42template <
typename T,
unsigned int Size>
45 static_assert(std::is_trivially_copy_constructible<T>::value,
46 "T must be trivially copy constructible!");
54 FastInterruptDisableLock d;
55 IRQwakeWaitingThread();
56 return buffer.put(elem);
70 T
get(
unsigned int i = 0)
72 FastInterruptDisableLock d;
85 FastInterruptDisableLock d;
98 FastInterruptDisableLock d;
109 FastInterruptDisableLock d;
110 return buffer.count();
115 FastInterruptDisableLock d;
116 return buffer.isEmpty();
121 FastInterruptDisableLock d;
122 return buffer.isFull();
132 IRQwakeWaitingThread();
147 if (waiting && (waiting->IRQgetPriority() >
148 Thread::IRQgetCurrentThread()->IRQgetPriority()))
153 IRQwakeWaitingThread();
170 T
IRQget(
unsigned int i = 0) {
return buffer.get(i); }
207 FastInterruptDisableLock d;
208 while (buffer.isEmpty())
210 IRQwakeWaitingThread();
211 waiting = Thread::IRQgetCurrentThread();
215 FastInterruptEnableLock e(d);
230 void IRQwakeWaitingThread()
234 waiting->IRQwakeup();
239 Thread* waiting =
nullptr;
240 CircularBuffer<T, Size> buffer;
T IRQget(unsigned int i=0)
Gets an element from the buffer, without removing it.
T IRQpop()
Pops the first element in the buffer.
void waitUntilNotEmpty()
Waits until the buffer contains at least one element.
void IRQput(const T &elem)
Puts a copy of the element in the buffer.
size_t count() const
Counts the elements in the buffer.
T pop()
Pops the first element in the buffer.
void IRQput(const T &elem, bool &hppw)
Puts a copy of the element in the buffer.
size_t getSize() const
Returns the maximum number of elements that can be stored in the buffer.
T & put(const T &elem)
Puts a copy of the element in the buffer.
T last()
Returns the last element added in the buffer.
size_t IRQcount() const
Counts the elements in the buffer.
T get(unsigned int i=0)
Gets an element from the buffer, without removing it.
This file includes all the types the logdecoder script will decode.