fix nrf51822 i2c & spi conflict

Dependencies:   BLE_API eMPL_MPU6050 nRF51822

Fork of Seeed_Tiny_BLE_Flash by Darren Huang

Committer:
yihui
Date:
Tue Nov 17 07:48:56 2015 +0000
Revision:
5:b8c02645e6af
fix i2c & spi conflict

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yihui 5:b8c02645e6af 1 /* mbed Microcontroller Library
yihui 5:b8c02645e6af 2 * Copyright (c) 2006-2013 ARM Limited
yihui 5:b8c02645e6af 3 *
yihui 5:b8c02645e6af 4 * Licensed under the Apache License, Version 2.0 (the "License");
yihui 5:b8c02645e6af 5 * you may not use this file except in compliance with the License.
yihui 5:b8c02645e6af 6 * You may obtain a copy of the License at
yihui 5:b8c02645e6af 7 *
yihui 5:b8c02645e6af 8 * http://www.apache.org/licenses/LICENSE-2.0
yihui 5:b8c02645e6af 9 *
yihui 5:b8c02645e6af 10 * Unless required by applicable law or agreed to in writing, software
yihui 5:b8c02645e6af 11 * distributed under the License is distributed on an "AS IS" BASIS,
yihui 5:b8c02645e6af 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
yihui 5:b8c02645e6af 13 * See the License for the specific language governing permissions and
yihui 5:b8c02645e6af 14 * limitations under the License.
yihui 5:b8c02645e6af 15 */
yihui 5:b8c02645e6af 16 #ifndef MBED_TIMER_H
yihui 5:b8c02645e6af 17 #define MBED_TIMER_H
yihui 5:b8c02645e6af 18
yihui 5:b8c02645e6af 19 #include "platform.h"
yihui 5:b8c02645e6af 20 #include "ticker_api.h"
yihui 5:b8c02645e6af 21
yihui 5:b8c02645e6af 22 namespace mbed {
yihui 5:b8c02645e6af 23
yihui 5:b8c02645e6af 24 /** A general purpose timer
yihui 5:b8c02645e6af 25 *
yihui 5:b8c02645e6af 26 * Example:
yihui 5:b8c02645e6af 27 * @code
yihui 5:b8c02645e6af 28 * // Count the time to toggle a LED
yihui 5:b8c02645e6af 29 *
yihui 5:b8c02645e6af 30 * #include "mbed.h"
yihui 5:b8c02645e6af 31 *
yihui 5:b8c02645e6af 32 * Timer timer;
yihui 5:b8c02645e6af 33 * DigitalOut led(LED1);
yihui 5:b8c02645e6af 34 * int begin, end;
yihui 5:b8c02645e6af 35 *
yihui 5:b8c02645e6af 36 * int main() {
yihui 5:b8c02645e6af 37 * timer.start();
yihui 5:b8c02645e6af 38 * begin = timer.read_us();
yihui 5:b8c02645e6af 39 * led = !led;
yihui 5:b8c02645e6af 40 * end = timer.read_us();
yihui 5:b8c02645e6af 41 * printf("Toggle the led takes %d us", end - begin);
yihui 5:b8c02645e6af 42 * }
yihui 5:b8c02645e6af 43 * @endcode
yihui 5:b8c02645e6af 44 */
yihui 5:b8c02645e6af 45 class Timer {
yihui 5:b8c02645e6af 46
yihui 5:b8c02645e6af 47 public:
yihui 5:b8c02645e6af 48 Timer();
yihui 5:b8c02645e6af 49 Timer(const ticker_data_t *data);
yihui 5:b8c02645e6af 50
yihui 5:b8c02645e6af 51 /** Start the timer
yihui 5:b8c02645e6af 52 */
yihui 5:b8c02645e6af 53 void start();
yihui 5:b8c02645e6af 54
yihui 5:b8c02645e6af 55 /** Stop the timer
yihui 5:b8c02645e6af 56 */
yihui 5:b8c02645e6af 57 void stop();
yihui 5:b8c02645e6af 58
yihui 5:b8c02645e6af 59 /** Reset the timer to 0.
yihui 5:b8c02645e6af 60 *
yihui 5:b8c02645e6af 61 * If it was already counting, it will continue
yihui 5:b8c02645e6af 62 */
yihui 5:b8c02645e6af 63 void reset();
yihui 5:b8c02645e6af 64
yihui 5:b8c02645e6af 65 /** Get the time passed in seconds
yihui 5:b8c02645e6af 66 */
yihui 5:b8c02645e6af 67 float read();
yihui 5:b8c02645e6af 68
yihui 5:b8c02645e6af 69 /** Get the time passed in mili-seconds
yihui 5:b8c02645e6af 70 */
yihui 5:b8c02645e6af 71 int read_ms();
yihui 5:b8c02645e6af 72
yihui 5:b8c02645e6af 73 /** Get the time passed in micro-seconds
yihui 5:b8c02645e6af 74 */
yihui 5:b8c02645e6af 75 int read_us();
yihui 5:b8c02645e6af 76
yihui 5:b8c02645e6af 77 #ifdef MBED_OPERATORS
yihui 5:b8c02645e6af 78 operator float();
yihui 5:b8c02645e6af 79 #endif
yihui 5:b8c02645e6af 80
yihui 5:b8c02645e6af 81 protected:
yihui 5:b8c02645e6af 82 int slicetime();
yihui 5:b8c02645e6af 83 int _running; // whether the timer is running
yihui 5:b8c02645e6af 84 unsigned int _start; // the start time of the latest slice
yihui 5:b8c02645e6af 85 int _time; // any accumulated time from previous slices
yihui 5:b8c02645e6af 86 const ticker_data_t *_ticker_data;
yihui 5:b8c02645e6af 87 };
yihui 5:b8c02645e6af 88
yihui 5:b8c02645e6af 89 } // namespace mbed
yihui 5:b8c02645e6af 90
yihui 5:b8c02645e6af 91 #endif