Simplify MessageQueue pop() usage.

This commit is contained in:
Jared Boone 2015-08-27 14:35:17 -07:00
parent d8b3b4cb6b
commit b13081696d
3 changed files with 9 additions and 20 deletions

View file

@ -47,8 +47,9 @@ public:
return push(&message, sizeof(message));
}
size_t pop(void* const buf, const size_t len) {
return fifo.out_r(buf, len);
const Message* pop(std::array<uint8_t, Message::MAX_SIZE>& buf) {
const Message* const p = reinterpret_cast<Message*>(buf.data());
return fifo.out_r(buf.data(), buf.size()) ? p : nullptr;
}
size_t len() const {