libpynq (release 5EWC0-2023 version 0.1.0 of 2023-08-14 14:01)
Loading...
Searching...
No Matches
gpio.h
Go to the documentation of this file.
1/*
2Copyright (c) 2023 Eindhoven University of Technology
3
4Permission is hereby granted, free of charge, to any person obtaining a copy
5of this software and associated documentation files (the "Software"), to deal
6in the Software without restriction, including without limitation the rights
7to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8copies of the Software, and to permit persons to whom the Software is
9furnished to do so, subject to the following conditions:
10
11The above copyright notice and this permission notice shall be included in all
12copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20SOFTWARE.
21*/
22#ifndef GPIO_H
23#define GPIO_H
24#include <stdint.h>
25
79typedef enum {
85
89typedef enum {
95
99typedef uint8_t gpio_t;
100
104void gpio_init(void);
109void gpio_destroy(void);
110
117void gpio_reset_pin(const gpio_t pin);
118
126void gpio_set_direction(const gpio_t pin, const gpio_direction_t direction);
127
135
143void gpio_set_level(const gpio_t pin, const gpio_level_t level);
144
152
153void gpio_ack_interrupt();
155void gpio_enable_interrupt(const gpio_t ping);
156void gpio_disable_interrupt(const gpio_t ping);
159
160uint64_t gpio_get_interrupt();
161
165void gpio_reset(void);
166
170#endif // GPIO_H
void gpio_enable_interrupt(const gpio_t ping)
Definition interrupt.c:59
uint64_t gpio_get_interrupt()
Definition interrupt.c:83
uint8_t * gpio_get_interrupt_pins()
void gpio_disable_interrupt(const gpio_t ping)
Definition interrupt.c:72
void gpio_reset(void)
Reset all GPIO pins.
Definition gpio.c:53
void gpio_print_interrupt()
Definition interrupt.c:121
uint8_t gpio_t
Definition gpio.h:99
gpio_direction_t gpio_get_direction(const gpio_t pin)
Returns the direction the set pin is initialized in.
Definition gpio.c:89
gpio_level_t gpio_get_level(const gpio_t pin)
Return the level of the GPIO pin.
Definition gpio.c:118
gpio_direction_t
Definition gpio.h:79
void gpio_disable_all_interrupts()
Definition interrupt.c:77
gpio_level_t
Definition gpio.h:89
void gpio_set_level(const gpio_t pin, const gpio_level_t level)
Set the level of the output GPIO pin. If the pin is configured as input, this function does nothing.
Definition gpio.c:101
void gpio_reset_pin(const gpio_t pin)
Function is currently a no-op placeholder for arduino compatibility.
Definition gpio.c:48
void gpio_destroy(void)
Definition gpio.c:42
void gpio_set_direction(const gpio_t pin, const gpio_direction_t direction)
Set the GPIO pin as in input or output.
Definition gpio.c:72
void gpio_ack_interrupt()
Definition interrupt.c:91
void gpio_init(void)
Definition gpio.c:35
@ GPIO_DIR_OUTPUT
Definition gpio.h:83
@ GPIO_DIR_INPUT
Definition gpio.h:81
@ GPIO_LEVEL_LOW
Definition gpio.h:91
@ GPIO_LEVEL_HIGH
Definition gpio.h:93