/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file           : led.h
  * @brief          : LED driver module header file
  ******************************************************************************
  */
/* USER CODE END Header */

#ifndef LED_H
#define LED_H

#include <stdint.h>
#include <stddef.h>
#include "hal_gpio.h"

/**
 * @brief LED configuration structure
 */
typedef struct {
    hal_gpio_port_t gpio_port;  /*!< GPIO port */
    hal_gpio_pin_t gpio_pin;        /*!< GPIO pin */
} led_config_t;

/**
 * @brief LED instance structure
 */
typedef struct {
    led_config_t config;  /*!< LED configuration */
    uint8_t state;        /*!< Current LED state (0: off, 1: on) */
} led_t;

/**
 * @brief Initialize LED module
 * @param led: Pointer to LED instance
 * @param config: Pointer to LED configuration
 */
void led_init(led_t *led, const led_config_t *config);

/**
 * @brief Turn on LED
 * @param led: Pointer to LED instance
 */
void led_on(led_t *led);

/**
 * @brief Turn off LED
 * @param led: Pointer to LED instance
 */
void led_off(led_t *led);

/**
 * @brief Toggle LED state
 * @param led: Pointer to LED instance
 */
void led_toggle(led_t *led);

/**
 * @brief Get LED current state
 * @param led: Pointer to LED instance
 * @retval 0: LED is off, 1: LED is on
 */
uint8_t led_get_state(const led_t *led);

#endif /* LED_H */
