begin functie create
This commit is contained in:
@@ -153,7 +153,30 @@ bool buffer_is_empty(void)
|
||||
}
|
||||
|
||||
bool FIFOBuffChar_create(int ){
|
||||
|
||||
bool ok = false;
|
||||
|
||||
// Initialize the FIFO buffer
|
||||
FIFO_FirstElement_p = NULL;
|
||||
FIFO_LastElement_p = NULL;
|
||||
FIFO_count = 0;
|
||||
FIFO_Full = false;
|
||||
|
||||
FIFO_FirstElement_p = malloc(sizeof(FIFO_element_t));
|
||||
if (FIFO_FirstElement_p == NULL)
|
||||
{
|
||||
// Memory allocation failed
|
||||
FIFO_Full = true;
|
||||
return false;
|
||||
}
|
||||
// Initialize the first element
|
||||
FIFO_FirstElement_p->value = 0;
|
||||
FIFO_FirstElement_p->nextElement = NULL;
|
||||
|
||||
// Point the last element to the first one
|
||||
FIFO_LastElement_p = FIFO_FirstElement_p;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user