Erste version der Software für der Prototyp

Committer:
borlanic
Date:
Fri Mar 30 14:07:05 2018 +0000
Revision:
4:75df35ef4fb6
Parent:
0:380207fcb5c1
commentar

Who changed what in which revision?

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