mbed library sources. Supersedes mbed-src.

Fork of mbed-dev by mbed official

Committer:
Anna Bridge
Date:
Wed Jan 17 15:23:54 2018 +0000
Revision:
180:96ed750bd169
Parent:
174:b96e65c34a4d
Child:
186:707f6e361f3e
mbed-dev libray. Release version 158

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 149:156823d33999 1
<> 149:156823d33999 2 /** \addtogroup hal */
<> 149:156823d33999 3 /** @{*/
<> 144:ef7eb2e8f9f7 4 /* mbed Microcontroller Library
<> 144:ef7eb2e8f9f7 5 * Copyright (c) 2015 ARM Limited
<> 144:ef7eb2e8f9f7 6 *
<> 144:ef7eb2e8f9f7 7 * Licensed under the Apache License, Version 2.0 (the "License");
<> 144:ef7eb2e8f9f7 8 * you may not use this file except in compliance with the License.
<> 144:ef7eb2e8f9f7 9 * You may obtain a copy of the License at
<> 144:ef7eb2e8f9f7 10 *
<> 144:ef7eb2e8f9f7 11 * http://www.apache.org/licenses/LICENSE-2.0
<> 144:ef7eb2e8f9f7 12 *
<> 144:ef7eb2e8f9f7 13 * Unless required by applicable law or agreed to in writing, software
<> 144:ef7eb2e8f9f7 14 * distributed under the License is distributed on an "AS IS" BASIS,
<> 144:ef7eb2e8f9f7 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 144:ef7eb2e8f9f7 16 * See the License for the specific language governing permissions and
<> 144:ef7eb2e8f9f7 17 * limitations under the License.
<> 144:ef7eb2e8f9f7 18 */
<> 144:ef7eb2e8f9f7 19 #ifndef MBED_LPTICKER_API_H
<> 144:ef7eb2e8f9f7 20 #define MBED_LPTICKER_API_H
<> 144:ef7eb2e8f9f7 21
<> 144:ef7eb2e8f9f7 22 #include "device.h"
<> 144:ef7eb2e8f9f7 23
<> 144:ef7eb2e8f9f7 24 #if DEVICE_LOWPOWERTIMER
<> 144:ef7eb2e8f9f7 25
<> 149:156823d33999 26 #include "hal/ticker_api.h"
<> 144:ef7eb2e8f9f7 27
<> 144:ef7eb2e8f9f7 28 #ifdef __cplusplus
<> 144:ef7eb2e8f9f7 29 extern "C" {
<> 144:ef7eb2e8f9f7 30 #endif
<> 144:ef7eb2e8f9f7 31
<> 144:ef7eb2e8f9f7 32 /**
<> 144:ef7eb2e8f9f7 33 * \defgroup hal_LpTicker Low Power Ticker Functions
<> 144:ef7eb2e8f9f7 34 * @{
<> 144:ef7eb2e8f9f7 35 */
<> 144:ef7eb2e8f9f7 36
Anna Bridge 180:96ed750bd169 37 typedef void (*ticker_irq_handler_type)(const ticker_data_t *const);
Anna Bridge 180:96ed750bd169 38
Anna Bridge 180:96ed750bd169 39 /** Set low power ticker IRQ handler
Anna Bridge 180:96ed750bd169 40 *
Anna Bridge 180:96ed750bd169 41 * @param ticker_irq_handler IRQ handler to be connected
Anna Bridge 180:96ed750bd169 42 *
Anna Bridge 180:96ed750bd169 43 * @return previous ticker IRQ handler
Anna Bridge 180:96ed750bd169 44 *
Anna Bridge 180:96ed750bd169 45 * @note by default IRQ handler is set to ticker_irq_handler()
Anna Bridge 180:96ed750bd169 46 * @note this function is primarily for testing purposes and it's not required part of HAL implementation
Anna Bridge 180:96ed750bd169 47 *
Anna Bridge 180:96ed750bd169 48 */
Anna Bridge 180:96ed750bd169 49 ticker_irq_handler_type set_lp_ticker_irq_handler(ticker_irq_handler_type ticker_irq_handler);
Anna Bridge 180:96ed750bd169 50
<> 144:ef7eb2e8f9f7 51 /** Get low power ticker's data
<> 144:ef7eb2e8f9f7 52 *
<> 144:ef7eb2e8f9f7 53 * @return The low power ticker data
<> 144:ef7eb2e8f9f7 54 */
<> 144:ef7eb2e8f9f7 55 const ticker_data_t* get_lp_ticker_data(void);
<> 144:ef7eb2e8f9f7 56
<> 144:ef7eb2e8f9f7 57 /** The wrapper for ticker_irq_handler, to pass lp ticker's data
<> 144:ef7eb2e8f9f7 58 *
<> 144:ef7eb2e8f9f7 59 */
<> 144:ef7eb2e8f9f7 60 void lp_ticker_irq_handler(void);
<> 144:ef7eb2e8f9f7 61
<> 144:ef7eb2e8f9f7 62 /* HAL lp ticker */
<> 144:ef7eb2e8f9f7 63
<> 144:ef7eb2e8f9f7 64 /** Initialize the low power ticker
<> 144:ef7eb2e8f9f7 65 *
<> 144:ef7eb2e8f9f7 66 */
<> 144:ef7eb2e8f9f7 67 void lp_ticker_init(void);
<> 144:ef7eb2e8f9f7 68
<> 144:ef7eb2e8f9f7 69 /** Read the current counter
<> 144:ef7eb2e8f9f7 70 *
<> 144:ef7eb2e8f9f7 71 * @return The current timer's counter value in microseconds
<> 144:ef7eb2e8f9f7 72 */
<> 144:ef7eb2e8f9f7 73 uint32_t lp_ticker_read(void);
<> 144:ef7eb2e8f9f7 74
<> 144:ef7eb2e8f9f7 75 /** Set interrupt for specified timestamp
<> 144:ef7eb2e8f9f7 76 *
<> 144:ef7eb2e8f9f7 77 * @param timestamp The time in microseconds to be set
<> 144:ef7eb2e8f9f7 78 */
<> 144:ef7eb2e8f9f7 79 void lp_ticker_set_interrupt(timestamp_t timestamp);
<> 144:ef7eb2e8f9f7 80
<> 144:ef7eb2e8f9f7 81 /** Disable low power ticker interrupt
<> 144:ef7eb2e8f9f7 82 *
<> 144:ef7eb2e8f9f7 83 */
<> 144:ef7eb2e8f9f7 84 void lp_ticker_disable_interrupt(void);
<> 144:ef7eb2e8f9f7 85
<> 144:ef7eb2e8f9f7 86 /** Clear the low power ticker interrupt
<> 144:ef7eb2e8f9f7 87 *
<> 144:ef7eb2e8f9f7 88 */
<> 144:ef7eb2e8f9f7 89 void lp_ticker_clear_interrupt(void);
<> 144:ef7eb2e8f9f7 90
AnnaBridge 174:b96e65c34a4d 91 /** Set pending interrupt that should be fired right away.
AnnaBridge 174:b96e65c34a4d 92 *
AnnaBridge 174:b96e65c34a4d 93 * The ticker should be initialized prior calling this function.
AnnaBridge 174:b96e65c34a4d 94 */
AnnaBridge 174:b96e65c34a4d 95 void lp_ticker_fire_interrupt(void);
AnnaBridge 174:b96e65c34a4d 96
Anna Bridge 180:96ed750bd169 97 /** Get frequency and counter bits of this ticker.
Anna Bridge 180:96ed750bd169 98 *
Anna Bridge 180:96ed750bd169 99 */
Anna Bridge 180:96ed750bd169 100 const ticker_info_t* lp_ticker_get_info(void);
Anna Bridge 180:96ed750bd169 101
<> 144:ef7eb2e8f9f7 102 /**@}*/
<> 144:ef7eb2e8f9f7 103
<> 144:ef7eb2e8f9f7 104 #ifdef __cplusplus
<> 144:ef7eb2e8f9f7 105 }
<> 144:ef7eb2e8f9f7 106 #endif
<> 144:ef7eb2e8f9f7 107
<> 144:ef7eb2e8f9f7 108 #endif
<> 144:ef7eb2e8f9f7 109
<> 144:ef7eb2e8f9f7 110 #endif
<> 149:156823d33999 111
<> 149:156823d33999 112 /** @}*/