Mbed OS Reference
Loading...
Searching...
No Matches
mbed_lp_ticker_wrapper.h
1
2/** \addtogroup hal */
3/** @{*/
4/* mbed Microcontroller Library
5 * Copyright (c) 2018 ARM Limited
6 * SPDX-License-Identifier: Apache-2.0
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20#ifndef MBED_LP_TICKER_WRAPPER_H
21#define MBED_LP_TICKER_WRAPPER_H
22
23#include "device.h"
24
25#if DEVICE_LPTICKER
26
27#include "hal/ticker_api.h"
28#include <stdbool.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34typedef void (*ticker_irq_handler_type)(const ticker_data_t *const);
35
36/**
37 * Interrupt handler for the wrapped lp ticker
38 *
39 * @param handler the function which would normally be called by the
40 * lp ticker handler when it is not wrapped
41 */
42void lp_ticker_wrapper_irq_handler(ticker_irq_handler_type handler);
43
44/**
45 * Get wrapped lp ticker data
46 *
47 * @param data hardware low power ticker object
48 * @return wrapped low power ticker object
49 */
51
52/**
53 * Suspend the wrapper layer code
54 *
55 * Pass through all interrupts to the low power ticker and stop using
56 * the microsecond ticker.
57 *
58 * @warning: Make sure to suspend the LP ticker first (call ticker_suspend()),
59 * otherwise the behavior is undefined.
60 */
62
63/**
64 * Resume the wrapper layer code
65 *
66 * Resume operation of the wrapper layer. Interrupts will be filtered
67 * as normal and the microsecond timer will be used for interrupts scheduled
68 * too quickly back-to-back.
69 */
71
72#ifdef __cplusplus
73}
74#endif
75
76#endif
77
78#endif
79
80/** @}*/
void lp_ticker_wrapper_suspend(void)
Suspend the wrapper layer code.
void lp_ticker_wrapper_irq_handler(ticker_irq_handler_type handler)
Interrupt handler for the wrapped lp ticker.
void lp_ticker_wrapper_resume(void)
Resume the wrapper layer code.
const ticker_data_t * get_lp_ticker_wrapper_data(const ticker_data_t *data)
Get wrapped lp ticker data.
Ticker's data structure.
Definition: ticker_api.h:144