SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
sys-gpio.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0+ */
2
3#ifndef __SYS_GPIO_H__
4#define __SYS_GPIO_H__
5
6#include <io.h>
7#include <stdarg.h>
8#include <stdbool.h>
9#include <stddef.h>
10#include <stdint.h>
11#include <types.h>
12
13#include "log.h"
14
15#ifdef __cplusplus
16extern "C" {
17#endif// __cplusplus
18
19enum {
31};
32
33enum {
36};
37
38enum {
53};
54
60
63
64#define PIO_NUM_IO_BITS 5
65
66#define GPIO_PIN(x, y) (((uint32_t) (x << PIO_NUM_IO_BITS)) | y)
67
68typedef struct {
72
79void sunxi_gpio_init(gpio_t pin, int cfg);
80
87void sunxi_gpio_set_value(gpio_t pin, int value);
88
95int sunxi_gpio_read(gpio_t pin);
96
103void sunxi_gpio_set_pull(gpio_t pin, enum gpio_pull_t pull);
104
114
115#ifdef __cplusplus
116}
117#endif// __cplusplus
118
119#endif// __SYS_GPIO_H__
u32_t uint32_t
Definition stdint.h:13
u8_t uint8_t
Definition stdint.h:7
static uint8_t value
Definition io.h:144
Definition sys-gpio.h:68
uint8_t mux
Definition sys-gpio.h:70
gpio_t pin
Definition sys-gpio.h:69
gpio_pull_t
Definition sys-gpio.h:55
@ GPIO_PULL_NONE
Definition sys-gpio.h:58
@ GPIO_PULL_DOWN
Definition sys-gpio.h:57
@ GPIO_PULL_UP
Definition sys-gpio.h:56
void sunxi_gpio_set_drv(gpio_t pin, gpio_drv_t drv)
Sets the drive strength of a Sunxi GPIO pin.
Definition sys-gpio-v1.c:184
void sunxi_gpio_set_value(gpio_t pin, int value)
Set the value of the specified GPIO pin.
Definition sys-gpio-v1.c:107
@ GPIO_PORTJ
Definition sys-gpio.h:48
@ GPIO_PORTA
Definition sys-gpio.h:39
@ GPIO_PORTB
Definition sys-gpio.h:40
@ GPIO_PORTK
Definition sys-gpio.h:49
@ GPIO_PORTC
Definition sys-gpio.h:41
@ GPIO_PORTL
Definition sys-gpio.h:50
@ GPIO_PORTD
Definition sys-gpio.h:42
@ GPIO_PORTM
Definition sys-gpio.h:51
@ GPIO_PORTF
Definition sys-gpio.h:44
@ GPIO_PORTH
Definition sys-gpio.h:46
@ GPIO_PORTI
Definition sys-gpio.h:47
@ GPIO_PORTN
Definition sys-gpio.h:52
@ GPIO_PORTG
Definition sys-gpio.h:45
@ GPIO_PORTE
Definition sys-gpio.h:43
uint32_t gpio_t
Definition sys-gpio.h:62
@ GPIO_PERIPH_MUX3
Definition sys-gpio.h:23
@ GPIO_PERIPH_MUX8
Definition sys-gpio.h:28
@ GPIO_PERIPH_MUX14
Definition sys-gpio.h:29
@ GPIO_PERIPH_MUX4
Definition sys-gpio.h:24
@ GPIO_PERIPH_MUX2
Definition sys-gpio.h:22
@ GPIO_DISABLED
Definition sys-gpio.h:30
@ GPIO_INPUT
Definition sys-gpio.h:20
@ GPIO_OUTPUT
Definition sys-gpio.h:21
@ GPIO_PERIPH_MUX7
Definition sys-gpio.h:27
@ GPIO_PERIPH_MUX5
Definition sys-gpio.h:25
@ GPIO_PERIPH_MUX6
Definition sys-gpio.h:26
int sunxi_gpio_read(gpio_t pin)
Read the value of the specified GPIO pin.
Definition sys-gpio-v1.c:126
void sunxi_gpio_set_pull(gpio_t pin, enum gpio_pull_t pull)
Set the pull configuration for the specified GPIO pin.
Definition sys-gpio-v1.c:143
void sunxi_gpio_init(gpio_t pin, int cfg)
Initialize the specified GPIO pin with the given configuration.
Definition sys-gpio-v1.c:84
uint32_t gpio_drv_t
Definition sys-gpio.h:61
@ GPIO_LEVEL_LOW
Definition sys-gpio.h:34
@ GPIO_LEVEL_HIGH
Definition sys-gpio.h:35