MAX32665 SDK Documentation  0.2
Software Development Kit Overview and API Documentation
General-Purpose Input/Output (GPIO)

Modules

 Port and Pin Definitions
 
 GPIO_Registers
 Registers, Bit Masks and Bit Positions for the GPIO Peripheral Module.
 

Data Structures

struct  gpio_cfg_t
 Structure type for configuring a GPIO port. More...
 

Typedefs

typedef void(* gpio_callback_fn) (void *cbdata)
 Type alias for a GPIO callback function with prototype: More...
 

Enumerations

enum  gpio_func_t {
  GPIO_FUNC_IN,
  GPIO_FUNC_OUT,
  GPIO_FUNC_ALT1,
  GPIO_FUNC_ALT2,
  GPIO_FUNC_ALT3,
  GPIO_FUNC_ALT4
}
 Enumeration type for the GPIO Function Type. More...
 
enum  gpio_pad_t {
  GPIO_PAD_NONE,
  GPIO_PAD_PULL_UP,
  GPIO_PAD_PULL_DOWN
}
 Enumeration type for the type of GPIO pad on a given pin. More...
 
enum  gpio_int_mode_t {
  GPIO_INT_LEVEL = 0,
  GPIO_INT_EDGE = 1
}
 Enumeration type for the interrupt modes. More...
 
enum  gpio_int_pol_t {
  GPIO_INT_FALLING = 0,
  GPIO_INT_HIGH = GPIO_INT_FALLING,
  GPIO_INT_RISING,
  GPIO_INT_LOW = GPIO_INT_RISING,
  GPIO_INT_BOTH
}
 Enumeration type for the interrupt polarity. More...
 

Functions

int GPIO_Init (void)
 Initialize GPIO. More...
 
int GPIO_Config (const gpio_cfg_t *cfg)
 Configure GPIO pin(s). More...
 
uint32_t GPIO_InGet (const gpio_cfg_t *cfg)
 Gets the pin(s) input state. More...
 
void GPIO_OutSet (const gpio_cfg_t *cfg)
 Sets the pin(s) to a high level output. More...
 
void GPIO_OutClr (const gpio_cfg_t *cfg)
 Clears the pin(s) to a low level output. More...
 
uint32_t GPIO_OutGet (const gpio_cfg_t *cfg)
 Gets the pin(s) output state. More...
 
void GPIO_OutPut (const gpio_cfg_t *cfg, uint32_t val)
 Write the pin(s) to a desired output level. More...
 
void GPIO_OutToggle (const gpio_cfg_t *cfg)
 Toggles the the pin(s) output level. More...
 
int GPIO_IntConfig (const gpio_cfg_t *cfg, gpio_int_mode_t mode, gpio_int_pol_t pol)
 Configure GPIO interrupt(s) More...
 
void GPIO_IntEnable (const gpio_cfg_t *cfg)
 Enables the specified GPIO interrupt. More...
 
void GPIO_IntDisable (const gpio_cfg_t *cfg)
 Disables the specified GPIO interrupt. More...
 
uint32_t GPIO_IntStatus (const gpio_cfg_t *cfg)
 Gets the interrupt(s) status on a GPIO pin. More...
 
void GPIO_IntClr (const gpio_cfg_t *cfg)
 Clears the interrupt(s) status on a GPIO pin. More...
 
void GPIO_RegisterCallback (const gpio_cfg_t *cfg, gpio_callback_fn callback, void *cbdata)
 Registers a callback for the interrupt on a given port and pin. More...
 
void GPIO_Handler (unsigned int port)
 GPIO IRQ Handler. More...
 

Detailed Description

Typedef Documentation

◆ gpio_callback_fn

typedef void(* gpio_callback_fn) (void *cbdata)
void callback_fn(void *cbdata);
Parameters
cbdataA void pointer to the data type as registered when GPIO_RegisterCallback() was called.

Enumeration Type Documentation

◆ gpio_func_t

Enumerator
GPIO_FUNC_IN 

GPIO Input.

GPIO_FUNC_OUT 

GPIO Output.

GPIO_FUNC_ALT1 

Alternate Function Selection.

GPIO_FUNC_ALT2 

Alternate Function Selection.

GPIO_FUNC_ALT3 

Alternate Function Selection.

GPIO_FUNC_ALT4 

Alternate Function Selection.

◆ gpio_pad_t

enum gpio_pad_t
Enumerator
GPIO_PAD_NONE 

No pull-up or pull-down.

GPIO_PAD_PULL_UP 

Set pad to weak pull-up.

GPIO_PAD_PULL_DOWN 

Set pad to weak pull-down.

◆ gpio_int_mode_t

Enumerator
GPIO_INT_LEVEL 

Interrupt is level sensitive.

GPIO_INT_EDGE 

Interrupt is edge sensitive.

◆ gpio_int_pol_t

Enumerator
GPIO_INT_FALLING 

Interrupt triggers on falling edge.

GPIO_INT_HIGH 

Interrupt triggers when level is high.

GPIO_INT_RISING 

Interrupt triggers on rising edge.

GPIO_INT_LOW 

Interrupt triggers when level is low.

GPIO_INT_BOTH 

Interrupt triggers on either edge.

Function Documentation

◆ GPIO_Init()

int GPIO_Init ( void  )
Returns
E_NO_ERROR If initialization is successful.

◆ GPIO_Config()

int GPIO_Config ( const gpio_cfg_t cfg)
Parameters
cfgPointer to configuration structure describing the pin.
Returns
E_NO_ERROR if configuration is successful

◆ GPIO_InGet()

uint32_t GPIO_InGet ( const gpio_cfg_t cfg)
Parameters
cfgPointer to configuration structure describing the pin.
Returns
The requested pin state

◆ GPIO_OutSet()

void GPIO_OutSet ( const gpio_cfg_t cfg)
Parameters
cfgPointer to configuration structure describing the pin

◆ GPIO_OutClr()

void GPIO_OutClr ( const gpio_cfg_t cfg)
Parameters
cfgPointer to configuration structure describing the pin

◆ GPIO_OutGet()

uint32_t GPIO_OutGet ( const gpio_cfg_t cfg)
Parameters
cfgPointer to configuration structure describing the pin
Returns
The state of the requested pin.

◆ GPIO_OutPut()

void GPIO_OutPut ( const gpio_cfg_t cfg,
uint32_t  val 
)
Parameters
cfgPointer to configuration structure describing the pin.
valDesired output level of the pin(s). This will be masked with the configuration mask

◆ GPIO_OutToggle()

void GPIO_OutToggle ( const gpio_cfg_t cfg)
Parameters
cfgPointer to configuration structure describing the pin

◆ GPIO_IntConfig()

int GPIO_IntConfig ( const gpio_cfg_t cfg,
gpio_int_mode_t  mode,
gpio_int_pol_t  pol 
)
Parameters
cfgPointer to configuration structure describing the pin
modeRequested interrupt mode
polRequested interrupt polarity
Returns
E_NO_ERROR If configuration is successful

◆ GPIO_IntEnable()

void GPIO_IntEnable ( const gpio_cfg_t cfg)
Parameters
cfgPointer to configuration structure describing the pin

◆ GPIO_IntDisable()

void GPIO_IntDisable ( const gpio_cfg_t cfg)
Parameters
cfgPointer to configuration structure describing the pin

◆ GPIO_IntStatus()

uint32_t GPIO_IntStatus ( const gpio_cfg_t cfg)
Parameters
cfgPointer to configuration structure describing the pin for which the status is being requested
Returns
The requested interrupt status

◆ GPIO_IntClr()

void GPIO_IntClr ( const gpio_cfg_t cfg)
Parameters
cfgPointer to configuration structure describing the pin to clear the interrupt state of

◆ GPIO_RegisterCallback()

void GPIO_RegisterCallback ( const gpio_cfg_t cfg,
gpio_callback_fn  callback,
void *  cbdata 
)
Parameters
cfgPointer to configuration structure describing the pin
callbackA pointer to a function of type gpio_callback_fn
cbdataThe parameter to be passed to the callback function, gpio_callback_fn, when an interrupt occurs.

◆ GPIO_Handler()

void GPIO_Handler ( unsigned int  port)
Note
If a callback is registered for a given interrupt, the callback function will be called.
Parameters
portnumber of the port that generated the interrupt service routine