Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of NUCLEO_BLUENRG by
hal.h
00001 /******************** (C) COPYRIGHT 2012 STMicroelectronics ******************** 00002 * File Name : hal.h 00003 * Author : AMS - HEA&RF BU 00004 * Version : V1.0.0 00005 * Date : 19-July-2012 00006 * Description : Header file which defines Hardware abstraction layer APIs 00007 * used by the BLE stack. It defines the set of functions 00008 * which needs to be ported to the target platform. 00009 ******************************************************************************** 00010 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 00011 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 00012 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 00013 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 00014 * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 00015 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 00016 *******************************************************************************/ 00017 #ifndef __HAL_H__ 00018 #define __HAL_H__ 00019 00020 #ifdef __cplusplus 00021 extern "C" { 00022 #endif 00023 /****************************************************************************** 00024 * Includes 00025 *****************************************************************************/ 00026 #include <hal_types.h> 00027 #include <ble_status.h> 00028 00029 /****************************************************************************** 00030 * Macros 00031 *****************************************************************************/ 00032 /* Little Endian buffer to Controller Byte order conversion */ 00033 #define LE_TO_NRG_16(ptr) (uint16) ( ((uint16) \ 00034 *((tHalUint8 *)ptr)) | \ 00035 ((tHalUint16) \ 00036 *((tHalUint8 *)ptr + 1) << 8 ) ) 00037 00038 #define LE_TO_NRG_32(ptr) (tHalUint32) ( ((tHalUint32) \ 00039 *((tHalUint8 *)ptr)) | \ 00040 ((tHalUint32) \ 00041 *((tHalUint8 *)ptr + 1) << 8) | \ 00042 ((tHalUint32) \ 00043 *((tHalUint8 *)ptr + 2) << 16) | \ 00044 ((tHalUint32) \ 00045 *((tHalUint8 *)ptr + 3) << 24) ) 00046 00047 /* Store Value into a buffer in Little Endian Format */ 00048 #define STORE_LE_16(buf, val) ( ((buf)[0] = (tHalUint8) (val) ) , \ 00049 ((buf)[1] = (tHalUint8) (val>>8) ) ) 00050 00051 #define STORE_LE_32(buf, val) ( ((buf)[0] = (tHalUint8) (val) ) , \ 00052 ((buf)[1] = (tHalUint8) (val>>8) ) , \ 00053 ((buf)[2] = (tHalUint8) (val>>16) ) , \ 00054 ((buf)[3] = (tHalUint8) (val>>24) ) ) 00055 00056 /****************************************************************************** 00057 * Types 00058 *****************************************************************************/ 00059 00060 /****************************************************************************** 00061 * Function Prototypes 00062 *****************************************************************************/ 00063 00064 /** 00065 * Writes data to a serial interface. 00066 * 00067 * @param[in] data1 1st buffer 00068 * @param[in] data2 2nd buffer 00069 * @param[in] n_bytes1 number of bytes in 1st buffer 00070 * @param[in] n_bytes2 number of bytes in 2nd buffer 00071 */ 00072 void Hal_Write_Serial(const void* data1, const void* data2, tHalInt32 n_bytes1, tHalInt32 n_bytes2); 00073 00074 /** 00075 * Enable interrupts from HCI controller. 00076 */ 00077 void Enable_SPI_IRQ(void); 00078 00079 /** 00080 * Disable interrupts from BLE controller. 00081 */ 00082 void Disable_SPI_IRQ(void); 00083 00084 00085 #ifdef __cplusplus 00086 } 00087 #endif 00088 00089 #endif /* __HAL_H__ */ 00090
Generated on Tue Jul 12 2022 22:44:50 by
1.7.2
