]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/hal/us_ticker_api.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / hal / us_ticker_api.h
1 /* mbed Microcontroller Library
2  * Copyright (c) 2006-2013 ARM Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef MBED_US_TICKER_API_H
17 #define MBED_US_TICKER_API_H
18
19 #include <stdint.h>
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 typedef uint32_t timestamp_t;
26
27 uint32_t us_ticker_read(void);
28
29 typedef void (*ticker_event_handler)(uint32_t id);
30 void us_ticker_set_handler(ticker_event_handler handler);
31
32 typedef struct ticker_event_s {
33     timestamp_t            timestamp;
34     uint32_t               id;
35     struct ticker_event_s *next;
36 } ticker_event_t;
37
38 void us_ticker_init(void);
39 void us_ticker_set_interrupt(timestamp_t timestamp);
40 void us_ticker_disable_interrupt(void);
41 void us_ticker_clear_interrupt(void);
42 void us_ticker_irq_handler(void);
43
44 void us_ticker_insert_event(ticker_event_t *obj, timestamp_t timestamp, uint32_t id);
45 void us_ticker_remove_event(ticker_event_t *obj);
46 int us_ticker_get_next_timestamp(timestamp_t *timestamp);
47
48 #ifdef __cplusplus
49 }
50 #endif
51
52 #endif