Home Alert System
Dependencies: PWM_Tone_Library DHT
mbed/lp_ticker_api.h@3:78f223d34f36, 2019-03-05 (annotated)
- Committer:
- ethaderu
- Date:
- Tue Mar 05 02:34:44 2019 +0000
- Revision:
- 3:78f223d34f36
Publish 1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ethaderu | 3:78f223d34f36 | 1 | /* mbed Microcontroller Library |
ethaderu | 3:78f223d34f36 | 2 | * Copyright (c) 2015 ARM Limited |
ethaderu | 3:78f223d34f36 | 3 | * |
ethaderu | 3:78f223d34f36 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
ethaderu | 3:78f223d34f36 | 5 | * you may not use this file except in compliance with the License. |
ethaderu | 3:78f223d34f36 | 6 | * You may obtain a copy of the License at |
ethaderu | 3:78f223d34f36 | 7 | * |
ethaderu | 3:78f223d34f36 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
ethaderu | 3:78f223d34f36 | 9 | * |
ethaderu | 3:78f223d34f36 | 10 | * Unless required by applicable law or agreed to in writing, software |
ethaderu | 3:78f223d34f36 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
ethaderu | 3:78f223d34f36 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ethaderu | 3:78f223d34f36 | 13 | * See the License for the specific language governing permissions and |
ethaderu | 3:78f223d34f36 | 14 | * limitations under the License. |
ethaderu | 3:78f223d34f36 | 15 | */ |
ethaderu | 3:78f223d34f36 | 16 | #ifndef MBED_LPTICKER_API_H |
ethaderu | 3:78f223d34f36 | 17 | #define MBED_LPTICKER_API_H |
ethaderu | 3:78f223d34f36 | 18 | |
ethaderu | 3:78f223d34f36 | 19 | #include "device.h" |
ethaderu | 3:78f223d34f36 | 20 | |
ethaderu | 3:78f223d34f36 | 21 | #if DEVICE_LOWPOWERTIMER |
ethaderu | 3:78f223d34f36 | 22 | |
ethaderu | 3:78f223d34f36 | 23 | #include "ticker_api.h" |
ethaderu | 3:78f223d34f36 | 24 | |
ethaderu | 3:78f223d34f36 | 25 | #ifdef __cplusplus |
ethaderu | 3:78f223d34f36 | 26 | extern "C" { |
ethaderu | 3:78f223d34f36 | 27 | #endif |
ethaderu | 3:78f223d34f36 | 28 | |
ethaderu | 3:78f223d34f36 | 29 | /** |
ethaderu | 3:78f223d34f36 | 30 | * \defgroup LpTicker Low Power Ticker Functions |
ethaderu | 3:78f223d34f36 | 31 | * @{ |
ethaderu | 3:78f223d34f36 | 32 | */ |
ethaderu | 3:78f223d34f36 | 33 | |
ethaderu | 3:78f223d34f36 | 34 | /** Get low power ticker's data |
ethaderu | 3:78f223d34f36 | 35 | * |
ethaderu | 3:78f223d34f36 | 36 | * @return The low power ticker data |
ethaderu | 3:78f223d34f36 | 37 | */ |
ethaderu | 3:78f223d34f36 | 38 | const ticker_data_t* get_lp_ticker_data(void); |
ethaderu | 3:78f223d34f36 | 39 | |
ethaderu | 3:78f223d34f36 | 40 | /** The wrapper for ticker_irq_handler, to pass lp ticker's data |
ethaderu | 3:78f223d34f36 | 41 | * |
ethaderu | 3:78f223d34f36 | 42 | */ |
ethaderu | 3:78f223d34f36 | 43 | void lp_ticker_irq_handler(void); |
ethaderu | 3:78f223d34f36 | 44 | |
ethaderu | 3:78f223d34f36 | 45 | /* HAL lp ticker */ |
ethaderu | 3:78f223d34f36 | 46 | |
ethaderu | 3:78f223d34f36 | 47 | /** Initialize the low power ticker |
ethaderu | 3:78f223d34f36 | 48 | * |
ethaderu | 3:78f223d34f36 | 49 | */ |
ethaderu | 3:78f223d34f36 | 50 | void lp_ticker_init(void); |
ethaderu | 3:78f223d34f36 | 51 | |
ethaderu | 3:78f223d34f36 | 52 | /** Read the current counter |
ethaderu | 3:78f223d34f36 | 53 | * |
ethaderu | 3:78f223d34f36 | 54 | * @return The current timer's counter value in microseconds |
ethaderu | 3:78f223d34f36 | 55 | */ |
ethaderu | 3:78f223d34f36 | 56 | uint32_t lp_ticker_read(void); |
ethaderu | 3:78f223d34f36 | 57 | |
ethaderu | 3:78f223d34f36 | 58 | /** Set interrupt for specified timestamp |
ethaderu | 3:78f223d34f36 | 59 | * |
ethaderu | 3:78f223d34f36 | 60 | * @param timestamp The time in microseconds to be set |
ethaderu | 3:78f223d34f36 | 61 | */ |
ethaderu | 3:78f223d34f36 | 62 | void lp_ticker_set_interrupt(timestamp_t timestamp); |
ethaderu | 3:78f223d34f36 | 63 | |
ethaderu | 3:78f223d34f36 | 64 | /** Disable low power ticker interrupt |
ethaderu | 3:78f223d34f36 | 65 | * |
ethaderu | 3:78f223d34f36 | 66 | */ |
ethaderu | 3:78f223d34f36 | 67 | void lp_ticker_disable_interrupt(void); |
ethaderu | 3:78f223d34f36 | 68 | |
ethaderu | 3:78f223d34f36 | 69 | /** Clear the low power ticker interrupt |
ethaderu | 3:78f223d34f36 | 70 | * |
ethaderu | 3:78f223d34f36 | 71 | */ |
ethaderu | 3:78f223d34f36 | 72 | void lp_ticker_clear_interrupt(void); |
ethaderu | 3:78f223d34f36 | 73 | |
ethaderu | 3:78f223d34f36 | 74 | /**@}*/ |
ethaderu | 3:78f223d34f36 | 75 | |
ethaderu | 3:78f223d34f36 | 76 | #ifdef __cplusplus |
ethaderu | 3:78f223d34f36 | 77 | } |
ethaderu | 3:78f223d34f36 | 78 | #endif |
ethaderu | 3:78f223d34f36 | 79 | |
ethaderu | 3:78f223d34f36 | 80 | #endif |
ethaderu | 3:78f223d34f36 | 81 | |
ethaderu | 3:78f223d34f36 | 82 | #endif |