1 /* mbed Microcontroller Library
2 * Copyright (c) 2006-2013 ARM Limited
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef MBED_US_TICKER_API_H
17 #define MBED_US_TICKER_API_H
25 typedef uint32_t timestamp_t;
27 uint32_t us_ticker_read(void);
29 typedef void (*ticker_event_handler)(uint32_t id);
30 void us_ticker_set_handler(ticker_event_handler handler);
32 typedef struct ticker_event_s {
33 timestamp_t timestamp;
35 struct ticker_event_s *next;
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);
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);