begin functie create

This commit is contained in:
Dennis Boekholtz
2024-03-30 18:28:49 +01:00
parent 1d9fcb3362
commit d5e889c9a8

View File

@@ -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;
}