Previous version which works for my stm32f401 Nucleo board

Fork of X_NUCLEO_IDB0XA1 by ST

Committer:
Wolfgang Betz
Date:
Mon Jul 27 11:16:16 2015 +0200
Revision:
102:a6f233cb1fed
Parent:
92:709d44dc869a
Child:
103:12684d94c3a6
Merge commit '0f19b0b609394807e46c2069263806f2bd86682b' into ble_wb

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Wolfgang Betz 90:26c0c9807ab4 1 /* mbed Microcontroller Library
Wolfgang Betz 90:26c0c9807ab4 2 * Copyright (c) 2006-2013 ARM Limited
Wolfgang Betz 90:26c0c9807ab4 3 *
Wolfgang Betz 90:26c0c9807ab4 4 * Licensed under the Apache License, Version 2.0 (the "License");
Wolfgang Betz 90:26c0c9807ab4 5 * you may not use this file except in compliance with the License.
Wolfgang Betz 90:26c0c9807ab4 6 * You may obtain a copy of the License at
Wolfgang Betz 90:26c0c9807ab4 7 *
Wolfgang Betz 90:26c0c9807ab4 8 * http://www.apache.org/licenses/LICENSE-2.0
Wolfgang Betz 90:26c0c9807ab4 9 *
Wolfgang Betz 90:26c0c9807ab4 10 * Unless required by applicable law or agreed to in writing, software
Wolfgang Betz 90:26c0c9807ab4 11 * distributed under the License is distributed on an "AS IS" BASIS,
Wolfgang Betz 90:26c0c9807ab4 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Wolfgang Betz 90:26c0c9807ab4 13 * See the License for the specific language governing permissions and
Wolfgang Betz 90:26c0c9807ab4 14 * limitations under the License.
Wolfgang Betz 90:26c0c9807ab4 15 */
Wolfgang Betz 90:26c0c9807ab4 16
Wolfgang Betz 90:26c0c9807ab4 17 /**
Wolfgang Betz 90:26c0c9807ab4 18 ******************************************************************************
Wolfgang Betz 90:26c0c9807ab4 19 * @file BlueNRGDevice.h
Wolfgang Betz 90:26c0c9807ab4 20 * @author STMicroelectronics
Wolfgang Betz 90:26c0c9807ab4 21 * @brief Header file for BLEDeviceInstanceBase based BlueNRGDevice
Wolfgang Betz 90:26c0c9807ab4 22 ******************************************************************************
Wolfgang Betz 90:26c0c9807ab4 23 * @copy
Wolfgang Betz 90:26c0c9807ab4 24 *
Wolfgang Betz 90:26c0c9807ab4 25 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
Wolfgang Betz 90:26c0c9807ab4 26 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
Wolfgang Betz 90:26c0c9807ab4 27 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
Wolfgang Betz 90:26c0c9807ab4 28 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
Wolfgang Betz 90:26c0c9807ab4 29 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
Wolfgang Betz 90:26c0c9807ab4 30 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
Wolfgang Betz 90:26c0c9807ab4 31 *
Wolfgang Betz 90:26c0c9807ab4 32 * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2>
Wolfgang Betz 90:26c0c9807ab4 33 */
Wolfgang Betz 90:26c0c9807ab4 34
Wolfgang Betz 90:26c0c9807ab4 35 #ifndef __BLUENRG_DEVICE_H__
Wolfgang Betz 90:26c0c9807ab4 36 #define __BLUENRG_DEVICE_H__
Wolfgang Betz 90:26c0c9807ab4 37
Wolfgang Betz 90:26c0c9807ab4 38 #define BLUENRG
Wolfgang Betz 90:26c0c9807ab4 39 #define DEBUG_BLUENRG_USER
Wolfgang Betz 90:26c0c9807ab4 40
Wolfgang Betz 90:26c0c9807ab4 41 #include "btle.h"
Wolfgang Betz 90:26c0c9807ab4 42
Wolfgang Betz 90:26c0c9807ab4 43 #include "mbed.h"
Wolfgang Betz 90:26c0c9807ab4 44 #include "blecommon.h"
Wolfgang Betz 90:26c0c9807ab4 45 #include "BLE.h"
Wolfgang Betz 90:26c0c9807ab4 46 #include "BlueNRGGap.h"
Wolfgang Betz 90:26c0c9807ab4 47 #include "BlueNRGGattServer.h"
Wolfgang Betz 90:26c0c9807ab4 48
Wolfgang Betz 90:26c0c9807ab4 49
Wolfgang Betz 90:26c0c9807ab4 50 class BlueNRGDevice : public BLEInstanceBase
Wolfgang Betz 90:26c0c9807ab4 51 {
Wolfgang Betz 90:26c0c9807ab4 52
Wolfgang Betz 90:26c0c9807ab4 53 public:
Wolfgang Betz 90:26c0c9807ab4 54 BlueNRGDevice(PinName mosi, PinName miso, PinName sck, PinName cs, PinName rst, PinName irq);
Wolfgang Betz 90:26c0c9807ab4 55 virtual ~BlueNRGDevice(void);
Wolfgang Betz 90:26c0c9807ab4 56
Wolfgang Betz 90:26c0c9807ab4 57 virtual ble_error_t init(void);
Wolfgang Betz 90:26c0c9807ab4 58 virtual ble_error_t shutdown(void);
Wolfgang Betz 90:26c0c9807ab4 59 virtual const char *getVersion(void);
Wolfgang Betz 90:26c0c9807ab4 60 virtual Gap& getGap();
Wolfgang Betz 90:26c0c9807ab4 61 virtual const Gap& getGap() const;
Wolfgang Betz 90:26c0c9807ab4 62 virtual GattServer& getGattServer();
Wolfgang Betz 90:26c0c9807ab4 63 virtual const GattServer& getGattServer() const;
Wolfgang Betz 102:a6f233cb1fed 64 virtual GattClient& getGattClient();
Wolfgang Betz 102:a6f233cb1fed 65 virtual SecurityManager& getSecurityManager();
Wolfgang Betz 102:a6f233cb1fed 66 virtual const SecurityManager& getSecurityManager() const;
Wolfgang Betz 90:26c0c9807ab4 67 virtual void waitForEvent(void);
Wolfgang Betz 90:26c0c9807ab4 68
Wolfgang Betz 90:26c0c9807ab4 69 ble_error_t reset(void);
Wolfgang Betz 90:26c0c9807ab4 70 bool getIsInitialized(void);
Wolfgang Betz 90:26c0c9807ab4 71
Wolfgang Betz 90:26c0c9807ab4 72 bool dataPresent();
Wolfgang Betz 90:26c0c9807ab4 73 int32_t spiRead(uint8_t *buffer, uint8_t buff_size);
Wolfgang Betz 90:26c0c9807ab4 74 int32_t spiWrite(uint8_t* data1, uint8_t* data2, uint8_t Nb_bytes1, uint8_t Nb_bytes2);
Wolfgang Betz 90:26c0c9807ab4 75 void disable_irq();
Wolfgang Betz 90:26c0c9807ab4 76 void enable_irq();
Wolfgang Betz 90:26c0c9807ab4 77
Wolfgang Betz 90:26c0c9807ab4 78 private:
Wolfgang Betz 90:26c0c9807ab4 79 bool isInitialized;
Wolfgang Betz 90:26c0c9807ab4 80
Wolfgang Betz 90:26c0c9807ab4 81 SPI spi_;
Wolfgang Betz 90:26c0c9807ab4 82 DigitalOut nCS_;
Wolfgang Betz 90:26c0c9807ab4 83 DigitalOut rst_;
Wolfgang Betz 90:26c0c9807ab4 84 InterruptIn irq_;
Wolfgang Betz 90:26c0c9807ab4 85 };
Wolfgang Betz 90:26c0c9807ab4 86
Wolfgang Betz 90:26c0c9807ab4 87 #endif