Hardware Abstraction Layer (HAL)

General Description

The following PSoC 6 specific items have been deprecated and replaced by more generic items.

Each item will continue to work for now, but will be removed in a future release. All deprecated items reference the item that replaces it.

Macros

#define CYHAL_SYSTEM_RSLT_ERROR   (CYHAL_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_SYSTEM , 0))
 An error occurred in System module.
 
#define CYHAL_SYSTEM_RSLT_INVALID_CLK_DIVIDER   (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_SYSTEM , 1))
 An error occurred in System module.
 
#define CYHAL_SYSTEM_RSLT_UNABLE_TO_SET_CLK_FREQ   (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_SYSTEM , 2))
 An error occurred in System module.
 
#define CYHAL_SYSTEM_RSLT_SRC_CLK_DISABLED   (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_SYSTEM , 3))
 An error occurred in System module.
 
#define CYHAL_SYSTEM_RSLT_NO_VALID_DIVIDER   (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_SYSTEM , 4))
 An error occurred in System module.
 
#define cyhal_system_sleep()   Cy_SysPm_CpuEnterSleep(CY_SYSPM_WAIT_FOR_INTERRUPT)
 Attempts to put the device to sleep until an interrupt wakes it up. More...
 
#define cyhal_system_deepsleep()   Cy_SysPm_CpuEnterDeepSleep(CY_SYSPM_WAIT_FOR_INTERRUPT)
 Attempts to put the device into deep sleep until an interrupt wakes it up. More...
 

Typedefs

typedef cy_en_divider_types_t cyhal_clock_divider_types_t
 Available clock divider types. More...
 
typedef uint16_t cyhal_system_divider_t
 Divider for CM4, CM0 and Peri clock. More...
 
typedef cyhal_clock_t cyhal_clock_divider_t
 Peripheral clock divider type. More...
 

Enumerations

enum  cyhal_system_clock_t {
  CYHAL_SYSTEM_CLOCK_CM4,
  CYHAL_SYSTEM_CLOCK_CM0,
  CYHAL_SYSTEM_CLOCK_PERI
}
 Enum for clock type to configure. More...
 

Functions

cy_rslt_t cyhal_hwmgr_allocate_clock (cyhal_clock_divider_t *obj, cyhal_clock_divider_types_t div, bool accept_larger)
 Allocate (pick and reserve) an Clock Divider resource and provide a reference to it. More...
 
void cyhal_hwmgr_free_clock (cyhal_clock_divider_t *obj)
 Free the specified Clock Divider resource and allow it be used by something else. More...
 
cy_rslt_t cyhal_system_clock_get_frequency (uint8_t clock, uint32_t *frequency_hz)
 Gets the specified clock's current frequency. More...
 
cy_rslt_t cyhal_system_clock_set_frequency (uint8_t clock, uint32_t frequency_hz)
 Sets the specified clock's frequency and enables it. More...
 
cy_rslt_t cyhal_system_clock_set_divider (cyhal_system_clock_t clock, cyhal_system_divider_t divider)
 Divides the clock frequency by the divider. More...
 
cy_rslt_t cyhal_system_register_callback (cyhal_system_callback_t *callback)
 Register the specified handler with the power manager to be notified of power state changes. More...
 
cy_rslt_t cyhal_system_unregister_callback (cyhal_system_callback_t const *callback)
 Removes the registered handler from the power manager so no future notifications are made. More...
 
cy_rslt_t cyhal_adc_channel_init (cyhal_adc_channel_t *obj, cyhal_adc_t *adc, cyhal_gpio_t pin)
 Initialize a single-ended ADC channel. More...
 

Macro Definition Documentation

◆ cyhal_system_sleep

#define cyhal_system_sleep ( )    Cy_SysPm_CpuEnterSleep(CY_SYSPM_WAIT_FOR_INTERRUPT)

Attempts to put the device to sleep until an interrupt wakes it up.

Warning
This function is deprecated. Use cyhal_syspm_sleep instead.

◆ cyhal_system_deepsleep

#define cyhal_system_deepsleep ( )    Cy_SysPm_CpuEnterDeepSleep(CY_SYSPM_WAIT_FOR_INTERRUPT)

Attempts to put the device into deep sleep until an interrupt wakes it up.

Warning
This function is deprecated. Use cyhal_syspm_deepsleep instead.

Typedef Documentation

◆ cyhal_clock_divider_types_t

typedef cy_en_divider_types_t cyhal_clock_divider_types_t

Available clock divider types.

Warning
This type is deprecated. Use cyhal_clock_block_t instead.

◆ cyhal_system_divider_t

typedef uint16_t cyhal_system_divider_t

Divider for CM4, CM0 and Peri clock.

Supports values between [1, 256]

Warning
This type is deprecated. Use cyhal_clock_t instead.

◆ cyhal_clock_divider_t

Peripheral clock divider type.

Warning
This type is deprecated. Use cyhal_clock_t instead.

Enumeration Type Documentation

◆ cyhal_system_clock_t

Enum for clock type to configure.

HFCLKs are configured using different APIs and does not using this enum.

Warning
This type is deprecated. Use cyhal_clock_block_t instead.

Function Documentation

◆ cyhal_hwmgr_allocate_clock()

cy_rslt_t cyhal_hwmgr_allocate_clock ( cyhal_clock_divider_t obj,
cyhal_clock_divider_types_t  div,
bool  accept_larger 
)

Allocate (pick and reserve) an Clock Divider resource and provide a reference to it.

Warning
This function is deprecated. Use cyhal_clock_allocate() instead.
Parameters
[out]objThe resource object that was allocated
[in]divThe type of divider to allocate
[in]accept_largerWhether a larger type can be provided if there are none of the requested size available
Returns
The status of the reserve request

◆ cyhal_hwmgr_free_clock()

void cyhal_hwmgr_free_clock ( cyhal_clock_divider_t obj)

Free the specified Clock Divider resource and allow it be used by something else.

Warning
This function is deprecated. Use cyhal_clock_free() instead.
Parameters
[in]objThe resource object that was allocated

◆ cyhal_system_clock_get_frequency()

cy_rslt_t cyhal_system_clock_get_frequency ( uint8_t  clock,
uint32_t *  frequency_hz 
)

Gets the specified clock's current frequency.

Warning
This function is deprecated. Use cyhal_clock_get_frequency() instead.
Parameters
[in]clockID of clock to configure
[out]frequency_hzThe frequency the clock is currently running at
Returns
The status of the get_frequency request

◆ cyhal_system_clock_set_frequency()

cy_rslt_t cyhal_system_clock_set_frequency ( uint8_t  clock,
uint32_t  frequency_hz 
)

Sets the specified clock's frequency and enables it.

This will turn on any additional clocks needed to drive this.

Warning
This function is deprecated. Use cyhal_clock_set_frequency() instead.
Parameters
[in]clockID of clock to configure
[in]frequency_hzThe frequency to run the clock at
Returns
The status of the set_frequency request

◆ cyhal_system_clock_set_divider()

cy_rslt_t cyhal_system_clock_set_divider ( cyhal_system_clock_t  clock,
cyhal_system_divider_t  divider 
)

Divides the clock frequency by the divider.

Warning
This function is deprecated. Use cyhal_clock_set_divider() instead.
Parameters
[in]clockThe clock to configure divider value for
[in]dividerThe divider value to divide the frequency by
Returns
The status of the set_divider request

◆ cyhal_system_register_callback()

cy_rslt_t cyhal_system_register_callback ( cyhal_system_callback_t callback)

Register the specified handler with the power manager to be notified of power state changes.

Warning
This function is deprecated. Use cyhal_syspm_register_callback() instead.
Parameters
[in]callbackThe callback configuration data
Returns
The status of the register_callback request

◆ cyhal_system_unregister_callback()

cy_rslt_t cyhal_system_unregister_callback ( cyhal_system_callback_t const *  callback)

Removes the registered handler from the power manager so no future notifications are made.

Warning
This function is deprecated. Use cyhal_syspm_unregister_callback() instead.
Parameters
[in]callbackThe callback configuration data
Returns
The status of the unregister_callback request

◆ cyhal_adc_channel_init()

cy_rslt_t cyhal_adc_channel_init ( cyhal_adc_channel_t obj,
cyhal_adc_t adc,
cyhal_gpio_t  pin 
)

Initialize a single-ended ADC channel.

Warning
This function is deprecated. Use cyhal_adc_channel_init_diff() instead with CYHAL_ADC_VNEG specified for the vminus argument.

Configures the pin used by ADC.

Parameters
[out]objThe adc channel object to initialize
[in]adcThe adc for which the channel should be initialized
[in]pinThe adc pin name
Returns
The status of the init request. The status of the init request. On failure, a problem specific error code will be returned. This error could be from the HAL or lower level driver.
For all other return codes, please refer to device driver documentation available in the BSP landing page