LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
CHIP: LPC8xx GPIO Driver

Detailed Description

This driver provides GPIO support for the device. The driver requires the following IP drivers:
IP: GPIO register block and driver

Macros

#define LPC8XX_PORT_NUM   (0)
 

Enumerations

enum  CHIP_PIN_DIR_T { PIN_DIR_INPUT = 0, PIN_DIR_OUTPUT = 1 }
 

Functions

STATIC INLINE void Chip_GPIO_Init (LPC_GPIO_T *pGPIO)
 Initialize GPIO block.
 
STATIC INLINE void Chip_GPIO_WritePortBit (LPC_GPIO_T *pGPIO, uint32_t port, uint8_t bit, bool setting)
 Set a GPIO port/bit state.
 
STATIC INLINE void Chip_GPIO_WriteDirBit (LPC_GPIO_T *pGPIO, uint32_t port, uint8_t bit, bool setting)
 Seta GPIO direction.
 
STATIC INLINE bool Chip_GPIO_ReadPortBit (LPC_GPIO_T *pGPIO, uint32_t port, uint8_t bit)
 Read a GPIO state.
 
STATIC INLINE bool Chip_GPIO_ReadDirBit (LPC_GPIO_T *pGPIO, uint32_t port, uint8_t bit)
 Read a GPIO direction (out or in)
 
void Chip_GPIO_SetDir (LPC_GPIO_T *pGPIO, uint8_t portNum, uint32_t bitValue, uint8_t out)
 Set Direction for a GPIO port.
 
STATIC INLINE void Chip_FIO_SetValue (LPC_GPIO_T *pGPIO, uint8_t portNum, uint32_t bitValue)
 Set a GPIO port/bit to the high state.
 
STATIC INLINE void Chip_FIO_ClearValue (LPC_GPIO_T *pGPIO, uint8_t portNum, uint32_t bitValue)
 Set a GPIO port/bit to the low state.
 
STATIC INLINE uint32_t Chip_FIO_ReadValue (LPC_GPIO_T *pGPIO, uint8_t portNum)
 Read current bit states for the selected port.
 

Macro Definition Documentation

#define LPC8XX_PORT_NUM   (0)

Definition at line 47 of file gpio_8xx.h.

Enumeration Type Documentation

Enumerator:
PIN_DIR_INPUT 
PIN_DIR_OUTPUT 

Definition at line 49 of file gpio_8xx.h.

Function Documentation

STATIC INLINE void Chip_FIO_ClearValue ( LPC_GPIO_T pGPIO,
uint8_t  portNum,
uint32_t  bitValue 
)

Set a GPIO port/bit to the low state.

Parameters
pGPIO: The base of GPIO peripheral on the chip
portNum: Port number
bitValue: Bit(s) in the port to set low
Returns
None
Note
Any bit set as a '0' will not have it's state changed. This only applies to ports configured as an output.

Definition at line 146 of file gpio_8xx.h.

STATIC INLINE uint32_t Chip_FIO_ReadValue ( LPC_GPIO_T pGPIO,
uint8_t  portNum 
)

Read current bit states for the selected port.

Parameters
pGPIO: The base of GPIO peripheral on the chip
portNum: Port number to read
Returns
Current value of GPIO port
Note
The current states of the bits for the port are read, regardless of whether the GPIO port bits are input or output.

Definition at line 160 of file gpio_8xx.h.

STATIC INLINE void Chip_FIO_SetValue ( LPC_GPIO_T pGPIO,
uint8_t  portNum,
uint32_t  bitValue 
)

Set a GPIO port/bit to the high state.

Parameters
pGPIO: The base of GPIO peripheral on the chip
portNum: Port number
bitValue: Bit(s) in the port to set high
Returns
None
Note
Any bit set as a '0' will not have it's state changed. This only applies to ports configured as an output.

Definition at line 131 of file gpio_8xx.h.

STATIC INLINE void Chip_GPIO_Init ( LPC_GPIO_T pGPIO)

Initialize GPIO block.

Parameters
pGPIO: The base of GPIO peripheral on the chip
Returns
Nothing

Definition at line 56 of file gpio_8xx.h.

STATIC INLINE bool Chip_GPIO_ReadDirBit ( LPC_GPIO_T pGPIO,
uint32_t  port,
uint8_t  bit 
)

Read a GPIO direction (out or in)

Parameters
pGPIO: The base of GPIO peripheral on the chip
port: GPIO port to read
bit: GPIO bit to read
Returns
true of the GPIO is an output, false if input

Definition at line 106 of file gpio_8xx.h.

STATIC INLINE bool Chip_GPIO_ReadPortBit ( LPC_GPIO_T pGPIO,
uint32_t  port,
uint8_t  bit 
)

Read a GPIO state.

Parameters
pGPIO: The base of GPIO peripheral on the chip
port: GPIO port to read
bit: GPIO bit to read
Returns
true of the GPIO is high, false if low

Definition at line 94 of file gpio_8xx.h.

void Chip_GPIO_SetDir ( LPC_GPIO_T pGPIO,
uint8_t  portNum,
uint32_t  bitValue,
uint8_t  out 
)

Set Direction for a GPIO port.

Parameters
pGPIO: The base of GPIO peripheral on the chip
portNum: Port Number
bitValue: GPIO bit to set
out: Direction value, 0 = input, !0 = output
Returns
None
Note
Bits set to '0' are not altered.

Definition at line 68 of file gpio_11xx.c.

STATIC INLINE void Chip_GPIO_WriteDirBit ( LPC_GPIO_T pGPIO,
uint32_t  port,
uint8_t  bit,
bool  setting 
)

Seta GPIO direction.

Parameters
pGPIO: The base of GPIO peripheral on the chip
port: GPIO port to set
bit: GPIO bit to set
setting: true for output, false for input
Returns
Nothing

Definition at line 82 of file gpio_8xx.h.

STATIC INLINE void Chip_GPIO_WritePortBit ( LPC_GPIO_T pGPIO,
uint32_t  port,
uint8_t  bit,
bool  setting 
)

Set a GPIO port/bit state.

Parameters
pGPIO: The base of GPIO peripheral on the chip
port: GPIO port to set
bit: GPIO bit to set
setting: true for high, false for low
Returns
Nothing

Definition at line 69 of file gpio_8xx.h.