Go to the source code of this file.
Data Structures | |
struct | GPIO_VECTOR |
struct | GPIO_SIGNAL |
Defines | |
#define | NUTGPIO_PORT 0 |
#define | NUTGPIO_PORTA 1 |
#define | NUTGPIO_PORTB 2 |
#define | NUTGPIO_PORTC 3 |
#define | NUTGPIO_PORTD 4 |
#define | NUTGPIO_PORTE 5 |
#define | NUTGPIO_PORTF 6 |
#define | NUTGPIO_PORTG 7 |
#define | NUTGPIO_PORTH 8 |
#define | NUTGPIO_PORTI 9 |
#define | NUTGPIO_PORTJ 10 |
#define | NUTGPIO_PORTK 11 |
#define | NUTGPIO_PORTL 12 |
#define | NUTGPIO_EXTINT0 1 |
#define | NUTGPIO_EXTINT1 2 |
#define | NUTGPIO_EXTINT2 3 |
#define | NUTGPIO_EXTINT3 4 |
#define | NUTGPIO_EXTINT4 5 |
#define | NUTGPIO_EXTINT5 6 |
#define | NUTGPIO_EXTINT6 7 |
#define | NUTGPIO_EXTINT7 8 |
#define | NUTGPIO_EXTFIQ0 -1 |
#define | GPIO_CFG_INPUT 0x00000000 |
GPIO input. | |
#define | GPIO_CFG_DISABLED 0x00000001 |
GPIO disabled. | |
#define | GPIO_CFG_OUTPUT 0x00000002 |
GPIO output direction enabled. | |
#define | GPIO_CFG_PULLUP 0x00000004 |
GPIO pull-up enabled. | |
#define | GPIO_CFG_MULTIDRIVE 0x00000008 |
GPIO open drain output feature enabled. | |
#define | GPIO_CFG_DEBOUNCE 0x00000010 |
GPIO input glitch filter enabled. | |
#define | GPIO_CFG_PERIPHERAL0 0x00000020 |
GPIO Peripheral 0 mux. Switch pin function to peripheral 0. | |
#define | GPIO_CFG_PERIPHERAL1 0x00000040 |
GPIO Peripheral 1 mux. Switch pin function to peripheral 1. | |
#define | GPIO_CFG_PERIPHERAL2 0x00000080 |
GPIO Peripheral 2 mux. Switch pin function to peripheral 2. | |
#define | GPIO_CFG_PERIPHERAL3 0x00000100 |
GPIO Peripheral 3 mux. Switch pin function to peripheral 3. | |
Functions | |
uint32_t | GpioPinConfigGet (int bank, int bit) |
Get pin configuration. | |
int | GpioPinConfigSet (int bank, int bit, uint32_t flags) |
Set pin configuration. | |
int | GpioPortConfigSet (int bank, unsigned int mask, uint32_t flags) |
Set port wide pin configuration. | |
int | GpioPinGet (int bank, int bit) |
Get pin level. | |
void | GpioPinSet (int bank, int bit, int value) |
Set pin level. | |
void | GpioPinSetLow (int bank, int bit) |
Set pin level to low. | |
void | GpioPinSetHigh (int bank, int bit) |
Set pin level to high. | |
unsigned int | GpioPortGet (int bank) |
Get all pin levels of a specified bank/port. | |
void | GpioPortSet (int bank, unsigned int value) |
Set all pin levels of a bank/port. | |
void | GpioPortSetLow (int bank, unsigned int mask) |
Set multiple pin levels of a bank/port to low. | |
void | GpioPortSetHigh (int bank, unsigned int mask) |
Set multiple pin levels of a bank/port to high. | |
int | GpioRegisterIrqHandler (GPIO_SIGNAL *sig, int bit, void(*handler)(void *), void *arg) |
Register a GPIO pin interrupt handler. | |
int | GpioIrqEnable (GPIO_SIGNAL *sig, int bit) |
Enable a specified GPIO interrupt. | |
int | GpioIrqDisable (GPIO_SIGNAL *sig, int bit) |
Disable a specified GPIO interrupt. |
#define NUTGPIO_PORT 0 |
Referenced by GpioPinConfigGet(), GpioPinGet(), GpioPinSetHigh(), GpioPinSetLow(), GpioPortConfigSet(), GpioPortGet(), GpioPortSetHigh(), and GpioPortSetLow().
#define NUTGPIO_PORTA 1 |
Referenced by EmacInit(), GpioPinConfigGet(), GpioPinGet(), GpioPinSetHigh(), GpioPinSetLow(), GpioPortConfigSet(), GpioPortGet(), GpioPortSetHigh(), and GpioPortSetLow().
#define NUTGPIO_PORTB 2 |
Referenced by EmacInit(), GpioPinConfigGet(), GpioPinGet(), GpioPinSetHigh(), GpioPinSetLow(), GpioPortConfigSet(), GpioPortGet(), GpioPortSetHigh(), and GpioPortSetLow().
#define NUTGPIO_PORTC 3 |
Referenced by EmacInit(), GpioPinConfigGet(), GpioPinGet(), GpioPinSetHigh(), GpioPinSetLow(), GpioPortConfigSet(), GpioPortGet(), GpioPortSetHigh(), and GpioPortSetLow().
#define NUTGPIO_PORTD 4 |
Referenced by Stm32Usart3BusSelect(), and Stm32Usart3ChipSelect().
#define NUTGPIO_PORTE 5 |
#define NUTGPIO_PORTF 6 |
#define NUTGPIO_PORTG 7 |
#define NUTGPIO_PORTH 8 |
#define NUTGPIO_PORTI 9 |
#define NUTGPIO_PORTJ 10 |
#define NUTGPIO_PORTK 11 |
#define NUTGPIO_PORTL 12 |
#define NUTGPIO_EXTINT0 1 |
#define NUTGPIO_EXTINT1 2 |
#define NUTGPIO_EXTINT2 3 |
#define NUTGPIO_EXTINT3 4 |
#define NUTGPIO_EXTINT4 5 |
#define NUTGPIO_EXTINT5 6 |
#define NUTGPIO_EXTINT6 7 |
#define NUTGPIO_EXTINT7 8 |
#define NUTGPIO_EXTFIQ0 -1 |
#define GPIO_CFG_INPUT 0x00000000 |
GPIO input.
Will configure the pin as input. This is the default state, when no other config option is given.
Referenced by NutBoardInit().
#define GPIO_CFG_DISABLED 0x00000001 |
GPIO disabled.
Will activate the pins alternate function if set. This may not work on all platforms.
Referenced by EmacInit(), GpioPinConfigGet(), GpioPinConfigSet(), GpioPortConfigSet(), and Stm32Usart3BusSelect().
#define GPIO_CFG_OUTPUT 0x00000002 |
GPIO output direction enabled.
If set, the pin is configured as an output. Otherwise it is in input mode or z-state.
Referenced by EmacInit(), GpioPinConfigGet(), GpioPinConfigSet(), GpioPortConfigSet(), GpioSpiBus0Select(), init_dio(), InitLED(), IOExpPinConfigSet(), Lpc177x_8x_MciInit(), NutBoardInit(), NutRegisterOwiBus_BB(), Stm32CanHw1Init(), Stm32CanHw2Init(), Stm32I2cBus1Init(), Stm32I2cBus1Recover(), Stm32I2cBus2Init(), Stm32I2cBus2Recover(), and Stm32Usart3BusSelect().
#define GPIO_CFG_PULLUP 0x00000004 |
GPIO pull-up enabled.
Referenced by GpioPinConfigGet(), GpioPinConfigSet(), GpioPortConfigSet(), init_dio(), InitKEY(), Mma745xInit(), NutBoardInit(), NutRegisterOwiBus_BB(), Stm32CanHw1Init(), and Stm32CanHw2Init().
#define GPIO_CFG_MULTIDRIVE 0x00000008 |
GPIO open drain output feature enabled.
If not set, the output will use push pull mode.
Referenced by GpioPinConfigGet(), GpioPinConfigSet(), GpioPortConfigSet(), NutRegisterOwiBus_BB(), Stm32I2cBus1Init(), Stm32I2cBus1Recover(), Stm32I2cBus2Init(), and Stm32I2cBus2Recover().
#define GPIO_CFG_DEBOUNCE 0x00000010 |
GPIO input glitch filter enabled.
Not supported with STM32F
Referenced by GpioPinConfigGet(), GpioPinConfigSet(), GpioPortConfigSet(), and InitKEY().
#define GPIO_CFG_PERIPHERAL0 0x00000020 |
GPIO Peripheral 0 mux. Switch pin function to peripheral 0.
Referenced by gpio_enable_module_pin(), GpioPinConfigGet(), and NutBoardInit().
#define GPIO_CFG_PERIPHERAL1 0x00000040 |
GPIO Peripheral 1 mux. Switch pin function to peripheral 1.
Referenced by gpio_enable_module_pin(), GpioPinConfigGet(), GpioPinConfigSet(), GpioPortConfigSet(), Lpc17xxEmacInit(), and NutBoardInit().
#define GPIO_CFG_PERIPHERAL2 0x00000080 |
GPIO Peripheral 2 mux. Switch pin function to peripheral 2.
Referenced by gpio_enable_module_pin(), GpioPinConfigGet(), GpioPinConfigSet(), GpioPortConfigSet(), and Lpc177x_8x_MciInit().
#define GPIO_CFG_PERIPHERAL3 0x00000100 |
GPIO Peripheral 3 mux. Switch pin function to peripheral 3.
Referenced by GpioPinConfigGet(), GpioPinConfigSet(), and GpioPortConfigSet().
int GpioPortConfigSet | ( | int | bank, |
unsigned int | mask, | ||
uint32_t | flags | ||
) |
Set port wide pin configuration.
bank | GPIO bank/port number. |
mask | The given attributes are set for a specific pin, if the corresponding bit in this mask is 1. |
flags | Attribute flags to set. |
References _BV, AT91C_ID_PIOA, AT91C_ID_PIOB, AT91C_ID_PIOC, AT91C_PIOA_IFDR, AT91C_PIOA_IFER, AT91C_PIOA_MDDR, AT91C_PIOA_MDER, AT91C_PIOA_ODR, AT91C_PIOA_OER, AT91C_PIOA_PDR, AT91C_PIOA_PER, AT91C_PIOA_PPUDR, AT91C_PIOA_PPUER, AT91C_PIOB_IFDR, AT91C_PIOB_IFER, AT91C_PIOB_MDDR, AT91C_PIOB_MDER, AT91C_PIOB_ODR, AT91C_PIOB_OER, AT91C_PIOB_PDR, AT91C_PIOB_PER, AT91C_PIOB_PPUDR, AT91C_PIOB_PPUER, AT91C_PIOC_IFDR, AT91C_PIOC_IFER, AT91C_PIOC_MDDR, AT91C_PIOC_MDER, AT91C_PIOC_ODR, AT91C_PIOC_OER, AT91C_PIOC_PDR, AT91C_PIOC_PER, AT91C_PIOC_PPUDR, AT91C_PIOC_PPUER, AT91C_PMC_PCER, AVRPORTA, AVRPORTB, AVRPORTC, AVRPORTD, AVRPORTE, AVRPORTF, AVRPORTG, AVRPORTH, AVRPORTI, AVRPORTJ, AVRPORTK, AVRPORTL, GPIO_CFG_DEBOUNCE, GPIO_CFG_DISABLED, GPIO_CFG_MULTIDRIVE, GPIO_CFG_OUTPUT, GPIO_CFG_PULLUP, inb, NUTGPIO_PORT, NUTGPIO_PORTA, NUTGPIO_PORTB, NUTGPIO_PORTC, outb, outr, PERIPHERALS_MASK, PIO_ID, PIOA_ID, PIOB_ID, PIOC_ID, and PMC_PCER.
Referenced by GpioPinConfigSet(), Stm32I2cBus1Init(), and Stm32I2cBus1Recover().
int GpioPinGet | ( | int | bank, |
int | bit | ||
) |
Get pin level.
Copyright (C) 2007 by egnite Software GmbH. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
For additional information see http://www.ethernut.de/
bank | GPIO bank/port number. |
bit | Bit number of the specified bank/port. |
Copyright (C) 2007 by egnite Software GmbH. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
For additional information see http://www.ethernut.de/
bank | GPIO bank/port number. |
bit | Bit number of the specified bank/port. |
Copyright (C) 2007 by egnite Software GmbH. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
For additional information see http://www.ethernut.de/
bank | GPIO bank/port number. |
bit | Bit number of the specified bank/port. |
References _BV, AT91C_PIOA_PDSR, AT91C_PIOB_PDSR, AT91C_PIOC_PDSR, AVRPORTA, AVRPORTB, AVRPORTC, AVRPORTD, AVRPORTE, AVRPORTF, AVRPORTG, AVRPORTH, AVRPORTI, AVRPORTJ, AVRPORTK, AVRPORTL, bit_is_set, inr, NUTGPIO_PORT, NUTGPIO_PORTA, NUTGPIO_PORTB, NUTGPIO_PORTC, and rc.
void GpioPinSet | ( | int | bank, |
int | bit, | ||
int | value | ||
) |
Set pin level.
Trying to set undefined pins is silently ignored.
bank | GPIO bank/port number. |
bit | Bit number of the specified bank/port. |
value | Level, 0 for low or any other value for high. |
References GpioPinSetHigh, and GpioPinSetLow.
void GpioPinSetLow | ( | int | bank, |
int | bit | ||
) |
Set pin level to low.
Trying to set undefined pins is silently ignored.
bank | GPIO bank/port number. |
bit | Bit number of the specified bank/port. |
References _BV, AT91C_PIOA_CODR, AT91C_PIOB_CODR, AT91C_PIOC_CODR, AVRPORTA, AVRPORTB, AVRPORTC, AVRPORTD, AVRPORTE, AVRPORTF, AVRPORTG, AVRPORTH, AVRPORTI, AVRPORTJ, AVRPORTK, AVRPORTL, cbi, NUTGPIO_PORT, NUTGPIO_PORTA, NUTGPIO_PORTB, NUTGPIO_PORTC, and outr.
void GpioPinSetHigh | ( | int | bank, |
int | bit | ||
) |
Set pin level to high.
Trying to set undefined pins is silently ignored.
bank | GPIO bank/port number. |
bit | Bit number of the specified bank/port. |
References _BV, AT91C_PIOA_SODR, AT91C_PIOB_SODR, AT91C_PIOC_SODR, AVRPORTA, AVRPORTB, AVRPORTC, AVRPORTD, AVRPORTE, AVRPORTF, AVRPORTG, AVRPORTH, AVRPORTI, AVRPORTJ, AVRPORTK, AVRPORTL, NUTGPIO_PORT, NUTGPIO_PORTA, NUTGPIO_PORTB, NUTGPIO_PORTC, outr, and sbi.
unsigned int GpioPortGet | ( | int | bank | ) |
Get all pin levels of a specified bank/port.
bank | GPIO bank/port number. |
References AT91C_PIOA_PDSR, AT91C_PIOB_PDSR, AT91C_PIOC_PDSR, AVRPORTA, AVRPORTB, AVRPORTC, AVRPORTD, AVRPORTE, AVRPORTF, AVRPORTG, AVRPORTH, AVRPORTI, AVRPORTJ, AVRPORTK, AVRPORTL, inb, inr, NUTGPIO_PORT, NUTGPIO_PORTA, NUTGPIO_PORTB, NUTGPIO_PORTC, and rc.
void GpioPortSet | ( | int | bank, |
unsigned int | value | ||
) |
Set all pin levels of a bank/port.
This routine can be used to simultaneously set all pins of a specific port. However, in some implementations the high bit values will be set before the low bit values. If this is a problem, you should use GpioPortSetHigh() and GpioPortSetLow().
bank | GPIO bank/port number. |
value | Pin levels are set to high, if the corresponding bit in this mask is 1. All other pin levels are set to low. |
References AVRPORTA, AVRPORTB, AVRPORTC, AVRPORTD, AVRPORTE, AVRPORTF, AVRPORTG, AVRPORTH, AVRPORTI, AVRPORTJ, AVRPORTK, AVRPORTL, GpioPortSetHigh, GpioPortSetLow, and outb.
void GpioPortSetLow | ( | int | bank, |
unsigned int | mask | ||
) |
Set multiple pin levels of a bank/port to low.
bank | GPIO bank/port number. |
mask | Pin levels are set to low, if the corresponding bit in this mask is 1. |
References AT91C_PIOA_CODR, AT91C_PIOB_CODR, AT91C_PIOC_CODR, GpioPortGet, GpioPortSet, NUTGPIO_PORT, NUTGPIO_PORTA, NUTGPIO_PORTB, NUTGPIO_PORTC, and outr.
void GpioPortSetHigh | ( | int | bank, |
unsigned int | mask | ||
) |
Set multiple pin levels of a bank/port to high.
Trying to set undefined ports is silently ignored.
bank | GPIO bank/port number. |
mask | Pin levels are set to high, if the corresponding bit in this mask is 1. |
References AT91C_PIOA_SODR, AT91C_PIOB_SODR, AT91C_PIOC_SODR, GpioPortGet, GpioPortSet, NUTGPIO_PORT, NUTGPIO_PORTA, NUTGPIO_PORTB, NUTGPIO_PORTC, and outr.