Newer
Older
ESP32-RetroPlay / main / tasks / game / jump_bird_game_input_queue.c
@Jerry Xie Jerry Xie 19 days ago 935 bytes Initial Commit
// JumpBirdGameInputQueue.c
#include "freertos/FreeRTOS.h"
#include "freertos/queue.h"
#include "esp_log.h"

#include "jump_bird_game_input_queue.h" // For xJumpBirdGameInputQueue

static const char *TAG_QUEUE = "JUMP_BIRD_QUEUE";

/**
 * @brief Initializes and creates the FreeRTOS queue for Jump Bird game input.
 *
 * This function should be called once during application startup.
 * It creates a queue of size 1 to hold boolean jump signals.
 *
 * @return The handle to the created queue, or NULL if creation failed.
 */
QueueHandle_t jump_bird_game_input_queue_init(void) {
    // Create a queue of size 1 to hold boolean jump signals
    QueueHandle_t queue_handle = xQueueCreate(1, sizeof(bool));

    if (queue_handle == NULL) {
        ESP_LOGE(TAG_QUEUE, "Failed to create xJumpBirdGameInputQueue!");
    } else {
        ESP_LOGI(TAG_QUEUE, "xJumpBirdGameInputQueue created successfully.");
    }
    return queue_handle;
}