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