Daniel Vizcaya / Mbed OS 04_RTOS_Embebidos
Committer:
Bethory
Date:
Wed May 30 00:01:50 2018 +0000
Revision:
0:6ad07c9019fd
Codigo de tales para todos los pasculaes

Who changed what in which revision?

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