PSoC 6 Hardware Abstraction Layer (HAL)

General Description

Definitions for the pinout for each supported device

Macros

#define CY_GPIO_CFG_GET_MODE(x)   ((uint8_t)((x) & 0xFF))
 
#define CY_GPIO_CFG_GET_HSIOM(x)   ((en_hsiom_sel_t)(((x) >> 8) & 0xFF))
 
#define CYHAL_GET_PIN(pin)   ((uint8_t)(pin & 0xFFFFUL))
 
#define CYHAL_GET_PORT(pin)   ((uint8_t)((uint32_t)(pin >> 16) & 0xFFUL))
 
#define CY_UTILS_GET_RESOURCE(pin, mappings)   cyhal_utils_get_resource(pin, mappings, sizeof(mappings)/sizeof(cyhal_resource_pin_mapping_t))
 

Typedefs

typedef uint16_t cyhal_gpio_mapping_cfg_t
 

Enumerations

enum  cyhal_port_t {
  CYHAL_PORT_0 = 0x0, CYHAL_PORT_1 = 0x1, CYHAL_PORT_2 = 0x2, CYHAL_PORT_3 = 0x3,
  CYHAL_PORT_4 = 0x4, CYHAL_PORT_5 = 0x5, CYHAL_PORT_6 = 0x6, CYHAL_PORT_7 = 0x7,
  CYHAL_PORT_8 = 0x8, CYHAL_PORT_9 = 0x9, CYHAL_PORT_10 = 0xA, CYHAL_PORT_11 = 0xB,
  CYHAL_PORT_12 = 0xC, CYHAL_PORT_13 = 0xD, CYHAL_PORT_14 = 0xE, CYHAL_PORT_15 = 0xF
}
 

Functions

static cyhal_resource_inst_t cyhal_utils_get_gpio_resource (cyhal_gpio_t pin)
 
const cyhal_resource_pin_mapping_t * cyhal_utils_get_resource (cyhal_gpio_t pin, const cyhal_resource_pin_mapping_t *mappings, size_t count)
 
void cyhal_utils_disconnect_and_free (cyhal_gpio_t pin)
 

Macro Definition Documentation

◆ CY_GPIO_CFG_GET_MODE

#define CY_GPIO_CFG_GET_MODE (   x)    ((uint8_t)((x) & 0xFF))

Extract the GPIO mode setting from a cyhal_gpio_mapping_cfg_t

◆ CY_GPIO_CFG_GET_HSIOM

#define CY_GPIO_CFG_GET_HSIOM (   x)    ((en_hsiom_sel_t)(((x) >> 8) & 0xFF))

Extract the HSIOM selection from a cyhal_gpio_mapping_cfg_t

◆ CYHAL_GET_PIN

#define CYHAL_GET_PIN (   pin)    ((uint8_t)(pin & 0xFFFFUL))

Macro to extract the pin number

◆ CYHAL_GET_PORT

#define CYHAL_GET_PORT (   pin)    ((uint8_t)((uint32_t)(pin >> 16) & 0xFFUL))

Macro to extract the port number

◆ CY_UTILS_GET_RESOURCE

#define CY_UTILS_GET_RESOURCE (   pin,
  mappings 
)    cyhal_utils_get_resource(pin, mappings, sizeof(mappings)/sizeof(cyhal_resource_pin_mapping_t))

Looks up the resource block that connects to the specified pins from the provided resource pin mapping table. This is a convinience utility for cyhal_utils_get_resource() if the mappings is an array of known size.

Parameters
[in]pinThe pin to lookup the hardware block for
[in]mappingsThe mappings of pin to hardware block
Returns
The entry for the specified pin if it exists, or null if it doesn't.

Typedef Documentation

◆ cyhal_gpio_mapping_cfg_t

typedef uint16_t cyhal_gpio_mapping_cfg_t

Bitfield representing the configuration of a GPIO (hsiom selection and mode). Use the CY_GPIO_CFG_GET_MODE and CY_GPIO_CFG_GET_HSIOM to extract the individual field values.

Enumeration Type Documentation

◆ cyhal_port_t

Port names

Function Documentation

◆ cyhal_utils_get_gpio_resource()

static cyhal_resource_inst_t cyhal_utils_get_gpio_resource ( cyhal_gpio_t  pin)
inlinestatic

Converts the provided gpio pin to a resource instance object

Parameters
[in]pinThe pin to get a resource object for
Returns
The equivilant resource instance object for the provided pin.

◆ cyhal_utils_get_resource()

const cyhal_resource_pin_mapping_t* cyhal_utils_get_resource ( cyhal_gpio_t  pin,
const cyhal_resource_pin_mapping_t *  mappings,
size_t  count 
)

Looks up the resource block that connects to the specified pins from the provided resource pin mapping table.

Parameters
[in]pinThe pin to lookup the hardware block for
[in]mappingsThe mappings of pin to hardware block
[in]countThe number of items in the mappings table
Returns
The entry for the specified pin if it exists, or null if it doesn't.

◆ cyhal_utils_disconnect_and_free()

void cyhal_utils_disconnect_and_free ( cyhal_gpio_t  pin)

Disconnects any routing for the pin from the interconnect driver and then free's the pin from the hwmgr.

Parameters
[in]pinThe pin to disconnect and free