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