HW layer for the Nucleo board, it only work with old BLE_API

Dependents:   Hello_BLE F446RE-BLE

Fork of X_NUCLEO_IDB0XA1 by ST

Committer:
Silvio Lucio Oliva
Date:
Mon Jun 08 17:08:01 2015 +0200
Revision:
70:d20d30f59b1c
Child:
81:ba990c2e9cb8
Child:
82:c8c77e1fe472
Initial commit for mbed support

Signed-off-by: Silvio Lucio Oliva <silvio.oliva@st.com>

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Silvio Lucio Oliva 70:d20d30f59b1c 1 /* mbed Microcontroller Library
Silvio Lucio Oliva 70:d20d30f59b1c 2 * Copyright (c) 2006-2013 ARM Limited
Silvio Lucio Oliva 70:d20d30f59b1c 3 *
Silvio Lucio Oliva 70:d20d30f59b1c 4 * Licensed under the Apache License, Version 2.0 (the "License");
Silvio Lucio Oliva 70:d20d30f59b1c 5 * you may not use this file except in compliance with the License.
Silvio Lucio Oliva 70:d20d30f59b1c 6 * You may obtain a copy of the License at
Silvio Lucio Oliva 70:d20d30f59b1c 7 *
Silvio Lucio Oliva 70:d20d30f59b1c 8 * http://www.apache.org/licenses/LICENSE-2.0
Silvio Lucio Oliva 70:d20d30f59b1c 9 *
Silvio Lucio Oliva 70:d20d30f59b1c 10 * Unless required by applicable law or agreed to in writing, software
Silvio Lucio Oliva 70:d20d30f59b1c 11 * distributed under the License is distributed on an "AS IS" BASIS,
Silvio Lucio Oliva 70:d20d30f59b1c 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Silvio Lucio Oliva 70:d20d30f59b1c 13 * See the License for the specific language governing permissions and
Silvio Lucio Oliva 70:d20d30f59b1c 14 * limitations under the License.
Silvio Lucio Oliva 70:d20d30f59b1c 15 */
Silvio Lucio Oliva 70:d20d30f59b1c 16
Silvio Lucio Oliva 70:d20d30f59b1c 17
Silvio Lucio Oliva 70:d20d30f59b1c 18 // utility functions
Silvio Lucio Oliva 70:d20d30f59b1c 19
Silvio Lucio Oliva 70:d20d30f59b1c 20 #ifndef __UTIL_H__
Silvio Lucio Oliva 70:d20d30f59b1c 21 #define __UTIL_H__
Silvio Lucio Oliva 70:d20d30f59b1c 22
Silvio Lucio Oliva 70:d20d30f59b1c 23 #include "hal_types.h"
Silvio Lucio Oliva 70:d20d30f59b1c 24 #include "mbed.h"
Silvio Lucio Oliva 70:d20d30f59b1c 25
Silvio Lucio Oliva 70:d20d30f59b1c 26 #define NEED_CONSOLE_OUTPUT 1 /* Set this if you need debug messages on the console; */
Silvio Lucio Oliva 70:d20d30f59b1c 27 /*it will have an impact on code-size and power consumption. */
Silvio Lucio Oliva 70:d20d30f59b1c 28
Silvio Lucio Oliva 70:d20d30f59b1c 29 #if NEED_CONSOLE_OUTPUT
Silvio Lucio Oliva 70:d20d30f59b1c 30 //Serial usb(USBTX, USBRX); // tx, rx
Silvio Lucio Oliva 70:d20d30f59b1c 31 extern Serial pc;
Silvio Lucio Oliva 70:d20d30f59b1c 32 #define DEBUG(...) { pc.printf(__VA_ARGS__); }
Silvio Lucio Oliva 70:d20d30f59b1c 33 #else
Silvio Lucio Oliva 70:d20d30f59b1c 34 #define DEBUG(...) /* nothing */
Silvio Lucio Oliva 70:d20d30f59b1c 35 #endif /* #if NEED_CONSOLE_OUTPUT */
Silvio Lucio Oliva 70:d20d30f59b1c 36
Silvio Lucio Oliva 70:d20d30f59b1c 37 #define STORE_LE_16(buf, val) ( ((buf)[0] = (uint8_t) (val) ) , \
Silvio Lucio Oliva 70:d20d30f59b1c 38 ((buf)[1] = (uint8_t) (val>>8) ) )
Silvio Lucio Oliva 70:d20d30f59b1c 39
Silvio Lucio Oliva 70:d20d30f59b1c 40 #define STORE_LE_32(buf, val) ( ((buf)[0] = (uint8_t) (val) ) , \
Silvio Lucio Oliva 70:d20d30f59b1c 41 ((buf)[1] = (uint8_t) (val>>8) ) , \
Silvio Lucio Oliva 70:d20d30f59b1c 42 ((buf)[2] = (uint8_t) (val>>16) ) , \
Silvio Lucio Oliva 70:d20d30f59b1c 43 ((buf)[3] = (uint8_t) (val>>24) ) )
Silvio Lucio Oliva 70:d20d30f59b1c 44
Silvio Lucio Oliva 70:d20d30f59b1c 45 #define COPY_UUID_128(uuid_struct, uuid_15, uuid_14, uuid_13, uuid_12, uuid_11, uuid_10, uuid_9, uuid_8, uuid_7, uuid_6, uuid_5, uuid_4, uuid_3, uuid_2, uuid_1, uuid_0) \
Silvio Lucio Oliva 70:d20d30f59b1c 46 do {\
Silvio Lucio Oliva 70:d20d30f59b1c 47 uuid_struct[0] = uuid_0; uuid_struct[1] = uuid_1; uuid_struct[2] = uuid_2; uuid_struct[3] = uuid_3; \
Silvio Lucio Oliva 70:d20d30f59b1c 48 uuid_struct[4] = uuid_4; uuid_struct[5] = uuid_5; uuid_struct[6] = uuid_6; uuid_struct[7] = uuid_7; \
Silvio Lucio Oliva 70:d20d30f59b1c 49 uuid_struct[8] = uuid_8; uuid_struct[9] = uuid_9; uuid_struct[10] = uuid_10; uuid_struct[11] = uuid_11; \
Silvio Lucio Oliva 70:d20d30f59b1c 50 uuid_struct[12] = uuid_12; uuid_struct[13] = uuid_13; uuid_struct[14] = uuid_14; uuid_struct[15] = uuid_15; \
Silvio Lucio Oliva 70:d20d30f59b1c 51 }while(0)
Silvio Lucio Oliva 70:d20d30f59b1c 52
Silvio Lucio Oliva 70:d20d30f59b1c 53
Silvio Lucio Oliva 70:d20d30f59b1c 54 double getHighPowerAndPALevelValue(int8_t dBMLevel, int8_t& EN_HIGH_POWER, int8_t& PA_LEVEL);
Silvio Lucio Oliva 70:d20d30f59b1c 55
Silvio Lucio Oliva 70:d20d30f59b1c 56 #endif // __UTIL_H__
Silvio Lucio Oliva 70:d20d30f59b1c 57