rfLPC
A low level library for using NXP's LPC17xx SoC. Config is given for MBED prototyping board
gpio.h
Go to the documentation of this file.
1 /* This file is part of rflpc. Copyright 2010-2011 Michael Hauspie
2  *
3  * rflpc is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7  *
8  * rflpc is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with rflpc. If not, see <http://www.gnu.org/licenses/>.
15  */
19 /*
20  Author: Michael Hauspie <michael.hauspie@univ-lille1.fr>
21  Created: 2011-07-04
22  Time-stamp: <2015-05-19 10:42:32 (hauspie)>
23 
24  GPIO driver for LPC.
25 */
26 #ifndef __RFLPC_GPIO_H__
27 #define __RFLPC_GPIO_H__
28 
29 #include <stdint.h>
30 #include "../nxp/LPC17xx.h"
31 #include "../tools.h"
32 #include "../pinconf.h"
33 
43 extern void rflpc_gpio_use_pin(rflpc_pin_t pin, rflpc_pin_mode_t mode);
44 
49 
57 extern void rflpc_gpio_set_pin_mode_output(rflpc_pin_t pin, uint8_t val);
58 
60 extern void rflpc_gpio_set_pin(rflpc_pin_t pin);
61 
63 extern void rflpc_gpio_clr_pin(rflpc_pin_t pin);
64 
66 extern void rflpc_gpio_set_pins_from_mask(uint8_t gpio, uint32_t mask);
67 
69 extern void rflpc_gpio_clr_pins_from_mask(uint8_t gpio, uint32_t mask);
70 
72 extern void rflpc_gpio_set_pin_val(rflpc_pin_t pin, int val);
73 
75 extern void rflpc_gpio_set_val(uint8_t gpio, uint32_t val, uint32_t mask);
76 
78 extern int rflpc_gpio_get_pin(rflpc_pin_t pin);
79 
81 extern uint32_t rflpc_gpio_get_val(uint8_t gpio);
82 
83 
86 #endif
void rflpc_gpio_set_pin_mode_output(rflpc_pin_t pin, uint8_t val)
Sets a pin to output mode Uses a pin as output pin and sets its value.
void rflpc_gpio_use_pin(rflpc_pin_t pin, rflpc_pin_mode_t mode)
Configures the multi-purpose pins of the CM3 so that it uses a given GPIO pin.
uint8_t rflpc_pin_t
Represents a pin.
Definition: pinconf.h:44
void rflpc_gpio_set_pin(rflpc_pin_t pin)
Set a pin (put a logical 1 on it)
void rflpc_gpio_set_pin_mode_input(rflpc_pin_t pin, rflpc_pin_mode_t mode)
Sets a pin to input mode.
rflpc_pin_mode_t
Pin mode.
Definition: pinconf.h:156
uint32_t rflpc_gpio_get_val(uint8_t gpio)
Gets the value of the entire port.
void rflpc_gpio_set_val(uint8_t gpio, uint32_t val, uint32_t mask)
Sets the value of multiple pins of a given port from a mask and a value.
void rflpc_gpio_set_pin_val(rflpc_pin_t pin, int val)
Sets the value of a pin (0 or 1)
void rflpc_gpio_set_pins_from_mask(uint8_t gpio, uint32_t mask)
Set multiple pins from a mask.
int rflpc_gpio_get_pin(rflpc_pin_t pin)
Gets the value of a pin.
void rflpc_gpio_clr_pin(rflpc_pin_t pin)
Clear a pin (put a logical 0 on it)
void rflpc_gpio_clr_pins_from_mask(uint8_t gpio, uint32_t mask)
Clean multiple pins from a mask.