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