NUCLEO-F401RE + BlueNRG shield client test (TI Sensortag reading)

Dependencies:   mbed-src

Committer:
ostapsky
Date:
Sat Aug 16 11:00:04 2014 +0000
Revision:
0:aa1e012ec210
CLIENT mode first revision

Who changed what in which revision?

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