| BlueNRG-1 ACI APIs and events callbacks

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

Classes | Macros | Functions
bluenrg1_stack.h File Reference

Header file for BlueNRG-1 BLE stack initialization and sleep timer. More...

`#include <stdint.h>`
`#include <bluenrg1_api.h>`
`#include <bluenrg1_events.h>`

Go to the source code of this file.

## Classes

struct | hardware_config_table_t
struct | BlueNRG_Stack_Initialization_t

## Macros

#define | TOTAL_BUFFER_SIZE(NUM_LINKS, NUM_GATT_ATTRIBUTES, NUM_GATT_SERVICES, ATT_VALUE_ARRAY_SIZE)
#define | TOTAL_FLASH_BUFFER_SIZE(FLASH_SEC_DB_SIZE, FLASH_SERVER_DB_SIZE)
#define | TOTAL_DEVICE_ID_DATA_SIZE (56)

## Functions

void | BTLE_StackTick (void)
tBleStatus | BlueNRG_Stack_Initialization (const BlueNRG_Stack_Initialization_t *BlueNRG_Stack_Init_params_p)
uint8_t | BlueNRG_Stack_Perform_Deep_Sleep_Check (void)
void | RAL_Isr (void)
int | HAL_VTimerStart_ms (uint8_t timerNum, int32_t msRelTimeout)
void | HAL_VTimer_Stop (uint8_t timerNum)
void | HAL_VTimerTimeoutCallback (uint8_t timerNum)
uint32_t | HAL_VTimerGetCurrentTime_sysT32 (void)
uint32_t | HAL_VTimerAcc_sysT32_ms (uint32_t sysTime, int32_t msTime)
int32_t | HAL_VTimerDiff_ms_sysT32 (uint32_t sysTime1, uint32_t sysTime2)
int | HAL_VTimerStart_sysT32 (uint8_t timerNum, uint32_t time)
int | HAL_VTimerExpiry_sysT32 (uint8_t timerNum, uint32_t *sysTime)
tBleStatus | hci_rx_acl_data_event (uint16_t connHandle, uint8_t pb_flag, uint8_t bc_flag, uint16_t dataLen, uint8_t *pduData)
| This callback is called by the stack library to indicate the arrival of an ACL Data Packet. More...
tBleStatus | hci_tx_acl_data (uint16_t connHandle, uint8_t pb_flag, uint8_t bc_flag, uint16_t dataLen, uint8_t *pduData)
| API used to send HCI ACL Data Packets to exchange data between the Host and Controller. More...

## Detailed Description

Header file for BlueNRG-1 BLE stack initialization and sleep timer.

Author
  AMS - VMA RF Application team

Version
  V1.0.0

Date
  21-Sept-2015

Attention

THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.

##
© COPYRIGHT 2015 STMicroelectronics

Definition in file bluenrg1_stack.h.

## Macro Definition Documentation

#define TOTAL_BUFFER_SIZE | ( |  | NUM_LINKS,
|  |  | NUM_GATT_ATTRIBUTES,
|  |  | NUM_GATT_SERVICES,
|  |  | ATT_VALUE_ARRAY_SIZE
| ) |  |

Value:
(\
852 + ((((ATT_VALUE_ARRAY_SIZE)-1)|3)+1) + \
(272*NUM_LINKS) + \
(40*NUM_GATT_ATTRIBUTES) + \
(48*NUM_GATT_SERVICES) \
)

This macro returns the amount of memory, in bytes, needed for the storage of GATT database elements and other data structures whose size depends on the number of supported connections.

Parameters

  NUM_LINKS | Maximum number of simultaneous connections that the device will support. Valid values are from 1 to 8.
  NUM_GATT_ATTRIBUTES | Maximum number of Attributes (i.e. the number of characteristic + the number of characteristic values + the number of descriptors, excluding the services) that can be stored in the GATT database. Note that certain characteristics and relative descriptors are added automatically during device initialization so this parameters should be 9 plus the number of user Attributes
  NUM_GATT_SERVICES | Maximum number of Services that can be stored in the GATT database. Note that the GAP and GATT services are automatically added so this parameter should be 2 plus the number of user services
  ATT_VALUE_ARRAY_SIZE | Size of the storage area for Attribute values.

Definition at line 38 of file bluenrg1_stack.h.

#define TOTAL_DEVICE_ID_DATA_SIZE (56)

This symbol defines the size of non-volatile device identification data

Definition at line 60 of file bluenrg1_stack.h.

#define TOTAL_FLASH_BUFFER_SIZE | ( |  | FLASH_SEC_DB_SIZE,
|  |  | FLASH_SERVER_DB_SIZE
| ) |  |

Value:
(\
((((FLASH_SEC_DB_SIZE+FLASH_SERVER_DB_SIZE)-1)|2047)+1)\
)

This macro returns the amount of memory, in bytes, needed for the storage of non-volatile data for bonded devices

Parameters

  FLASH_SEC_DB_SIZE | Size of the database used to store security information for bonded devices. The recommended value for this parameter is 1024.
  FLASH_SERVER_DB_SIZE | Size of the database used for service change notification for bonded devices. The recommended value for this parameter is 1024.

Note
  : the total buffer size is rounded-up to the next multiple of on flash sector size, i.e. 2048 bytes

Definition at line 53 of file bluenrg1_stack.h.

## Function Documentation

tBleStatus BlueNRG_Stack_Initialization | ( | const BlueNRG_Stack_Initialization_t * | BlueNRG_Stack_Init_params_p | ) |

BlueNRG_Stack_Initialization

Parameters

  [in] | BlueNRG_Stack_Init_params_p | pointer to the const structure containing memory and low level hardware configuration data for the device

The BTLE Stack initialization routine

Note
  The API name and parameters are subject to change in future releases.

Returns
  Value indicating success or error code.

uint8_t BlueNRG_Stack_Perform_Deep_Sleep_Check | ( | void |  | ) |

BlueNRG_Stack_Perform_Deep_Sleep_Check

Return the BTLE Stack matching sleep mode

Note
  The API name and parameters are subject to change in future releases.

Returns
  SLEEPMODE_RUNNING = 0, SLEEPMODE_CPU_HALT = 1, SLEEPMODE_WAKETIMER = 2, SLEEPMODE_NOTIMER = 3,

void BTLE_StackTick | ( | void |  | ) |

BTLE_StackTick

The BTLE Stack Tick function executes the processing of all Host Stack layers. This function has to be executed regularly to process incoming Link Layer packets and to process Host Layers procedures.

Note
  The API name and parameters are subject to change in future releases.

Returns

void HAL_VTimer_Stop | ( | uint8_t | timerNum | ) |

HAL_VTimer_Stop

Parameters

  [in] | timerNum | The virtual timer number [0..3]

Stops the one-shot virtual timer specified if found

Note
  The API name and parameters are subject to change in future releases.

Returns

uint32_t HAL_VTimerAcc_sysT32_ms | ( | uint32_t | sysTime,
|  | int32_t | msTime
| ) |  |

HAL_VTimerAcc_sysT32_ms

Parameters

  [in] | sysTime | Absolute time expressed in internal time units.
  [in] | msTime | Signed relative time expressed in ms. Note: abs(msTime) <= 5242879

This function return the sum of an absolute time and a signed relative time.

Note
  The API name and parameters are subject to change in future releases.

Returns
  32bit resulting absolute time expressed in internal time units.

int32_t HAL_VTimerDiff_ms_sysT32 | ( | uint32_t | sysTime1,
|  | uint32_t | sysTime2
| ) |  |

HAL_VTimerDiff_ms_sysT32

Parameters

  [in] | sysTime1 | Absolute time expressed in internal time units.
  [in] | sysTime2 | Absolute time expressed in internal time units.

This function return the difference between two absolute times: sysTime1-sysTime2. The resulting value is expressed in ms.

Note
  The API name and parameters are subject to change in future releases.

Returns
  32bit resulting signed relative time expressed in ms.

int HAL_VTimerExpiry_sysT32 | ( | uint8_t | timerNum,
|  | uint32_t * | sysTime
| ) |  |

HAL_VTimerExpiry_sysT32

Parameters

  [in] | timerNum | The virtual timer number [0..3]
  [out] | sysTime | Absolute time expressed in internal time units.

Returns the absolute expiry time, expressed in internal time units, of a running virtual timer.

Note
  The API name and parameters are subject to change in future releases.

Returns
  0: no error (the timerNum virtual timer is running)

uint32_t HAL_VTimerGetCurrentTime_sysT32 | ( | void |  | ) |

HAL_VTimerGetCurrentTime_sysT32

This function return the current reference time expressed in internal time units. The returned value can be used as absolute time parameter where needed in the other HAL_VTimer* APIs

Note
  The API name and parameters are subject to change in future releases.

Returns
  32bit absolute current time expressed in internal time units.

int HAL_VTimerStart_ms | ( | uint8_t | timerNum,
|  | int32_t | msRelTimeout
| ) |  |

HAL_VTimerStart_ms

Parameters

  [in] | timerNum | The virtual timer number [0..3]
  [in] | msRelTimeout | The relative time, from current time, expressed in ms Note: abs(msRelTimeout) <= 5242879

Starts a one-shot virtual timer for the given relative timeout value expressed in ms

Note
  The API name and parameters are subject to change in future releases.

Returns
  0: no error (the timerNum virtual timer is valid)

int HAL_VTimerStart_sysT32 | ( | uint8_t | timerNum,
|  | uint32_t | time
| ) |  |

HAL_VTimerStart_sysT32

Parameters

  [in] | timerNum | The virtual timer number [0..3]
  [in] | time | Absolute time expressed in internal time units.

Starts a one-shot virtual timer for the given absolute timeout value expressed in internal time units.

Note
  The API name and parameters are subject to change in future releases.

Returns
  0: no error (the timerNum virtual timer is idle)

void HAL_VTimerTimeoutCallback | ( | uint8_t | timerNum | ) |

HAL_VTimerTimeoutCallback

Parameters

  [in] | timerNum | The virtual timer number [0..3]

This function will be called on the expiry of a one-shot virtual timer HAL_VTimerTimeoutCallback will notify the virtual timer number

Note
  The API name and parameters are subject to change in future releases.

Returns

tBleStatus hci_rx_acl_data_event | ( | uint16_t | connHandle,
|  | uint8_t | pb_flag,
|  | uint8_t | bc_flag,
|  | uint16_t | dataLen,
|  | uint8_t * | pduData
| ) |  |

This callback is called by the stack library to indicate the arrival of an ACL Data Packet.

hci_rx_acl_data_event

Parameters

  [in] | connHandle | Connection handle for which the command is given. Range: 0x0000-0x0EFF (0x0F00 - 0x0FFF Reserved for future use)
  [in] | pb_flag | Packet boundary flag
  [in] | bc_flag | Broadcast flag
  [in] | dataLen | Length of PDU data in octets.
  [in] | pduData | PDU data pointer

Note
  The callback is called by the stack in link layer only mode.

Returns
  void

tBleStatus hci_tx_acl_data | ( | uint16_t | connHandle,
|  | uint8_t | pb_flag,
|  | uint8_t | bc_flag,
|  | uint16_t | dataLen,
|  | uint8_t * | pduData
| ) |  |

API used to send HCI ACL Data Packets to exchange data between the Host and Controller.

hci_tx_acl_data

Parameters

  [in] | connHandle | Connection handle for which the command is given. Range: 0x0000-0x0EFF (0x0F00 - 0x0FFF Reserved for future use)
  [in] | pb_flag | Packet boundary flag
  [in] | bc_flag | Broadcast flag
  [in] | dataLen | Length of PDU data in octets.
  [in] | pduData | PDU data pointer

Note
  The API name is only available in link layer only mode.

Returns
  Error code

void RAL_Isr | ( | void |  | ) |

RAL_Isr

Radio ISR routine. This is the base function called for any radio ISR.

Returns