BLE Interrupt Notification Callback

group group_ble_common_Intr_feature_api_functions

API exposes BLE interrupt notifications to the application which indicates a different link layer and radio state transitions to the user from the BLESS interrupt context.

The user registers for a particular type of a callback and the PSoC 6 BLE Middleware will call that registered callback basing on the registered mask. Refer to section BLE Interrupt Notification Callback.

Functions

cy_en_ble_api_result_t Cy_BLE_RegisterInterruptCallback(uint32_t intrMask, cy_ble_intr_callback_t CallBack)

This function registers a callback to expose BLE interrupt notifications to an application that indicates a different link layer and radio state transition to the user from the BLESS interrupt context.

This callback is triggered at the beginning of a received BLESS interrupt (based on the registered interrupt mask).

An application can use an interrupt callback to know when:

  • the RF activity is about to begin/end;

  • the BLE device changes its state from advertising to connected;

  • BLESS transits between BLESS active and BLESS low-power modes.

These BLESS real-time states can be used to synchronize an application with the BLESS or prevent radio interference with other peripherals, etc.

BLE dual CPU mode requires an additional configuration IPC channel and IPC Interrupt structure to send notifications from the controller core to Host core. Refer to Cy_BLE_ConfigureIpcForInterruptCallback() for details.

note

The user must call Cy_BLE_IntrNotifyIsrHandler() inside the user-defined BLESS interrupt service routine (ISR)

Errors codes

Description

CY_BLE_SUCCESS

The callback is registered successfully.

CY_BLE_ERROR_INVALID_PARAMETER

Validation of the input parameters failed.

Parameters
Returns

cy_en_ble_api_result_t : The return value indicates whether the function succeeded or failed. The possible error codes:

cy_en_ble_api_result_t Cy_BLE_UnRegisterInterruptCallback(void)

This function un-registers the callback that exposed BLE interrupt notifications to the application.

Errors codes

Description

CY_BLE_SUCCESS

The callback registered successfully.

CY_BLE_ERROR_INVALID_OPERATION

The IPC channel is busy (BLE dual CPU mode only).

Returns

cy_en_ble_api_result_t : Return value indicates whether the function succeeded or failed. The following are possible error codes.

cy_en_ble_api_result_t Cy_BLE_ConfigureIpcForInterruptCallback(uint32_t ipcChan, uint32_t ipcIntr, uint32_t ipcIntrPrior)

This function configures IPC channel for BLE interrupt notifications feature, when BLE is operating in BLE dual CPU mode.

This function must be called only on the Host CPU core.

Errors codes

Description

CY_BLE_SUCCESS

The callback is registered successfully.

CY_BLE_ERROR_INVALID_PARAMETER

Validation of the input parameters failed.

CY_BLE_ERROR_INVALID_OPERATION

The IPC channel is busy (BLE dual CPU mode only).

Parameters
  • ipcChan – IPC channel. Valid range: 9..15

  • ipcIntr – IPC Interrupt structure. Valid range: 9..15

  • ipcIntrPrior – IPC Interrupt priority. Valid range: 0..7

Returns

cy_en_ble_api_result_t : The return value indicates whether the function succeeded or failed. The possible error codes:

void Cy_BLE_IntrNotifyIsrHandler(void)

This function sends notification (with interrupt type information) to user callback for the BLE interrupts subscribed by user.

The list of supported interrupts described in the enumeration cy_en_ble_interrupt_callback_feature_t. Cy_BLE_RegisterInterruptCallback() API used to register callback for receiving the BLE interrupts.

This function must be called inside the user-defined BLESS interrupt service routine (ISR) if user uses Interrupt Notifications Feature.