openMMC
Open Source Modular MMC for AMCs
Loading...
Searching...
No Matches
lpc17_gpio.h
Go to the documentation of this file.
1/*
2 * openMMC --
3 *
4 * Copyright (C) 2015 Henrique Silva <henrique.silva@lnls.br>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
26#ifdef LPC17_GPIO_H_
27#undef LPC17_GPIO_H_
28#endif
29#define LPC17_GPIO_H_
30
31#include "gpio_17xx_40xx.h"
32
33#define GPIO_LEVEL_LOW 0
34#define GPIO_LEVEL_HIGH 1
35
36#define GPIO_DIR_INPUT 0
37#define GPIO_DIR_OUTPUT 1
38
43#define gpio_init() Chip_GPIO_Init( LPC_GPIO )
44
51#define gpio_read_pin( port, pin ) Chip_GPIO_GetPinState( LPC_GPIO, port, pin )
52
58#define gpio_read_port( port ) Chip_GPIO_GetPortValue( LPC_GPIO, port )
59
66#define gpio_set_pin_high( port, pin ) Chip_GPIO_SetPinOutHigh( LPC_GPIO, port, pin )
67
74#define gpio_set_port_high( port, mask ) Chip_GPIO_SetPortOutHigh( LPC_GPIO, port, mask )
75
82#define gpio_set_pin_low( port, pin ) Chip_GPIO_SetPinOutLow( LPC_GPIO, port, pin )
83
90#define gpio_set_port_low( port, mask ) Chip_GPIO_SetPortOutLow( LPC_GPIO, port, mask )
91
98#define gpio_pin_toggle( port, pin ) Chip_GPIO_SetPinToggle( LPC_GPIO, port, pin )
99
106#define gpio_set_pin_state( port, pin, state ) Chip_GPIO_SetPinState( LPC_GPIO, port, pin, state )
107
114#define gpio_set_pin_dir( port, pin, dir ) Chip_GPIO_SetPinDIR( LPC_GPIO, port, pin, dir )
115
122#define gpio_get_pin_dir( port, pin ) Chip_GPIO_GetPinDIR( LPC_GPIO, port, pin )
123
129#define gpio_set_port_dir( port, dir ) Chip_GPIO_SetPortDIR( LPC_GPIO, port, dir )
130
136#define gpio_get_port_dir( port ) Chip_GPIO_GetPortDIR( LPC_GPIO, port )