mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mbed_lp_ticker_wrapper.h Source File

mbed_lp_ticker_wrapper.h

00001 
00002 /** \addtogroup hal */
00003 /** @{*/
00004 /* mbed Microcontroller Library
00005  * Copyright (c) 2018 ARM Limited
00006  * SPDX-License-Identifier: Apache-2.0
00007  *
00008  * Licensed under the Apache License, Version 2.0 (the "License");
00009  * you may not use this file except in compliance with the License.
00010  * You may obtain a copy of the License at
00011  *
00012  *     http://www.apache.org/licenses/LICENSE-2.0
00013  *
00014  * Unless required by applicable law or agreed to in writing, software
00015  * distributed under the License is distributed on an "AS IS" BASIS,
00016  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00017  * See the License for the specific language governing permissions and
00018  * limitations under the License.
00019  */
00020 #ifndef MBED_LP_TICKER_WRAPPER_H
00021 #define MBED_LP_TICKER_WRAPPER_H
00022 
00023 #include "device.h"
00024 
00025 #if DEVICE_LPTICKER
00026 
00027 #include "hal/ticker_api.h"
00028 #include <stdbool.h>
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033 
00034 typedef void (*ticker_irq_handler_type)(const ticker_data_t *const);
00035 
00036 /**
00037  * Interrupt handler for the wrapped lp ticker
00038  *
00039  * @param handler the function which would normally be called by the
00040  *      lp ticker handler when it is not wrapped
00041  */
00042 void lp_ticker_wrapper_irq_handler(ticker_irq_handler_type handler);
00043 
00044 /**
00045  * Get wrapped lp ticker data
00046  *
00047  * @param data hardware low power ticker object
00048  * @return wrapped low power ticker object
00049  */
00050 const ticker_data_t *get_lp_ticker_wrapper_data(const ticker_data_t *data);
00051 
00052 /**
00053  * Suspend the wrapper layer code
00054  *
00055  * Pass through all interrupts to the low power ticker and stop using
00056  * the microsecond ticker.
00057  *
00058  * @warning: Make sure to suspend the LP ticker first (call ticker_suspend()),
00059  * otherwise the behavior is undefined.
00060  */
00061 void lp_ticker_wrapper_suspend(void);
00062 
00063 /**
00064  * Resume the wrapper layer code
00065  *
00066  * Resume operation of the wrapper layer. Interrupts will be filtered
00067  * as normal and the microsecond timer will be used for interrupts scheduled
00068  * too quickly back-to-back.
00069  */
00070 void lp_ticker_wrapper_resume(void);
00071 
00072 /**@}*/
00073 
00074 #ifdef __cplusplus
00075 }
00076 #endif
00077 
00078 #endif
00079 
00080 #endif
00081 
00082 /** @}*/