Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
Loading...
Searching...
No Matches
gpio_mux.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2020 iosabi
3
*
4
* This file is subject to the terms and conditions of the GNU Lesser General
5
* Public License v2.1. See the file LICENSE in the top level directory for more
6
* details.
7
*/
8
23
#ifndef GPIO_MUX_H
24
#define GPIO_MUX_H
25
26
#include <stdint.h>
27
#include "
periph_cpu.h
"
28
29
#ifdef __cplusplus
30
extern
"C"
{
31
#endif
32
36
#define GPIO_T_ADDR_BASE(pin) (GPIOA_BASE + ((pin) & 0xf000u))
37
41
#define GPIO_T_ADDR(pin) ((GPIO_Type *)(GPIO_T_ADDR_BASE(pin)))
42
48
#define GPIO_T_PORT(pin) ((gpio_t)(pin) >> 12u)
49
53
#define GPIO_T_PIN(pin) ((pin) & 0x00ffu)
54
55
#if defined(GPIOB_BASE) && (GPIO_T_ADDR_BASE(GPIO_PIN(1, 1)) != GPIOB_BASE)
56
#error "GPIO_T_ADDR(GPIO_PIN(1, x)) must be the GPIOB address"
57
#endif
58
62
#define GPIO_T_IS_HWCS(pin) (((pin) & 0xff00u) == 0x8000)
63
67
#define GPIO_T_HWCS(pin) ((pin) & 0x0003u)
68
74
void
gpio_init_mux
(
gpio_t
pin, uint32_t func);
75
76
#ifdef __cplusplus
77
}
78
#endif
79
80
#endif
/* GPIO_MUX_H */
gpio_init_mux
void gpio_init_mux(gpio_t pin, uint32_t func)
Configure the pin mux to the given function.
gpio_t
uint16_t gpio_t
GPIO type identifier.
Definition
periph_cpu.h:117
periph_cpu.h
CPU specific definitions for internal peripheral handling.
Generated on Thu Jan 30 2025 14:58:33 by
1.12.0