|
STM32 Traffic Control
|
Circular queue Implementation for managing traffic light requests. More...
#include "uart.h"#include "queue.h"#include "controller.h"#include <stdio.h>#include <stdint.h>#include <stdbool.h>#include "stm32f446xx.h"Functions | |
| bool | queue_is_empty () |
| Check if the traffic light request queue is empty. | |
| bool | queue_is_full () |
| Check if the traffic light request queue is full. | |
| void | queue_enqueue (uint32_t lightPair) |
| Add a traffic light pair request to the queue. | |
| int32_t | queue_dequeue () |
| Remove and return the next traffic light pair request. | |
Circular queue Implementation for managing traffic light requests.
This module provides a simple circular queue to hold traffic light pair requests. It supports enqueueing new requests and dequeueing the next request for processing.
| int32_t queue_dequeue | ( | void | ) |
Remove and return the next traffic light pair request.
Retrieves the front element of the queue and updates the queue pointers. Returns -1 if the queue is empty.
| void queue_enqueue | ( | uint32_t | lightPair | ) |
Add a traffic light pair request to the queue.
If the queue is not full, the request is added at the rear of the queue. The queue is circular and wraps around automatically.
| lightPair | ID of the traffic light pair to enqueue. |
| bool queue_is_empty | ( | void | ) |
Check if the traffic light request queue is empty.
| bool queue_is_full | ( | void | ) |
Check if the traffic light request queue is full.