mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
cpu/stm32x: unified gpio_init_af() function
This commit is contained in:
parent
06b561f530
commit
5afb191027
@ -84,6 +84,10 @@ typedef uint32_t gpio_t;
|
||||
* @brief Available MUX values for configuring a pin's alternate function
|
||||
*/
|
||||
typedef enum {
|
||||
#ifdef CPU_FAM_STM32F1
|
||||
GPIO_AF_OUT_PP = 0xb, /**< alternate function output - push-pull */
|
||||
GPIO_AF_OUT_OD = 0xf, /**< alternate function output - open-drain */
|
||||
#else
|
||||
GPIO_AF0 = 0, /**< use alternate function 0 */
|
||||
GPIO_AF1, /**< use alternate function 1 */
|
||||
GPIO_AF2, /**< use alternate function 2 */
|
||||
@ -102,6 +106,7 @@ typedef enum {
|
||||
GPIO_AF14, /**< use alternate function 14 */
|
||||
GPIO_AF15 /**< use alternate function 15 */
|
||||
#endif
|
||||
#endif
|
||||
} gpio_af_t;
|
||||
|
||||
/**
|
||||
@ -152,6 +157,14 @@ void periph_clk_en(bus_t bus, uint32_t mask);
|
||||
*/
|
||||
void periph_clk_dis(bus_t bus, uint32_t mask);
|
||||
|
||||
/**
|
||||
* @brief Configure the alternate function for the given pin
|
||||
*
|
||||
* @param[in] pin pin to configure
|
||||
* @param[in] af alternate function to use
|
||||
*/
|
||||
void gpio_init_af(gpio_t pin, gpio_af_t af);
|
||||
|
||||
/**
|
||||
* @brief Configure the given pin to be used as ADC input
|
||||
*
|
||||
|
@ -65,7 +65,7 @@ typedef enum {
|
||||
#endif /* ndef DOXYGEN */
|
||||
|
||||
/**
|
||||
* @brief Available ports on the STM32F4 family
|
||||
* @brief Available ports on the STM32F0 family
|
||||
*/
|
||||
enum {
|
||||
PORT_A = 0, /**< port A */
|
||||
@ -108,16 +108,6 @@ typedef struct {
|
||||
uint8_t chan; /**< DAC device used for this line */
|
||||
} dac_conf_t;
|
||||
|
||||
/**
|
||||
* @brief Configure the alternate function for the given pin
|
||||
*
|
||||
* @note This is meant for internal use in STM32F4 peripheral drivers only
|
||||
*
|
||||
* @param[in] pin pin to configure
|
||||
* @param[in] af alternate function to use
|
||||
*/
|
||||
void gpio_init_af(gpio_t pin, gpio_af_t af);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -106,17 +106,6 @@ enum {
|
||||
PORT_G = 6, /**< port G */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Define alternate function modes
|
||||
*
|
||||
* On this CPU, only the output pins have alternate function modes. The input
|
||||
* pins have to be configured using the default gpio_init() function.
|
||||
*/
|
||||
typedef enum {
|
||||
GPIO_AF_OUT_PP = 0xb, /**< alternate function output - push-pull */
|
||||
GPIO_AF_OUT_OD = 0xf, /**< alternate function output - open-drain */
|
||||
} gpio_af_out_t;
|
||||
|
||||
/**
|
||||
* @brief ADC channel configuration data
|
||||
*/
|
||||
@ -146,16 +135,6 @@ typedef struct {
|
||||
uint8_t chan; /**< DAC device used for this line */
|
||||
} dac_conf_t;
|
||||
|
||||
/**
|
||||
* @brief Configure the alternate function for the given pin
|
||||
*
|
||||
* @note This is meant for internal use in STM32F1 peripheral drivers only
|
||||
*
|
||||
* @param[in] pin pin to configure
|
||||
* @param[in] af alternate function to use
|
||||
*/
|
||||
void gpio_init_af(gpio_t pin, gpio_af_out_t af);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -134,7 +134,7 @@ int gpio_init_int(gpio_t pin, gpio_mode_t mode, gpio_flank_t flank,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void gpio_init_af(gpio_t pin, gpio_af_out_t af)
|
||||
void gpio_init_af(gpio_t pin, gpio_af_t af)
|
||||
{
|
||||
int pin_num = _pin_num(pin);
|
||||
GPIO_TypeDef *port = _port(pin);
|
||||
|
@ -127,16 +127,6 @@ typedef struct {
|
||||
uint8_t chan; /**< DAC device used for this line */
|
||||
} dac_conf_t;
|
||||
|
||||
/**
|
||||
* @brief Configure the alternate function for the given pin
|
||||
*
|
||||
* @note This is meant for internal use in STM32F2 peripheral drivers only
|
||||
*
|
||||
* @param[in] pin pin to configure
|
||||
* @param[in] af alternate function to use
|
||||
*/
|
||||
void gpio_init_af(gpio_t pin, gpio_af_t af);
|
||||
|
||||
/**
|
||||
* @brief Configure the given pin to be used as ADC input
|
||||
*
|
||||
|
@ -136,16 +136,6 @@ typedef struct {
|
||||
uint8_t chan; /**< DAC device used for this line */
|
||||
} dac_conf_t;
|
||||
|
||||
/**
|
||||
* @brief Configure the alternate function for the given pin
|
||||
*
|
||||
* @note This is meant for internal use in STM32F4 peripheral drivers only
|
||||
*
|
||||
* @param[in] pin pin to configure
|
||||
* @param[in] af alternate function to use
|
||||
*/
|
||||
void gpio_init_af(gpio_t pin, gpio_af_t af);
|
||||
|
||||
/**
|
||||
* @brief Power on the DMA device the given stream belongs to
|
||||
*
|
||||
|
@ -76,16 +76,6 @@ typedef struct {
|
||||
uint8_t chan; /**< DAC device used for this line */
|
||||
} dac_conf_t;
|
||||
|
||||
/**
|
||||
* @brief Configure the alternate function for the given pin
|
||||
*
|
||||
* @note This is meant for internal use in STM32L1 peripheral drivers only
|
||||
*
|
||||
* @param[in] pin pin to configure
|
||||
* @param[in] af alternate function to use
|
||||
*/
|
||||
void gpio_init_af(gpio_t pin, gpio_af_t af);
|
||||
|
||||
/**
|
||||
* @brief I2C configuration data structure
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user