Nicolas Borla / Mbed OS BBR_1Ebene
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers lp_ticker_api.h Source File

lp_ticker_api.h

00001 
00002 /** \addtogroup hal */
00003 /** @{*/
00004 /* mbed Microcontroller Library
00005  * Copyright (c) 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_LPTICKER_API_H
00020 #define MBED_LPTICKER_API_H
00021 
00022 #include "device.h"
00023 
00024 #if DEVICE_LOWPOWERTIMER
00025 
00026 #include "hal/ticker_api.h"
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031 
00032 /**
00033  * \defgroup hal_LpTicker Low Power Ticker Functions
00034  * @{
00035  */
00036 
00037 typedef void (*ticker_irq_handler_type)(const ticker_data_t *const);
00038 
00039 /** Set low power ticker IRQ handler
00040  *
00041  * @param ticker_irq_handler IRQ handler to be connected
00042  *
00043  * @return previous ticker IRQ handler
00044  *
00045  * @note by default IRQ handler is set to ticker_irq_handler()
00046  * @note this function is primarily for testing purposes and it's not required part of HAL implementation
00047  *
00048  */
00049 ticker_irq_handler_type set_lp_ticker_irq_handler(ticker_irq_handler_type ticker_irq_handler);
00050 
00051 /** Get low power ticker's data
00052  *
00053  * @return The low power ticker data
00054  */
00055 const ticker_data_t* get_lp_ticker_data(void);
00056 
00057 /** The wrapper for ticker_irq_handler, to pass lp ticker's data
00058  *
00059  */
00060 void lp_ticker_irq_handler(void);
00061 
00062 /* HAL lp ticker */
00063 
00064 /** Initialize the low power ticker
00065  *
00066  */
00067 void lp_ticker_init(void);
00068 
00069 /** Read the current counter
00070  *
00071  * @return The current timer's counter value in microseconds
00072  */
00073 uint32_t lp_ticker_read(void);
00074 
00075 /** Set interrupt for specified timestamp
00076  *
00077  * @param timestamp The time in microseconds to be set
00078  */
00079 void lp_ticker_set_interrupt(timestamp_t timestamp);
00080 
00081 /** Disable low power ticker interrupt
00082  *
00083  */
00084 void lp_ticker_disable_interrupt(void);
00085 
00086 /** Clear the low power ticker interrupt
00087  *
00088  */
00089 void lp_ticker_clear_interrupt(void);
00090 
00091 /** Set pending interrupt that should be fired right away.
00092  * 
00093  * The ticker should be initialized prior calling this function.
00094  */
00095 void lp_ticker_fire_interrupt(void);
00096 
00097 /** Get frequency and counter bits of this ticker.
00098  *
00099  */
00100 const ticker_info_t* lp_ticker_get_info(void);
00101 
00102 /**@}*/
00103 
00104 #ifdef __cplusplus
00105 }
00106 #endif
00107 
00108 #endif
00109 
00110 #endif
00111 
00112 /** @}*/