C++ for embedded systems by Arkady Miasnikov

C++ for embedded systems by Arkady Miasnikov

Author:Arkady Miasnikov [Miasnikov, Arkady]
Language: eng
Format: epub
Published: 2015-04-27T21:00:00+00:00


if ((semaphoreRes == pdTRUE) && !fifo.isEmpty()) {

res = fifo.remove(msg);

}

return res;

}

In the example application an interrupt (a producer) reads data from the UART devices, and sends the collected data to the processing task (a consumer). My message object contains two things: a message event and some data. The consumer task is expected to switch by the message event:

enum EVENT {UART0, UART1};

typedef struct {

enum EVENT event;

size_t data[32];

int dataSize;

} Message;

In the example below I reuse the memory pool from the previous chapter:

MemoryPool<LockDummy, Message, 3> pool;

Mailbox<Message*, LockDummy> myMailbox("mbx", 3);



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.