LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
IP: GPIO register block and driver (003)

Detailed Description

Data Structures

struct  IP_GPIO_003_T
 GPIO port register block structure. More...
 

Enumerations

enum  IP_GPIOPININT_MODE_T {
  GPIOPININT_FALLING_EDGE = 0, GPIOPININT_ACTIVE_LOW_LEVEL = 1, GPIOPININT_RISING_EDGE = (1 << 12), GPIOPININT_ACTIVE_HIGH_LEVEL = 1 | (1 << 12),
  GPIOPININT_BOTH_EDGES = (1 << 24), GPIOPININT_RISING_EDGE = 0x01, GPIOPININT_FALLING_EDGE = 0x02, GPIOPININT_RISING_EDGE = 0x01,
  GPIOPININT_FALLING_EDGE = 0x02, GPIOPININT_ACTIVE_HIGH_LEVEL = 0x04, GPIOPININT_ACTIVE_LOW_LEVEL = 0x08
}
 

Functions

STATIC INLINE void IP_GPIO_Init (IP_GPIO_003_T *pGPIO)
 Initialize GPIO block.
 
STATIC INLINE void IP_GPIO_WritePort (IP_GPIO_003_T *pGPIO, uint16_t mask, uint16_t val)
 Write data to port.
 
STATIC INLINE void IP_GPIO_WritePortBit (IP_GPIO_003_T *pGPIO, uint8_t pin, bool val)
 Set state of pin.
 
STATIC INLINE uint32_t IP_GPIO_ReadPort (IP_GPIO_003_T *pGPIO)
 Read port state.
 
STATIC INLINE bool IP_GPIO_ReadPortBit (IP_GPIO_003_T *pGPIO, uint8_t pin)
 Read pin state.
 
STATIC INLINE void IP_GPIO_WriteDirBit (IP_GPIO_003_T *pGPIO, uint8_t pin, bool dir)
 Set GPIO direction for a pin.
 
STATIC INLINE void IP_GPIO_SetDir (IP_GPIO_003_T *pGPIO, uint32_t bitVal, bool dir)
 Set GPIO direction for a port.
 
STATIC INLINE bool IP_GPIO_ReadDirBit (IP_GPIO_003_T *pGPIO, uint8_t pin)
 Read a GPIO direction (out or in)
 
void IP_GPIO_IntCmd (IP_GPIO_003_T *pGPIO, uint8_t pin, IP_GPIOPININT_MODE_T mode)
 Configure GPIO Interrupt.
 
STATIC INLINE bool IP_GPIO_IntGetStatus (IP_GPIO_003_T *pGPIO, uint8_t pin)
 Get GPIO Interrupt Status.
 
STATIC INLINE void IP_GPIO_IntClear (IP_GPIO_003_T *pGPIO, uint8_t pin)
 Clear GPIO Interrupt (Edge interrupt cases only)
 

Enumeration Type Documentation

Enumerator:
GPIOPININT_FALLING_EDGE 

Selects interrupt on pin x to be triggered on FALLING level

GPIOPININT_ACTIVE_LOW_LEVEL 

Selects interrupt on pin x to be triggered on LOW level

GPIOPININT_RISING_EDGE 

Selects interrupt on pin x to be triggered on RISING level

GPIOPININT_ACTIVE_HIGH_LEVEL 

Selects interrupt on pin x to be triggered on HIGH level

GPIOPININT_BOTH_EDGES 

Selects interrupt on pin x to be triggered on both edges

GPIOPININT_RISING_EDGE 
GPIOPININT_FALLING_EDGE 
GPIOPININT_RISING_EDGE 
GPIOPININT_FALLING_EDGE 
GPIOPININT_ACTIVE_HIGH_LEVEL 
GPIOPININT_ACTIVE_LOW_LEVEL 

Definition at line 163 of file gpio_003.h.

Function Documentation

STATIC INLINE void IP_GPIO_Init ( IP_GPIO_003_T pGPIO)

Initialize GPIO block.

Parameters
pGPIO: the base address of the GPIO block
Returns
Nothing

Definition at line 68 of file gpio_003.h.

STATIC INLINE void IP_GPIO_IntClear ( IP_GPIO_003_T pGPIO,
uint8_t  pin 
)

Clear GPIO Interrupt (Edge interrupt cases only)

Parameters
pGPIO: pointer to GPIO interrupt register block
pin: pin number
Returns
None

Definition at line 197 of file gpio_003.h.

void IP_GPIO_IntCmd ( IP_GPIO_003_T pGPIO,
uint8_t  pin,
IP_GPIOPININT_MODE_T  mode 
)

Configure GPIO Interrupt.

Parameters
pGPIO: pointer to GPIO interrupt register block
pin: GPIO port number interrupt
mode: Interrupt mode.
Returns
None
STATIC INLINE bool IP_GPIO_IntGetStatus ( IP_GPIO_003_T pGPIO,
uint8_t  pin 
)

Get GPIO Interrupt Status.

Parameters
pGPIO: pointer to GPIO interrupt register block
pin: pin number
Returns
true if interrupt is pending, otherwise false

Definition at line 186 of file gpio_003.h.

STATIC INLINE bool IP_GPIO_ReadDirBit ( IP_GPIO_003_T pGPIO,
uint8_t  pin 
)

Read a GPIO direction (out or in)

Parameters
pGPIO: the base address of the GPIO block
pin: pin number (0-11)
Returns
true of the GPIO is an output, false if input

Definition at line 158 of file gpio_003.h.

STATIC INLINE uint32_t IP_GPIO_ReadPort ( IP_GPIO_003_T pGPIO)

Read port state.

Parameters
pGPIO: the base address of the GPIO block
Returns
Port value. A 1-bit indicate the relevant pins is high.

Definition at line 102 of file gpio_003.h.

STATIC INLINE bool IP_GPIO_ReadPortBit ( IP_GPIO_003_T pGPIO,
uint8_t  pin 
)

Read pin state.

Parameters
pGPIO: the base address of the GPIO block
pin: pin number (0-11)
Returns
true of the GPIO is high, false if low

Definition at line 113 of file gpio_003.h.

STATIC INLINE void IP_GPIO_SetDir ( IP_GPIO_003_T pGPIO,
uint32_t  bitVal,
bool  dir 
)

Set GPIO direction for a port.

Parameters
pGPIO: the base address of the GPIO block
bitVal: bit value
dir: true for output, false for input
Returns
Nothing

Definition at line 142 of file gpio_003.h.

STATIC INLINE void IP_GPIO_WriteDirBit ( IP_GPIO_003_T pGPIO,
uint8_t  pin,
bool  dir 
)

Set GPIO direction for a pin.

Parameters
pGPIO: the base address of the GPIO block
pin: pin number (0-11)
dir: true for output, false for input
Returns
Nothing

Definition at line 125 of file gpio_003.h.

STATIC INLINE void IP_GPIO_WritePort ( IP_GPIO_003_T pGPIO,
uint16_t  mask,
uint16_t  val 
)

Write data to port.

Parameters
pGPIO: the base address of the GPIO block
mask: determines which pins will be written. bits [11:0] address pins PIOn.0~PIOn.11. If bit's value is 1, the state of the relevant pin is updated. Otherwise, it is unchanged.
val: bit values.
Returns
Nothing
Note
mask is in range 0~4095.

Definition at line 80 of file gpio_003.h.

STATIC INLINE void IP_GPIO_WritePortBit ( IP_GPIO_003_T pGPIO,
uint8_t  pin,
bool  val 
)

Set state of pin.

Parameters
pGPIO: the base address of the GPIO block
pin: pin number (0-11)
val: true for high, false for low
Returns
Nothing

Definition at line 92 of file gpio_003.h.