Yihui Xiong
/
Seeed_nRF51822_Motion
initial
mbed-src/hal/us_ticker_api.h@0:638edba3adf6, 2016-01-11 (annotated)
- Committer:
- yihui
- Date:
- Mon Jan 11 02:32:24 2016 +0000
- Revision:
- 0:638edba3adf6
initial
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yihui | 0:638edba3adf6 | 1 | /* mbed Microcontroller Library |
yihui | 0:638edba3adf6 | 2 | * Copyright (c) 2006-2015 ARM Limited |
yihui | 0:638edba3adf6 | 3 | * |
yihui | 0:638edba3adf6 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
yihui | 0:638edba3adf6 | 5 | * you may not use this file except in compliance with the License. |
yihui | 0:638edba3adf6 | 6 | * You may obtain a copy of the License at |
yihui | 0:638edba3adf6 | 7 | * |
yihui | 0:638edba3adf6 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
yihui | 0:638edba3adf6 | 9 | * |
yihui | 0:638edba3adf6 | 10 | * Unless required by applicable law or agreed to in writing, software |
yihui | 0:638edba3adf6 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
yihui | 0:638edba3adf6 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
yihui | 0:638edba3adf6 | 13 | * See the License for the specific language governing permissions and |
yihui | 0:638edba3adf6 | 14 | * limitations under the License. |
yihui | 0:638edba3adf6 | 15 | */ |
yihui | 0:638edba3adf6 | 16 | #ifndef MBED_US_TICKER_API_H |
yihui | 0:638edba3adf6 | 17 | #define MBED_US_TICKER_API_H |
yihui | 0:638edba3adf6 | 18 | |
yihui | 0:638edba3adf6 | 19 | #include <stdint.h> |
yihui | 0:638edba3adf6 | 20 | #include "ticker_api.h" |
yihui | 0:638edba3adf6 | 21 | |
yihui | 0:638edba3adf6 | 22 | #ifdef __cplusplus |
yihui | 0:638edba3adf6 | 23 | extern "C" { |
yihui | 0:638edba3adf6 | 24 | #endif |
yihui | 0:638edba3adf6 | 25 | |
yihui | 0:638edba3adf6 | 26 | /** |
yihui | 0:638edba3adf6 | 27 | * \defgroup UsTicker Microseconds Ticker Functions |
yihui | 0:638edba3adf6 | 28 | * @{ |
yihui | 0:638edba3adf6 | 29 | */ |
yihui | 0:638edba3adf6 | 30 | |
yihui | 0:638edba3adf6 | 31 | /** Get ticker's data |
yihui | 0:638edba3adf6 | 32 | * |
yihui | 0:638edba3adf6 | 33 | * @return The low power ticker data |
yihui | 0:638edba3adf6 | 34 | */ |
yihui | 0:638edba3adf6 | 35 | const ticker_data_t* get_us_ticker_data(void); |
yihui | 0:638edba3adf6 | 36 | |
yihui | 0:638edba3adf6 | 37 | |
yihui | 0:638edba3adf6 | 38 | /** The wrapper for ticker_irq_handler, to pass us ticker's data |
yihui | 0:638edba3adf6 | 39 | * |
yihui | 0:638edba3adf6 | 40 | */ |
yihui | 0:638edba3adf6 | 41 | void us_ticker_irq_handler(void); |
yihui | 0:638edba3adf6 | 42 | |
yihui | 0:638edba3adf6 | 43 | /* HAL us ticker */ |
yihui | 0:638edba3adf6 | 44 | |
yihui | 0:638edba3adf6 | 45 | /** Initialize the ticker |
yihui | 0:638edba3adf6 | 46 | * |
yihui | 0:638edba3adf6 | 47 | */ |
yihui | 0:638edba3adf6 | 48 | void us_ticker_init(void); |
yihui | 0:638edba3adf6 | 49 | |
yihui | 0:638edba3adf6 | 50 | /** Read the current counter |
yihui | 0:638edba3adf6 | 51 | * |
yihui | 0:638edba3adf6 | 52 | * @return The current timer's counter value in microseconds |
yihui | 0:638edba3adf6 | 53 | */ |
yihui | 0:638edba3adf6 | 54 | uint32_t us_ticker_read(void); |
yihui | 0:638edba3adf6 | 55 | |
yihui | 0:638edba3adf6 | 56 | /** Set interrupt for specified timestamp |
yihui | 0:638edba3adf6 | 57 | * |
yihui | 0:638edba3adf6 | 58 | * @param timestamp The time in microseconds to be set |
yihui | 0:638edba3adf6 | 59 | */ |
yihui | 0:638edba3adf6 | 60 | void us_ticker_set_interrupt(timestamp_t timestamp); |
yihui | 0:638edba3adf6 | 61 | |
yihui | 0:638edba3adf6 | 62 | /** Disable us ticker interrupt |
yihui | 0:638edba3adf6 | 63 | * |
yihui | 0:638edba3adf6 | 64 | */ |
yihui | 0:638edba3adf6 | 65 | void us_ticker_disable_interrupt(void); |
yihui | 0:638edba3adf6 | 66 | |
yihui | 0:638edba3adf6 | 67 | /** Clear us ticker interrupt |
yihui | 0:638edba3adf6 | 68 | * |
yihui | 0:638edba3adf6 | 69 | */ |
yihui | 0:638edba3adf6 | 70 | void us_ticker_clear_interrupt(void); |
yihui | 0:638edba3adf6 | 71 | |
yihui | 0:638edba3adf6 | 72 | /**@}*/ |
yihui | 0:638edba3adf6 | 73 | |
yihui | 0:638edba3adf6 | 74 | #ifdef __cplusplus |
yihui | 0:638edba3adf6 | 75 | } |
yihui | 0:638edba3adf6 | 76 | #endif |
yihui | 0:638edba3adf6 | 77 | |
yihui | 0:638edba3adf6 | 78 | #endif |