Previous version which works for my stm32f401 Nucleo board
Fork of X_NUCLEO_IDB0XA1 by
platform/inc/btle.h@74:c4526f8284d5, 2015-06-16 (annotated)
- Committer:
- Antonio Vilei
- Date:
- Tue Jun 16 10:23:56 2015 +0200
- Revision:
- 74:c4526f8284d5
- Parent:
- 70:d20d30f59b1c
Use mbed C++ API for BlueNRG Driver
Update the old driver and replace the low-level C functions
with the C++ API for SPI and InterruptIn.
Fix issues with interrupt initialization caused by the old driver
(calling mbed's private functions to setup SPI and irq and messing
up other code based on InterruptIn, e.g. button.)
Signed-off-by: Antonio Vilei <antonio.vilei@st.com>
Who changed what in which revision?
User | Revision | Line number | New 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 | #ifndef _BTLE_H_ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 19 | #define _BTLE_H_ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 20 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 21 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 22 | #ifdef __cplusplus |
Silvio Lucio Oliva |
70:d20d30f59b1c | 23 | extern "C" { |
Silvio Lucio Oliva |
70:d20d30f59b1c | 24 | #endif |
Silvio Lucio Oliva |
70:d20d30f59b1c | 25 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 26 | #include <stdio.h> |
Silvio Lucio Oliva |
70:d20d30f59b1c | 27 | #include <string.h> |
Silvio Lucio Oliva |
70:d20d30f59b1c | 28 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 29 | #include "hci.h" |
Silvio Lucio Oliva |
70:d20d30f59b1c | 30 | #include "bluenrg_aci.h" |
Silvio Lucio Oliva |
70:d20d30f59b1c | 31 | #include "hci_const.h" |
Silvio Lucio Oliva |
70:d20d30f59b1c | 32 | #include "bluenrg_hal_aci.h" |
Silvio Lucio Oliva |
70:d20d30f59b1c | 33 | #include "stm32_bluenrg_ble.h" |
Silvio Lucio Oliva |
70:d20d30f59b1c | 34 | #include "bluenrg_gap.h" |
Silvio Lucio Oliva |
70:d20d30f59b1c | 35 | #include "bluenrg_gatt_server.h" |
Silvio Lucio Oliva |
70:d20d30f59b1c | 36 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 37 | extern uint16_t g_gap_service_handle; |
Silvio Lucio Oliva |
70:d20d30f59b1c | 38 | extern uint16_t g_appearance_char_handle; |
Silvio Lucio Oliva |
70:d20d30f59b1c | 39 | extern uint16_t g_device_name_char_handle; |
Silvio Lucio Oliva |
70:d20d30f59b1c | 40 | |
Antonio Vilei |
74:c4526f8284d5 | 41 | void btle_init(bool isSetAddress); |
Silvio Lucio Oliva |
70:d20d30f59b1c | 42 | void SPI_Poll(void); |
Silvio Lucio Oliva |
70:d20d30f59b1c | 43 | void User_Process(void); |
Silvio Lucio Oliva |
70:d20d30f59b1c | 44 | void setConnectable(void); |
Silvio Lucio Oliva |
70:d20d30f59b1c | 45 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 46 | #ifdef __cplusplus |
Silvio Lucio Oliva |
70:d20d30f59b1c | 47 | } |
Silvio Lucio Oliva |
70:d20d30f59b1c | 48 | #endif |
Silvio Lucio Oliva |
70:d20d30f59b1c | 49 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 50 | #endif |