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