libyggdrasil  v1.0.0
gpio.h
Go to the documentation of this file.
1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * _____.___. .___ .__.__ *
3  * \__ | | ____ ____ __| _/___________ _____|__| | *
4  * / | |/ ___\ / ___\ / __ |\_ __ \__ \ / ___/ | | *
5  * \____ / /_/ > /_/ > /_/ | | | \// __ \_\___ \| | |__ *
6  * / ______\___ /\___ /\____ | |__| (____ /____ >__|____/ *
7  * \/ /_____//_____/ \/ \/ \/ *
8  * - Asgard - *
9  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
10  * This software can be used by students and other personal of the *
11  * Bern University of Applied Sciences under the terms of the MIT *
12  * license. *
13  * For other persons this software is under the terms of the GNU *
14  * General Public License version 2. *
15  * *
16  * Copyright © 2021, Bern University of Applied Sciences. *
17  * All rights reserved. *
18  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
26 #include <c/common/types.h>
27 
28 #define LOW_ACTIVE true
29 #define HIGH_ACTIVE false
30 
34 typedef struct {
36  bool lowActive;
37 } gpio_t;
38 
45 extern "C" bool yggdrasil_GPIO_Init(gpio_t gpio);
46 
54 
62 
70 
78 
85 C_LINKAGE void yggdrasil_GPIO_Set(gpio_t gpio, bool state);
86 
types.h
Commonly used type definitions and helper templates.
u8
uint8_t u8
Unsigned integer definitions.
Definition: types.h:36
yggdrasil_GPIO_Get
C_LINKAGE bool yggdrasil_GPIO_Get(gpio_t gpio)
Get GPIO state.
Definition: gpio.cpp:86
yggdrasil_GPIO_MakeInput
C_LINKAGE bool yggdrasil_GPIO_MakeInput(gpio_t gpio)
Turn pin into an input.
Definition: gpio.cpp:76
gpio_t::pinNumber
u8 pinNumber
Definition: gpio.h:35
yggdrasil_GPIO_Toggle
C_LINKAGE void yggdrasil_GPIO_Toggle(gpio_t gpio)
Toggle GPIO.
Definition: gpio.cpp:109
yggdrasil_GPIO_MakeOutput
C_LINKAGE bool yggdrasil_GPIO_MakeOutput(gpio_t gpio)
Turn pin into an output.
Definition: gpio.cpp:66
gpio_t::lowActive
bool lowActive
Definition: gpio.h:36
yggdrasil_GPIO_Init
bool yggdrasil_GPIO_Init(gpio_t gpio)
GPIO initialization.
Definition: gpio.cpp:44
gpio_t
GPIO handle type.
Definition: gpio.h:34
C_LINKAGE
#define C_LINKAGE
Definition: attributes.h:43
yggdrasil_GPIO_Deinit
C_LINKAGE bool yggdrasil_GPIO_Deinit(gpio_t gpio)
GPIO deinitialization.
Definition: gpio.cpp:55
yggdrasil_GPIO_Set
C_LINKAGE void yggdrasil_GPIO_Set(gpio_t gpio, bool state)
Set GPIO state.
Definition: gpio.cpp:99