初始化验证编译通过
This commit is contained in:
63
Modules/led/inc/led.h
Normal file
63
Modules/led/inc/led.h
Normal file
@ -0,0 +1,63 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : led.h
|
||||
* @brief : LED driver module header file
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
#ifndef LED_H
|
||||
#define LED_H
|
||||
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
||||
/**
|
||||
* @brief LED configuration structure
|
||||
*/
|
||||
typedef struct {
|
||||
GPIO_TypeDef *gpio_port; /*!< GPIO port */
|
||||
uint16_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 */
|
||||
Reference in New Issue
Block a user