Theo/Ludo/Joe / ER2_Labyrinthe_V3

Dependencies:   mbed

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  *
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_LP_TICKER_WRAPPER_H
00020 #define MBED_LP_TICKER_WRAPPER_H
00021 
00022 #include "device.h"
00023 
00024 #if DEVICE_LPTICKER
00025 
00026 #include "hal/ticker_api.h"
00027 #include <stdbool.h>
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032 
00033 typedef void (*ticker_irq_handler_type)(const ticker_data_t *const);
00034 
00035 /**
00036  * Interrupt handler for the wrapped lp ticker
00037  *
00038  * @param handler the function which would normally be called by the
00039  *      lp ticker handler when it is not wrapped
00040  */
00041 void lp_ticker_wrapper_irq_handler(ticker_irq_handler_type handler);
00042 
00043 /**
00044  * Get wrapped lp ticker data
00045  *
00046  * @param data hardware low power ticker object
00047  * @return wrapped low power ticker object
00048  */
00049 const ticker_data_t *get_lp_ticker_wrapper_data(const ticker_data_t *data);
00050 
00051 /**
00052  * Suspend the wrapper layer code
00053  *
00054  * Pass through all interrupts to the low power ticker and stop using
00055  * the microsecond ticker.
00056  *
00057  * @warning: Make sure to suspend the LP ticker first (call ticker_suspend()),
00058  * otherwise the behavior is undefined.
00059  */
00060 void lp_ticker_wrapper_suspend(void);
00061 
00062 /**
00063  * Resume the wrapper layer code
00064  *
00065  * Resume operation of the wrapper layer. Interrupts will be filtered
00066  * as normal and the microsecond timer will be used for interrupts scheduled
00067  * too quickly back-to-back.
00068  */
00069 void lp_ticker_wrapper_resume(void);
00070 
00071 /**@}*/
00072 
00073 #ifdef __cplusplus
00074 }
00075 #endif
00076 
00077 #endif
00078 
00079 #endif
00080 
00081 /** @}*/