Untitled

 avatar
unknown
plain_text
2 years ago
3.0 kB
8
Indexable
/**
 * @file gpio.h
 * @brief GPIO Driver
 * 
 * This file contains the functions for configuring and manipulating GPIO pins.
 */

#ifndef GPIO_H
#define GPIO_H

#include "types.h"

/**
 * @struct GPIO_Reg_t
 * @brief GPIO Register Structure
 * 
 * This structure defines the GPIO register layout.
 */
typedef struct {
	/* Register fields */
} GPIO_Reg_t;

/**
 * @struct GPIO_Cfg_t
 * @brief GPIO Configuration Structure
 * 
 * This structure defines the configuration options for a GPIO pin.
 */
typedef struct {
	/* Configuration fields */
} GPIO_Cfg_t;

/**
 * @enum Pin_State_t
 * @brief Pin State Enumeration
 * 
 * This enumeration defines the possible states of a GPIO pin.
 */
typedef enum {
	Pin_Low = 0, /**< Low state */
	Pin_High     /**< High state */
} Pin_State_t;

/**
 * @brief Initialize GPIO port
 * 
 * This function initializes a GPIO port with the given configuration.
 * 
 * @param GPIOx Pointer to the GPIO port register
 * @param Copy_GPIO_Cfg Pointer to the GPIO configuration structure
 */
void MCL_GPIO_vInitPort(GPIO_Reg_t* GPIOx, GPIO_Cfg_t* Copy_GPIO_Cfg);

/**
 * @brief Set the configuration for a GPIO pin
 * 
 * This function sets the configuration options for a GPIO pin.
 * 
 * @param GPIOx Pointer to the GPIO port register
 * @param Copy_PinId The ID of the GPIO pin
 * @param Copy_GPIO_Cfg Pointer to the GPIO configuration structure
 */
void MCL_GPIO_vSetPinCfg(GPIO_Reg_t* GPIOx, GPIO_Pin_t Copy_PinId, GPIO_Cfg_t* Copy_GPIO_Cfg);

/**
 * @brief Set the state of a GPIO pin
 * 
 * This function sets the state of a GPIO pin.
 * 
 * @param GPIOx Pointer to the GPIO port register
 * @param Copy_PinId The ID of the GPIO pin
 * @param Copy_xPinVal The state to set for the GPIO pin
 */
void MCL_GPIO_vDirectPinSetter(GPIO_Reg_t* GPIOx, GPIO_Pin_t Copy_PinId, Pin_State_t Copy_xPinVal);

/**
 * @brief Get the state of a GPIO pin
 * 
 * This function retrieves the state of a GPIO pin.
 * 
 * @param GPIOx Pointer to the GPIO port register
 * @param Copy_PinId The ID of the GPIO pin
 * @return The state of the GPIO pin (Pin_Low or Pin_High)
 */
u8 MCL_GPIO_u8GetPinVal(GPIO_Reg_t* GPIOx, GPIO_Pin_t Copy_PinId);

/**
 * @brief Write a value to the GPIO port
 * 
 * This function writes a value to the GPIO port.
 * 
 * @param GPIOx Pointer to the GPIO port register
 * @param Copy_u32PortVal The value to write to the GPIO port
 */
void MCL_GPIO_vWritePort(GPIO_Reg_t* GPIOx, u32 Copy_u32PortVal);

/**
 * @brief Read the value of the GPIO port
 * 
 * This function reads the value of the GPIO port.
 * 
 * @param GPIOx Pointer to the GPIO port register
 * @return The value of the GPIO port
 */
u32 MCL_GPIO_u32ReadPort(GPIO_Reg_t* GPIOx);

/**
 * @brief Toggle the state of a GPIO pin
 * 
 * This function toggles the state of a GPIO pin.
 * 
 * @param GPIOx Pointer to the GPIO port register
 * @param Copy_PinId The ID of the GPIO pin to toggle
 */
void MCL_GPIO_vTogglePin(GPIO_Reg_t*
Editor is loading...