Using the OSFifo example to pass a string ?

Discussion to talk about software related topics only.
Post Reply
seulater
Posts: 445
Joined: Fri Apr 25, 2008 5:26 am

Using the OSFifo example to pass a string ?

Post by seulater »

All this talk on Proper Queue usage got me thinking that i could do something in a better way.
I am looking to have a Task that will be in control of writing to my LCD. All other tasks that want to use the screen will post a message. The LCD task will be in a pending state when there is no data available. When another task makes a post with data, the LCD routine will resume running and update the LCD.

The OSFifo example, looks like what i want do do. except, i dont see that i can add a string of text to the "OSFifoPost( &MyFIFO, ( OS_FIFO_EL * ) &StructArray ); "
greengene
Posts: 164
Joined: Wed May 14, 2008 11:20 am
Location: Lakeside, CA

Re: Using the OSFifo example to pass a string ?

Post by greengene »

using that example, you can put whatever you want in the MyStructue struct -
just don't touch that first member, pUsedByFifo.
e.g.,
typedef struct // Pointers to this structure will be passed in the FIFO
{
void * pUsedByFifo; // Don't modify this value, and keep it first
int x; // Any other members come after the pointer
char sYours[32]; // or whatever else you want to add
BOOL free; // free = TRUE if structure is free to be used.
} MyStructure;
seulater
Posts: 445
Joined: Fri Apr 25, 2008 5:26 am

Re: Using the OSFifo example to pass a string ?

Post by seulater »

was able to finally try this with your suggestion, worked like a charm, Thanks!
Post Reply