Nicolas Borla / Mbed OS ROME2_Robot_Firmware
Committer:
boro
Date:
Mon Mar 16 13:12:31 2020 +0000
Revision:
0:4beb2ea291ec
a

Who changed what in which revision?

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