Backup 1

Committer:
borlanic
Date:
Tue Apr 24 11:45:18 2018 +0000
Revision:
0:02dd72d1d465
BaBoRo_test2 - backup 1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
borlanic 0:02dd72d1d465 1
borlanic 0:02dd72d1d465 2 /** \addtogroup hal */
borlanic 0:02dd72d1d465 3 /** @{*/
borlanic 0:02dd72d1d465 4 /* mbed Microcontroller Library
borlanic 0:02dd72d1d465 5 * Copyright (c) 2006-2015 ARM Limited
borlanic 0:02dd72d1d465 6 *
borlanic 0:02dd72d1d465 7 * Licensed under the Apache License, Version 2.0 (the "License");
borlanic 0:02dd72d1d465 8 * you may not use this file except in compliance with the License.
borlanic 0:02dd72d1d465 9 * You may obtain a copy of the License at
borlanic 0:02dd72d1d465 10 *
borlanic 0:02dd72d1d465 11 * http://www.apache.org/licenses/LICENSE-2.0
borlanic 0:02dd72d1d465 12 *
borlanic 0:02dd72d1d465 13 * Unless required by applicable law or agreed to in writing, software
borlanic 0:02dd72d1d465 14 * distributed under the License is distributed on an "AS IS" BASIS,
borlanic 0:02dd72d1d465 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
borlanic 0:02dd72d1d465 16 * See the License for the specific language governing permissions and
borlanic 0:02dd72d1d465 17 * limitations under the License.
borlanic 0:02dd72d1d465 18 */
borlanic 0:02dd72d1d465 19 #ifndef MBED_US_TICKER_API_H
borlanic 0:02dd72d1d465 20 #define MBED_US_TICKER_API_H
borlanic 0:02dd72d1d465 21
borlanic 0:02dd72d1d465 22 #include <stdint.h>
borlanic 0:02dd72d1d465 23 #include "hal/ticker_api.h"
borlanic 0:02dd72d1d465 24
borlanic 0:02dd72d1d465 25 #ifdef __cplusplus
borlanic 0:02dd72d1d465 26 extern "C" {
borlanic 0:02dd72d1d465 27 #endif
borlanic 0:02dd72d1d465 28
borlanic 0:02dd72d1d465 29 /**
borlanic 0:02dd72d1d465 30 * \defgroup hal_UsTicker Microseconds Ticker Functions
borlanic 0:02dd72d1d465 31 * @{
borlanic 0:02dd72d1d465 32 */
borlanic 0:02dd72d1d465 33
borlanic 0:02dd72d1d465 34 typedef void (*ticker_irq_handler_type)(const ticker_data_t *const);
borlanic 0:02dd72d1d465 35
borlanic 0:02dd72d1d465 36 /** Set ticker IRQ handler
borlanic 0:02dd72d1d465 37 *
borlanic 0:02dd72d1d465 38 * @param ticker_irq_handler IRQ handler to be connected
borlanic 0:02dd72d1d465 39 *
borlanic 0:02dd72d1d465 40 * @return previous ticker IRQ handler
borlanic 0:02dd72d1d465 41 *
borlanic 0:02dd72d1d465 42 * @note by default IRQ handler is set to ticker_irq_handler()
borlanic 0:02dd72d1d465 43 * @note this function is primarily for testing purposes and it's not required part of HAL implementation
borlanic 0:02dd72d1d465 44 *
borlanic 0:02dd72d1d465 45 */
borlanic 0:02dd72d1d465 46 ticker_irq_handler_type set_us_ticker_irq_handler(ticker_irq_handler_type ticker_irq_handler);
borlanic 0:02dd72d1d465 47
borlanic 0:02dd72d1d465 48 /** Get ticker's data
borlanic 0:02dd72d1d465 49 *
borlanic 0:02dd72d1d465 50 * @return The low power ticker data
borlanic 0:02dd72d1d465 51 */
borlanic 0:02dd72d1d465 52 const ticker_data_t* get_us_ticker_data(void);
borlanic 0:02dd72d1d465 53
borlanic 0:02dd72d1d465 54
borlanic 0:02dd72d1d465 55 /** The wrapper for ticker_irq_handler, to pass us ticker's data
borlanic 0:02dd72d1d465 56 *
borlanic 0:02dd72d1d465 57 */
borlanic 0:02dd72d1d465 58 void us_ticker_irq_handler(void);
borlanic 0:02dd72d1d465 59
borlanic 0:02dd72d1d465 60 /* HAL us ticker */
borlanic 0:02dd72d1d465 61
borlanic 0:02dd72d1d465 62 /** Initialize the ticker
borlanic 0:02dd72d1d465 63 *
borlanic 0:02dd72d1d465 64 */
borlanic 0:02dd72d1d465 65 void us_ticker_init(void);
borlanic 0:02dd72d1d465 66
borlanic 0:02dd72d1d465 67 /** Read the current counter
borlanic 0:02dd72d1d465 68 *
borlanic 0:02dd72d1d465 69 * @return The current timer's counter value in microseconds
borlanic 0:02dd72d1d465 70 */
borlanic 0:02dd72d1d465 71 uint32_t us_ticker_read(void);
borlanic 0:02dd72d1d465 72
borlanic 0:02dd72d1d465 73 /** Set interrupt for specified timestamp
borlanic 0:02dd72d1d465 74 *
borlanic 0:02dd72d1d465 75 * @param timestamp The time in microseconds to be set
borlanic 0:02dd72d1d465 76 */
borlanic 0:02dd72d1d465 77 void us_ticker_set_interrupt(timestamp_t timestamp);
borlanic 0:02dd72d1d465 78
borlanic 0:02dd72d1d465 79 /** Disable us ticker interrupt
borlanic 0:02dd72d1d465 80 *
borlanic 0:02dd72d1d465 81 */
borlanic 0:02dd72d1d465 82 void us_ticker_disable_interrupt(void);
borlanic 0:02dd72d1d465 83
borlanic 0:02dd72d1d465 84 /** Clear us ticker interrupt
borlanic 0:02dd72d1d465 85 *
borlanic 0:02dd72d1d465 86 */
borlanic 0:02dd72d1d465 87 void us_ticker_clear_interrupt(void);
borlanic 0:02dd72d1d465 88
borlanic 0:02dd72d1d465 89 /** Set pending interrupt that should be fired right away.
borlanic 0:02dd72d1d465 90 *
borlanic 0:02dd72d1d465 91 * The ticker should be initialized prior calling this function.
borlanic 0:02dd72d1d465 92 */
borlanic 0:02dd72d1d465 93 void us_ticker_fire_interrupt(void);
borlanic 0:02dd72d1d465 94
borlanic 0:02dd72d1d465 95 /** Get frequency and counter bits of this ticker.
borlanic 0:02dd72d1d465 96 *
borlanic 0:02dd72d1d465 97 */
borlanic 0:02dd72d1d465 98 const ticker_info_t* us_ticker_get_info(void);
borlanic 0:02dd72d1d465 99
borlanic 0:02dd72d1d465 100 /**@}*/
borlanic 0:02dd72d1d465 101
borlanic 0:02dd72d1d465 102 #ifdef __cplusplus
borlanic 0:02dd72d1d465 103 }
borlanic 0:02dd72d1d465 104 #endif
borlanic 0:02dd72d1d465 105
borlanic 0:02dd72d1d465 106 #endif
borlanic 0:02dd72d1d465 107
borlanic 0:02dd72d1d465 108 /** @}*/