BLE_API v2.1.3

Functions
RF PHY Function
RF PHY

## Functions
BleStackStatus | setRF_Init (PowerRegulator_Mode powerMode, uint8_t xtalFeq)
BleRF_Mode | getRF_Mode (void)
void | setRF_RssiValueOffset (uint8_t offset)
BleStackStatus | setRF_EnableXtalClkOutput (void)
BleStackStatus | setRF_EnterDeepSleep (void)
BleStackStatus | setRF_WakeUpFromDeepSleep (void)
BleStackStatus | setBLE_KernelStateHandle (void)
uint8_t | getBLE_ChipId (void)
uint32_t | getBLE_TxFIFOAddr (void)
BleStackStatus | setMCU_WakeupRetentionTime (uint8_t retentionTime)

## Detailed Description

Here shows the functions of RF PHY.

## Function Documentation

## ◆ getBLE_ChipId()

uint8_t getBLE_ChipId | ( | void |  | ) |

Get BLE Device Chip ID

This function is used to get BLE Device Chip ID.

Returns
  Chip ID

## ◆ getBLE_TxFIFOAddr()

uint32_t getBLE_TxFIFOAddr | ( | void |  | ) |

Get TX FIFI Address

This function is used to get TX FIFO RAM start address.

Returns
  TX FIFO address.

## ◆ getRF_Mode()

BleRF_Mode getRF_Mode | ( | void |  | ) |

Get Current BLE Device RF Mode

This function is used to get current RF mode.

Return values

  BLERFMODE_ACTIVE | : The BLE device RF is in active mode.
  BLERFMODE_SLEEP | : The BLE device RF is in sleep mode.

## ◆ setBLE_KernelStateHandle()

BleStackStatus setBLE_KernelStateHandle | ( | void |  | ) |

Enable BLE Kernel. Must do it after setRF_SpiIoMapping and setRF_Init.

Note
  If no any BLE Stack (LL&Host) task is running then run user application task.
  The task priority is LL>Host>User_app.

Return values

  BLESTACK_STATUS_FREE | : Stack (LL&Host task) is not running, can run user application task.
  BLESTACK_STATUS_ERR_BUSY | : Stack (LL&Host task) is running, can NOT run user application task.

## ◆ setMCU_WakeupRetentionTime()

BleStackStatus setMCU_WakeupRetentionTime | ( | uint8_t | retentionTime | ) |

Set MCU Wake-up Retention Time

This parameter adjusts the retention time required for the MCU to wake up from sleep mode, plus some necessary parameters set via SPI operation.
The unit of the MCU wake-up retention time is 125us.

Attention
  This command MUST be called before setRF_Init.

Note
  The default MCU Wake-up Retention Time is set to 1 (125us = 1*125us).
  MCU wake-up retention time range is from MCU_WAKEUP_RETENSIONTIME_MIN to MCU_WAKEUP_RETENSIONTIME_MAX.

Parameters

  [in] | retentionTime | : MCU wake-up retention time in 125us.

Return values

  BLESTACK_STATUS_ERR_INVALID_STATE | : MCU Wake-up Retention Time can NOT be modified while running BLE stack.
  BLESTACK_STATUS_ERR_INVALID_PARAM | : Invalid parameter.
  BLESTACK_STATUS_SUCCESS | : Setting completed.

## ◆ setRF_EnableXtalClkOutput()

BleStackStatus setRF_EnableXtalClkOutput | ( | void |  | ) |

Set Crystal Clock Output

This function is used to enable crystal 16MHz Clock output.

Attention
  This command MUST be called before setRF_Init.
  RF sleep mode will be disabled automatically when user enable crystal clock (16MHz) output.

Return values

  BLESTACK_STATUS_ERR_INVALID_STATE | : Crystal clock output can NOT be enabled while running BLE stack.
  BLESTACK_STATUS_SUCCESS | : Setting completed.

## ◆ setRF_EnterDeepSleep()

BleStackStatus setRF_EnterDeepSleep | ( | void |  | ) |

Set RF Enter Deep Sleep Mode

Attention
  RF can NOT enter Deep Sleep Mode if enabled crystal clock output.
  It will not wake up until call setRF_WakeUpFromDeepSleep.

Return values

  BLESTACK_STATUS_ERR_INVALID_STATE | : RF phy or BLE stack has not initialized.
  BLESTACK_STATUS_ERR_NOT_SUPPORTED | : This command is not supported if crystal clock output enabled.
  BLESTACK_STATUS_SUCCESS | : Setting completed.

## ◆ setRF_Init()

BleStackStatus setRF_Init | ( | PowerRegulator_Mode | powerMode,
|  | uint8_t | xtalFeq
| ) |  |

Initializes the BLE RF Phy.

Attention
  Must initial BLE RF Phy after setRF_SpiIoMapping.

Parameters

  [in] | powerMode | : power regulator.
  [in] | xtalFeq | : crystal frequency.

Return values

  BLESTACK_STATUS_ERR_INVALID_PARAM | : invalid parameter.
  BLESTACK_STATUS_SUCCESS | : RF initialization is successful.

## ◆ setRF_RssiValueOffset()

void setRF_RssiValueOffset | ( | uint8_t | offset | ) |

Set BLE RSSI Offset Value to adjust RSSI Value

Note
  The default BLE RSSI Offset Value is +26dBm.

Parameters

  [in] | offset | : rssi offset value.

Returns
  none

## ◆ setRF_WakeUpFromDeepSleep()

BleStackStatus setRF_WakeUpFromDeepSleep | ( | void |  | ) |

Set RF External Wakeup From Deep Sleep Mode

Attention
  This command is not supported if enabled crystal clock output.

Note
  After external wakeup from deep sleep mode, the BLE stack will do setRF_Init and setBLE_BleStackInit again.
  Then BLE is in standby mode.

Return values

  BLESTACK_STATUS_ERR_INVALID_STATE | : RF phy or BLE stack has not initialized or not in deep sleep mode.
  BLESTACK_STATUS_ERR_NOT_SUPPORTED | : This command is not supported if crystal clock output enabled.
  BLESTACK_STATUS_SUCCESS | : Setting completed.