Marco Zecchini
/
Example_RTOS
Rtos API example
Embed:
(wiki syntax)
Show/hide line numbers
us_ticker_api.h
00001 00002 /** \addtogroup hal */ 00003 /** @{*/ 00004 /* mbed Microcontroller Library 00005 * Copyright (c) 2006-2015 ARM Limited 00006 * 00007 * Licensed under the Apache License, Version 2.0 (the "License"); 00008 * you may not use this file except in compliance with the License. 00009 * You may obtain a copy of the License at 00010 * 00011 * http://www.apache.org/licenses/LICENSE-2.0 00012 * 00013 * Unless required by applicable law or agreed to in writing, software 00014 * distributed under the License is distributed on an "AS IS" BASIS, 00015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00016 * See the License for the specific language governing permissions and 00017 * limitations under the License. 00018 */ 00019 #ifndef MBED_US_TICKER_API_H 00020 #define MBED_US_TICKER_API_H 00021 00022 #include <stdint.h> 00023 #include "hal/ticker_api.h" 00024 00025 #ifdef __cplusplus 00026 extern "C" { 00027 #endif 00028 00029 /** 00030 * \defgroup hal_UsTicker Microseconds Ticker Functions 00031 * @{ 00032 */ 00033 00034 typedef void (*ticker_irq_handler_type)(const ticker_data_t *const); 00035 00036 /** Set ticker IRQ handler 00037 * 00038 * @param ticker_irq_handler IRQ handler to be connected 00039 * 00040 * @return previous ticker IRQ handler 00041 * 00042 * @note by default IRQ handler is set to ticker_irq_handler() 00043 * @note this function is primarily for testing purposes and it's not required part of HAL implementation 00044 * 00045 */ 00046 ticker_irq_handler_type set_us_ticker_irq_handler(ticker_irq_handler_type ticker_irq_handler); 00047 00048 /** Get ticker's data 00049 * 00050 * @return The low power ticker data 00051 */ 00052 const ticker_data_t* get_us_ticker_data(void); 00053 00054 00055 /** The wrapper for ticker_irq_handler, to pass us ticker's data 00056 * 00057 */ 00058 void us_ticker_irq_handler(void); 00059 00060 /* HAL us ticker */ 00061 00062 /** Initialize the ticker 00063 * 00064 */ 00065 void us_ticker_init(void); 00066 00067 /** Read the current counter 00068 * 00069 * @return The current timer's counter value in microseconds 00070 */ 00071 uint32_t us_ticker_read(void); 00072 00073 /** Set interrupt for specified timestamp 00074 * 00075 * @param timestamp The time in microseconds to be set 00076 */ 00077 void us_ticker_set_interrupt(timestamp_t timestamp); 00078 00079 /** Disable us ticker interrupt 00080 * 00081 */ 00082 void us_ticker_disable_interrupt(void); 00083 00084 /** Clear us ticker interrupt 00085 * 00086 */ 00087 void us_ticker_clear_interrupt(void); 00088 00089 /** Set pending interrupt that should be fired right away. 00090 * 00091 * The ticker should be initialized prior calling this function. 00092 */ 00093 void us_ticker_fire_interrupt(void); 00094 00095 /** Get frequency and counter bits of this ticker. 00096 * 00097 */ 00098 const ticker_info_t* us_ticker_get_info(void); 00099 00100 /**@}*/ 00101 00102 #ifdef __cplusplus 00103 } 00104 #endif 00105 00106 #endif 00107 00108 /** @}*/
Generated on Sun Jul 17 2022 08:25:32 by 1.7.2