![]() |
NHS31xx SW API
|
The general purpose input/output (GPIO) driver:
The IOCON driver has to be used to configure the digital IO pins as GPIO. All digital IO pins, in most cases defaults to GPIO function mode at startup and are configured as inputs without interrupt. See IO Configuration driver iocon: IO Configuration driver for details.
The following naming convention is used in this GPIO driver:
Data Structures | |
struct | NSS_GPIO_T |
Macros | |
#define | NSS_GPIOn_PINMASK(x) (1<<(x)) |
Enumerations | |
enum | GPIO_INT_MODE_T { GPIO_INT_ACTIVE_LOW_LEVEL = 0x0, GPIO_INT_ACTIVE_HIGH_LEVEL = 0x1, GPIO_INT_FALLING_EDGE = 0x2, GPIO_INT_RISING_EDGE = 0x3, GPIO_INT_BOTH_EDGES = 0x6 } |
Functions | |
void | Chip_GPIO_Init (NSS_GPIO_T *pGPIO) |
void | Chip_GPIO_DeInit (NSS_GPIO_T *pGPIO) |
static void | Chip_GPIO_SetPinState (NSS_GPIO_T *pGPIO, uint8_t port, uint8_t pin, bool setting) |
static bool | Chip_GPIO_GetPinState (NSS_GPIO_T *pGPIO, uint8_t port, uint8_t pin) |
static void | Chip_GPIO_SetPinDIROutput (NSS_GPIO_T *pGPIO, uint8_t port, uint8_t pin) |
static void | Chip_GPIO_SetPinDIRInput (NSS_GPIO_T *pGPIO, uint8_t port, uint8_t pin) |
void | Chip_GPIO_SetPinDIR (NSS_GPIO_T *pGPIO, uint8_t port, uint8_t pin, bool output) |
static bool | Chip_GPIO_GetPinDIR (NSS_GPIO_T *pGPIO, uint8_t port, uint8_t pin) |
static void | Chip_GPIO_SetPortDIROutput (NSS_GPIO_T *pGPIO, uint8_t port, uint32_t pinMask) |
static void | Chip_GPIO_SetPortDIRInput (NSS_GPIO_T *pGPIO, uint8_t port, uint32_t pinMask) |
void | Chip_GPIO_SetPortDIR (NSS_GPIO_T *pGPIO, uint8_t port, uint32_t pinMask, bool outSet) |
static uint32_t | Chip_GPIO_GetPortDIR (NSS_GPIO_T *pGPIO, uint8_t port) |
static void | Chip_GPIO_SetPortValue (NSS_GPIO_T *pGPIO, uint8_t port, uint32_t value) |
static uint32_t | Chip_GPIO_GetPortValue (NSS_GPIO_T *pGPIO, uint8_t port) |
static void | Chip_GPIO_SetPortOutHigh (NSS_GPIO_T *pGPIO, uint8_t port, uint32_t pinMask) |
static void | Chip_GPIO_SetPinOutHigh (NSS_GPIO_T *pGPIO, uint8_t port, uint8_t pin) |
static void | Chip_GPIO_SetPortOutLow (NSS_GPIO_T *pGPIO, uint8_t port, uint32_t pinMask) |
static void | Chip_GPIO_SetPinOutLow (NSS_GPIO_T *pGPIO, uint8_t port, uint8_t pin) |
static void | Chip_GPIO_SetPortToggle (NSS_GPIO_T *pGPIO, uint8_t port, uint32_t pinMask) |
static void | Chip_GPIO_SetPinToggle (NSS_GPIO_T *pGPIO, uint8_t port, uint8_t pin) |
static void | Chip_GPIO_SetPinModeEdge (NSS_GPIO_T *pGPIO, uint8_t port, uint32_t pinmask) |
static void | Chip_GPIO_SetPinModeLevel (NSS_GPIO_T *pGPIO, uint8_t port, uint32_t pinmask) |
static uint32_t | Chip_GPIO_IsLevelEnabled (NSS_GPIO_T *pGPIO, uint8_t port) |
static void | Chip_GPIO_SetEdgeModeBoth (NSS_GPIO_T *pGPIO, uint8_t port, uint32_t pinmask) |
static void | Chip_GPIO_SetEdgeModeSingle (NSS_GPIO_T *pGPIO, uint8_t port, uint32_t pinmask) |
static uint32_t | Chip_GPIO_GetEdgeModeDir (NSS_GPIO_T *pGPIO, uint8_t port) |
static void | Chip_GPIO_SetModeHigh (NSS_GPIO_T *pGPIO, uint8_t port, uint32_t pinmask) |
static void | Chip_GPIO_SetModeLow (NSS_GPIO_T *pGPIO, uint8_t port, uint32_t pinmask) |
static uint32_t | Chip_GPIO_GetModeHighLow (NSS_GPIO_T *pGPIO, uint8_t port) |
static void | Chip_GPIO_EnableInt (NSS_GPIO_T *pGPIO, uint8_t port, uint32_t pinmask) |
static void | Chip_GPIO_DisableInt (NSS_GPIO_T *pGPIO, uint8_t port, uint32_t pinmask) |
static uint32_t | Chip_GPIO_GetEnabledInts (NSS_GPIO_T *pGPIO, uint8_t port) |
static uint32_t | Chip_GPIO_GetRawInts (NSS_GPIO_T *pGPIO, uint8_t port) |
static uint32_t | Chip_GPIO_GetMaskedInts (NSS_GPIO_T *pGPIO, uint8_t port) |
static void | Chip_GPIO_ClearInts (NSS_GPIO_T *pGPIO, uint8_t port, uint32_t pinmask) |
void | Chip_GPIO_SetupPinInt (NSS_GPIO_T *pGPIO, uint8_t port, uint8_t pin, GPIO_INT_MODE_T mode) |
struct NSS_GPIO_T |
GPIO port register block structure
Data Fields | ||
---|---|---|
__IO uint32_t | DATA[4096] |
Offset: 0x0000 to 0x3FFC Data address masking register (R/W) |
uint32_t | RESERVED1[4096] | |
__IO uint32_t | DIR |
Offset: 0x8000 Data direction register (R/W) |
__IO uint32_t | IS |
Offset: 0x8004 Interrupt sense register (R/W) |
__IO uint32_t | IBE |
Offset: 0x8008 Interrupt both edges register (R/W) |
__IO uint32_t | IEV |
Offset: 0x800C Interrupt event register (R/W) |
__IO uint32_t | IE |
Offset: 0x8010 Interrupt mask register (R/W) |
__I uint32_t | RIS |
Offset: 0x8014 Raw interrupt status register (R) |
__I uint32_t | MIS |
Offset: 0x8018 Masked interrupt status register (R) |
__O uint32_t | IC |
Offset: 0x801C Interrupt clear register (W) |
uint32_t | RESERVED2[8184] |
#define NSS_GPIOn_PINMASK | ( | x | ) | (1<<(x)) |
Pin x mask definition
enum GPIO_INT_MODE_T |
GPIO interrupt mode definitions
void Chip_GPIO_Init | ( | NSS_GPIO_T * | pGPIO | ) |
Initialise GPIO block
pGPIO | : The base address of GPIO peripheral on the chip |
void Chip_GPIO_DeInit | ( | NSS_GPIO_T * | pGPIO | ) |
De-Initialise GPIO block
pGPIO | : The base address of GPIO peripheral on the chip |
|
inlinestatic |
Set a GPIO pin state via the GPIO byte register
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pin | : GPIO pin to set |
setting | : true for setting pin to high, false for low |
|
inlinestatic |
Get a GPIO pin state via the GPIO byte register
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pin | : GPIO pin to get state for |
|
inlinestatic |
Set GPIO direction for a single GPIO pin to an output
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pin | : GPIO pin to set direction as output |
|
inlinestatic |
Set GPIO direction for a single GPIO pin to an input
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pin | : GPIO pin to set direction as input |
void Chip_GPIO_SetPinDIR | ( | NSS_GPIO_T * | pGPIO, |
uint8_t | port, | ||
uint8_t | pin, | ||
bool | output | ||
) |
Set GPIO direction for a single GPIO pin
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pin | : GPIO pin to set direction for |
output | : true for setting as output, false for input |
|
inlinestatic |
Get GPIO direction for a single GPIO pin
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pin | : GPIO pin to get direction for |
|
inlinestatic |
Set GPIO direction for all selected GPIO pins to an output
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pinMask | : GPIO pin mask to set direction on as output (ORed value of bits 0..11 for pins 0..11) |
|
inlinestatic |
Set GPIO direction for all selected GPIO pins to an input
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pinMask | : GPIO pin mask to set direction on as input (ORed value of bits 0..11 for pins 0..11) |
void Chip_GPIO_SetPortDIR | ( | NSS_GPIO_T * | pGPIO, |
uint8_t | port, | ||
uint32_t | pinMask, | ||
bool | outSet | ||
) |
Set GPIO direction for all selected GPIO pins to an input or output
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pinMask | : GPIO pin mask to set direction on (ORed value of bits 0..11 for pins 0..11) |
outSet | : Direction value. Use false to set as inputs and true to set as outputs |
|
inlinestatic |
Get GPIO direction for all GPIO pins
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
|
inlinestatic |
Set all GPIO raw pin states as a group
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
value | : A 12-bit value to set all GPIO pin states (0..11) to |
|
inlinestatic |
Get all GPIO raw pin states as a group
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
|
inlinestatic |
Set selected GPIO output pins to the high state
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pinMask | : A pin mask to select pins to be set as high (ORed value of bits 0..11 for pins 0..11) |
|
inlinestatic |
Set an individual GPIO output pin to the high state
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pin | : pin number (0..11) to be set high |
|
inlinestatic |
Set selected GPIO output pins to the low state
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pinMask | : A pin mask to select pin to be set as low (ORed value of bits 0..11 for pins 0..11) |
|
inlinestatic |
Set an individual GPIO output pin to the low state
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pin | : pin number (0..11) to set low |
|
inlinestatic |
Toggle selected GPIO output pins to the opposite state
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pinMask | : A pin mask to select pins to be toggled (ORed value of bits 0..11 for pins 0..11) |
|
inlinestatic |
Toggle an individual GPIO output pin to the opposite state
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pin | : pin number (0..11) to toggle |
|
inlinestatic |
Configure the pins as edge sensitive for interrupts
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pinmask | : A pin mask to select pins to be set to edge trigger mode (ORed value of bits 0..11) |
|
inlinestatic |
Configure the pins as level sensitive for interrupts
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pinmask | : A pin mask to select pins to be set to level trigger mode (ORed value of bits 0..11) |
|
inlinestatic |
Returns current GPIO edge or high level interrupt configuration for all pins of a port
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
|
inlinestatic |
Sets GPIO interrupt configuration for both edges for selected pins
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pinmask | : A pin mask to select pins to be set to dual edge trigger mode (ORed value of bits 0..11) |
|
inlinestatic |
Sets GPIO interrupt configuration for a single edge for selected pins
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pinmask | : A pin mask to select pins to be set to single edge trigger mode (ORed value of bits 0..11) |
|
inlinestatic |
Returns current GPIO interrupt single or dual edge configuration for all pins of a port
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
|
inlinestatic |
Sets GPIO interrupt configuration, when in single edge or level mode to trigger on high edge or high level
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pinmask | : A pin mask to select pins to be set to high mode (ORed value of bits 0..11) |
|
inlinestatic |
Sets GPIO interrupt configuration, when in single edge or level mode to trigger on low edge or low level
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pinmask | : A pin mask to select pins to be set to low mode (ORed value of bits 0..11) |
|
inlinestatic |
Returns current GPIO interrupt edge direction or level mode
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
|
inlinestatic |
Enables interrupts for selected pins on a port
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pinmask | : A pin mask to select pins to enable interrupts on (ORed value of bits 0..11) |
|
inlinestatic |
Disables interrupts for selected pins on a port
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pinmask | : A pin mask to select pins to disable interrupts on (ORed value of bits 0..11) |
|
inlinestatic |
Returns current interrupt enabled pins for a port
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
|
inlinestatic |
Returns raw interrupt pending status for all pins for a port
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
|
inlinestatic |
Returns masked interrupt pending status for all pins for a port
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
|
inlinestatic |
Clears pending interrupts for selected pins for a port
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pinmask | : A pin mask to select pins on to clear interrupts on (ORed value of bits 0..11) |
void Chip_GPIO_SetupPinInt | ( | NSS_GPIO_T * | pGPIO, |
uint8_t | port, | ||
uint8_t | pin, | ||
GPIO_INT_MODE_T | mode | ||
) |
Composite function for setting up a full interrupt configuration for a single pin
pGPIO | : The base address of GPIO peripheral on the chip |
port | : Port number |
pin | : Pin number (0..11) |
mode | : GPIO interrupt mode selection |