Added support for obtaining BLE device name by parsing advertising data.

Fork of BLE_BlueNRG by Mridupawan Das

Committer:
hemddabral
Date:
Thu Jul 31 11:09:28 2014 +0000
Revision:
7:e293b0f43dc7
Parent:
0:309c845d289d
Added support for parsing BLE device name from advertising data

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mridup 0:309c845d289d 1 /******************** (C) COPYRIGHT 2012 STMicroelectronics ********************
mridup 0:309c845d289d 2 * File Name : hal.h
mridup 0:309c845d289d 3 * Author : AMS - HEA&RF BU
mridup 0:309c845d289d 4 * Version : V1.0.0
mridup 0:309c845d289d 5 * Date : 19-July-2012
mridup 0:309c845d289d 6 * Description : Header file which defines Hardware abstraction layer APIs
mridup 0:309c845d289d 7 * used by the BLE stack. It defines the set of functions
mridup 0:309c845d289d 8 * which needs to be ported to the target platform.
mridup 0:309c845d289d 9 ********************************************************************************
mridup 0:309c845d289d 10 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
mridup 0:309c845d289d 11 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
mridup 0:309c845d289d 12 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
mridup 0:309c845d289d 13 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
mridup 0:309c845d289d 14 * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
mridup 0:309c845d289d 15 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
mridup 0:309c845d289d 16 *******************************************************************************/
mridup 0:309c845d289d 17 #ifndef __HAL_H__
mridup 0:309c845d289d 18 #define __HAL_H__
mridup 0:309c845d289d 19
mridup 0:309c845d289d 20 /******************************************************************************
mridup 0:309c845d289d 21 * Includes
mridup 0:309c845d289d 22 *****************************************************************************/
mridup 0:309c845d289d 23 #include <hal_types.h>
mridup 0:309c845d289d 24 #include <ble_status.h>
mridup 0:309c845d289d 25
mridup 0:309c845d289d 26 /******************************************************************************
mridup 0:309c845d289d 27 * Macros
mridup 0:309c845d289d 28 *****************************************************************************/
mridup 0:309c845d289d 29 /* Little Endian buffer to Controller Byte order conversion */
mridup 0:309c845d289d 30 #define LE_TO_NRG_16(ptr) (uint16) ( ((uint16) \
mridup 0:309c845d289d 31 *((tHalUint8 *)ptr)) | \
mridup 0:309c845d289d 32 ((tHalUint16) \
mridup 0:309c845d289d 33 *((tHalUint8 *)ptr + 1) << 8 ) )
mridup 0:309c845d289d 34
mridup 0:309c845d289d 35 #define LE_TO_NRG_32(ptr) (tHalUint32) ( ((tHalUint32) \
mridup 0:309c845d289d 36 *((tHalUint8 *)ptr)) | \
mridup 0:309c845d289d 37 ((tHalUint32) \
mridup 0:309c845d289d 38 *((tHalUint8 *)ptr + 1) << 8) | \
mridup 0:309c845d289d 39 ((tHalUint32) \
mridup 0:309c845d289d 40 *((tHalUint8 *)ptr + 2) << 16) | \
mridup 0:309c845d289d 41 ((tHalUint32) \
mridup 0:309c845d289d 42 *((tHalUint8 *)ptr + 3) << 24) )
mridup 0:309c845d289d 43
mridup 0:309c845d289d 44 /* Store Value into a buffer in Little Endian Format */
mridup 0:309c845d289d 45 #define STORE_LE_16(buf, val) ( ((buf)[0] = (tHalUint8) (val) ) , \
mridup 0:309c845d289d 46 ((buf)[1] = (tHalUint8) (val>>8) ) )
mridup 0:309c845d289d 47
mridup 0:309c845d289d 48 #define STORE_LE_32(buf, val) ( ((buf)[0] = (tHalUint8) (val) ) , \
mridup 0:309c845d289d 49 ((buf)[1] = (tHalUint8) (val>>8) ) , \
mridup 0:309c845d289d 50 ((buf)[2] = (tHalUint8) (val>>16) ) , \
mridup 0:309c845d289d 51 ((buf)[3] = (tHalUint8) (val>>24) ) )
mridup 0:309c845d289d 52
mridup 0:309c845d289d 53 /******************************************************************************
mridup 0:309c845d289d 54 * Types
mridup 0:309c845d289d 55 *****************************************************************************/
mridup 0:309c845d289d 56
mridup 0:309c845d289d 57 /******************************************************************************
mridup 0:309c845d289d 58 * Function Prototypes
mridup 0:309c845d289d 59 *****************************************************************************/
mridup 0:309c845d289d 60
mridup 0:309c845d289d 61 /**
mridup 0:309c845d289d 62 * Writes data to a serial interface.
mridup 0:309c845d289d 63 *
mridup 0:309c845d289d 64 * @param[in] data1 1st buffer
mridup 0:309c845d289d 65 * @param[in] data2 2nd buffer
mridup 0:309c845d289d 66 * @param[in] n_bytes1 number of bytes in 1st buffer
mridup 0:309c845d289d 67 * @param[in] n_bytes2 number of bytes in 2nd buffer
mridup 0:309c845d289d 68 */
mridup 0:309c845d289d 69 void Hal_Write_Serial(const void* data1, const void* data2, tHalInt32 n_bytes1, tHalInt32 n_bytes2);
mridup 0:309c845d289d 70
mridup 0:309c845d289d 71 /**
mridup 0:309c845d289d 72 * Enable interrupts from HCI controller.
mridup 0:309c845d289d 73 */
mridup 0:309c845d289d 74 void Enable_SPI_IRQ(void);
mridup 0:309c845d289d 75
mridup 0:309c845d289d 76 /**
mridup 0:309c845d289d 77 * Disable interrupts from BLE controller.
mridup 0:309c845d289d 78 */
mridup 0:309c845d289d 79 void Disable_SPI_IRQ(void);
mridup 0:309c845d289d 80
mridup 0:309c845d289d 81
mridup 0:309c845d289d 82
mridup 0:309c845d289d 83
mridup 0:309c845d289d 84 #endif /* __HAL_H__ */