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) 2006-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_US_TICKER_API_H
borlanic 0:380207fcb5c1 20 #define MBED_US_TICKER_API_H
borlanic 0:380207fcb5c1 21
borlanic 0:380207fcb5c1 22 #include <stdint.h>
borlanic 0:380207fcb5c1 23 #include "hal/ticker_api.h"
borlanic 0:380207fcb5c1 24
borlanic 0:380207fcb5c1 25 #ifdef __cplusplus
borlanic 0:380207fcb5c1 26 extern "C" {
borlanic 0:380207fcb5c1 27 #endif
borlanic 0:380207fcb5c1 28
borlanic 0:380207fcb5c1 29 /**
borlanic 0:380207fcb5c1 30 * \defgroup hal_UsTicker Microseconds Ticker Functions
borlanic 0:380207fcb5c1 31 * @{
borlanic 0:380207fcb5c1 32 */
borlanic 0:380207fcb5c1 33
borlanic 0:380207fcb5c1 34 typedef void (*ticker_irq_handler_type)(const ticker_data_t *const);
borlanic 0:380207fcb5c1 35
borlanic 0:380207fcb5c1 36 /** Set ticker IRQ handler
borlanic 0:380207fcb5c1 37 *
borlanic 0:380207fcb5c1 38 * @param ticker_irq_handler IRQ handler to be connected
borlanic 0:380207fcb5c1 39 *
borlanic 0:380207fcb5c1 40 * @return previous ticker IRQ handler
borlanic 0:380207fcb5c1 41 *
borlanic 0:380207fcb5c1 42 * @note by default IRQ handler is set to ticker_irq_handler()
borlanic 0:380207fcb5c1 43 * @note this function is primarily for testing purposes and it's not required part of HAL implementation
borlanic 0:380207fcb5c1 44 *
borlanic 0:380207fcb5c1 45 */
borlanic 0:380207fcb5c1 46 ticker_irq_handler_type set_us_ticker_irq_handler(ticker_irq_handler_type ticker_irq_handler);
borlanic 0:380207fcb5c1 47
borlanic 0:380207fcb5c1 48 /** Get ticker's data
borlanic 0:380207fcb5c1 49 *
borlanic 0:380207fcb5c1 50 * @return The low power ticker data
borlanic 0:380207fcb5c1 51 */
borlanic 0:380207fcb5c1 52 const ticker_data_t* get_us_ticker_data(void);
borlanic 0:380207fcb5c1 53
borlanic 0:380207fcb5c1 54
borlanic 0:380207fcb5c1 55 /** The wrapper for ticker_irq_handler, to pass us ticker's data
borlanic 0:380207fcb5c1 56 *
borlanic 0:380207fcb5c1 57 */
borlanic 0:380207fcb5c1 58 void us_ticker_irq_handler(void);
borlanic 0:380207fcb5c1 59
borlanic 0:380207fcb5c1 60 /* HAL us ticker */
borlanic 0:380207fcb5c1 61
borlanic 0:380207fcb5c1 62 /** Initialize the ticker
borlanic 0:380207fcb5c1 63 *
borlanic 0:380207fcb5c1 64 */
borlanic 0:380207fcb5c1 65 void us_ticker_init(void);
borlanic 0:380207fcb5c1 66
borlanic 0:380207fcb5c1 67 /** Read the current counter
borlanic 0:380207fcb5c1 68 *
borlanic 0:380207fcb5c1 69 * @return The current timer's counter value in microseconds
borlanic 0:380207fcb5c1 70 */
borlanic 0:380207fcb5c1 71 uint32_t us_ticker_read(void);
borlanic 0:380207fcb5c1 72
borlanic 0:380207fcb5c1 73 /** Set interrupt for specified timestamp
borlanic 0:380207fcb5c1 74 *
borlanic 0:380207fcb5c1 75 * @param timestamp The time in microseconds to be set
borlanic 0:380207fcb5c1 76 */
borlanic 0:380207fcb5c1 77 void us_ticker_set_interrupt(timestamp_t timestamp);
borlanic 0:380207fcb5c1 78
borlanic 0:380207fcb5c1 79 /** Disable us ticker interrupt
borlanic 0:380207fcb5c1 80 *
borlanic 0:380207fcb5c1 81 */
borlanic 0:380207fcb5c1 82 void us_ticker_disable_interrupt(void);
borlanic 0:380207fcb5c1 83
borlanic 0:380207fcb5c1 84 /** Clear us ticker interrupt
borlanic 0:380207fcb5c1 85 *
borlanic 0:380207fcb5c1 86 */
borlanic 0:380207fcb5c1 87 void us_ticker_clear_interrupt(void);
borlanic 0:380207fcb5c1 88
borlanic 0:380207fcb5c1 89 /** Set pending interrupt that should be fired right away.
borlanic 0:380207fcb5c1 90 *
borlanic 0:380207fcb5c1 91 * The ticker should be initialized prior calling this function.
borlanic 0:380207fcb5c1 92 */
borlanic 0:380207fcb5c1 93 void us_ticker_fire_interrupt(void);
borlanic 0:380207fcb5c1 94
borlanic 0:380207fcb5c1 95 /** Get frequency and counter bits of this ticker.
borlanic 0:380207fcb5c1 96 *
borlanic 0:380207fcb5c1 97 */
borlanic 0:380207fcb5c1 98 const ticker_info_t* us_ticker_get_info(void);
borlanic 0:380207fcb5c1 99
borlanic 0:380207fcb5c1 100 /**@}*/
borlanic 0:380207fcb5c1 101
borlanic 0:380207fcb5c1 102 #ifdef __cplusplus
borlanic 0:380207fcb5c1 103 }
borlanic 0:380207fcb5c1 104 #endif
borlanic 0:380207fcb5c1 105
borlanic 0:380207fcb5c1 106 #endif
borlanic 0:380207fcb5c1 107
borlanic 0:380207fcb5c1 108 /** @}*/