Result Type

group group_result

Defines a type and related utilities for function result handling.

The cy_rslt_t type is a structured bitfield which encodes information about result type, the originating module, and a code for the specific error (or warning etc). In order to extract these individual fields from a cy_rslt_t value, the utility macros CY_RSLT_GET_TYPE, CY_RSLT_GET_MODULE, and CY_RSLT_GET_CODE are provided. For example:

cy_rslt_t result = cy_hal_do_operation(arg);
// Will be CY_RSLT_TYPE_INFO, CY_RSLT_TYPE_WARNING, CY_RSLT_TYPE_ERROR, or CY_RSLT_TYPE_FATAL
uint8_t type = CY_RSLT_GET_TYPE(result)
// See the "Modules" section for possible values
uint16_t module_id = CY_RSLT_GET_MODULE(result);
// Specific error codes are defined by each module
uint16_t error_code = CY_RSLT_GET_CODE(result);

Fields

Utility macros for constructing result values and extracting individual fields from existing results.

CY_RSLT_GET_TYPE(x)

Get the value of the result type field.

Parameters
  • x: the cy_rslt_t value from which to extract the result type

CY_RSLT_GET_MODULE(x)

Get the value of the module identifier field.

Parameters
  • x: the cy_rslt_t value from which to extract the module id

CY_RSLT_GET_CODE(x)

Get the value of the result code field.

Parameters
  • x: the cy_rslt_t value from which to extract the result code

CY_RSLT_CREATE(type, module, code)

Create a new cy_rslt_t value that encodes the specified type, module, and result code.

Parameters

Result Types

Defines codes to identify the type of result.

CY_RSLT_TYPE_INFO

The result code is informational-only.

CY_RSLT_TYPE_WARNING

The result code is warning of a problem but will proceed.

CY_RSLT_TYPE_ERROR

The result code is an error.

CY_RSLT_TYPE_FATAL

The result code is a fatal error.

Modules

Defines codes to identify the module from which an error originated. For some large libraries, a range of module codes is defined here; see the library documentation for values corresponding to individual modules. Valid range is 0x0000-0x4000.

CY_RSLT_MODULE_DRIVERS_PDL_BASE

Base module identifier for peripheral driver library drivers (0x0000 - 0x007F)

CY_RSLT_MODULE_DRIVERS_WHD_BASE

Base module identifier for wireless host driver library modules (0x0080 - 0x00FF)

CY_RSLT_MODULE_ABSTRACTION_HAL_BASE

Deprecated.

Use CY_RSLT_MODULE_ABSTRACTION_HAL

CY_RSLT_MODULE_ABSTRACTION_HAL

Module identifier for the Hardware Abstraction Layer.

CY_RSLT_MODULE_ABSTRACTION_BSP

Module identifier for board support package.

CY_RSLT_MODULE_ABSTRACTION_FS

Module identifier for file system abstraction.

CY_RSLT_MODULE_ABSTRACTION_RESOURCE

Module identifier for resource abstraction.

CY_RSLT_MODULE_ABSTRACTION_OS

Module identifier for rtos abstraction.

CY_RSLT_MODULE_ABSTRACTION_ENV

Base identifier for environment abstraction modules (0x0184 - 0x01FF)

CY_RSLT_MODULE_BOARD_LIB_BASE

Base module identifier for Board Libraries (0x01A0 - 0x01BF)

CY_RSLT_MODULE_BOARD_LIB_RETARGET_IO

Module identifier for the Retarget IO Board Library.

CY_RSLT_MODULE_BOARD_LIB_RGB_LED

Module identifier for the RGB LED Board Library.

CY_RSLT_MODULE_BOARD_LIB_SERIAL_FLASH

Module identifier for the Serial Flash Board Library.

CY_RSLT_MODULE_BOARD_LIB_WHD_INTEGRATION

Module identifier for the WiFi Host Driver + Board Support Integration Library.

CY_RSLT_MODULE_BOARD_SHIELD_BASE

Base module identifier for Shield Board Libraries (0x01B8 - 0x01BF)

CY_RSLT_MODULE_BOARD_SHIELD_028_EPD

Module identifier for Shield Board CY8CKIT-028-EPD.

CY_RSLT_MODULE_BOARD_SHIELD_028_TFT

Module identifier for Shield Board CY8CKIT-028-TFT.

CY_RSLT_MODULE_BOARD_SHIELD_032

Module identifier for Shield Board CY8CKIT-032.

CY_RSLT_MODULE_BOARD_HARDWARE_BASE

Base module identifier for Board Hardware Libraries (0x01C0 - 0x01FF)

CY_RSLT_MODULE_BOARD_HARDWARE_BMI160

Module identifier for the BMI160 Motion Sensor Library.

CY_RSLT_MODULE_BOARD_HARDWARE_E2271CS021

Module identifier for the E2271CS021 E-Ink Controller Library.

CY_RSLT_MODULE_BOARD_HARDWARE_THERMISTOR

Module identifier for the NTC GPIO Thermistor Library.

CY_RSLT_MODULE_BOARD_HARDWARE_SSD1306

Module identifier for the SSD1306 OLED Controller Library.

CY_RSLT_MODULE_BOARD_HARDWARE_ST7789V

Module identifier for the ST7789V TFT Controller Library.

CY_RSLT_MODULE_BOARD_HARDWARE_LIGHT_SENSOR

Module identifier for the Light Sensor Library.

CY_RSLT_MODULE_BOARD_HARDWARE_AK4954A

Module identifier for the AK4954A Audio Codec Library.

CY_RSLT_MODULE_MIDDLEWARE_BASE

Base module identifier for Middleware Libraries (0x0200 - 0x02FF)

CY_RSLT_MODULE_MIDDLEWARE_KVSTORE

Module identifier for the KV Store Middleware Library.

CY_RSLT_MODULE_MIDDLEWARE_LIN

Module identifier for the LIN Middleware Library.

Defines

CY_RSLT_SUCCESS

cy_rslt_t return value indicating success

Typedefs

typedef uint32_t cy_rslt_t

Provides the result of an operation as a structured bitfield.

See the General Description for more details on structure and usage.