Yihui Xiong
/
Seeed_nRF51822_Motion
initial
mbed-src/common/us_ticker_api.c@0:638edba3adf6, 2016-01-11 (annotated)
- Committer:
- yihui
- Date:
- Mon Jan 11 02:32:24 2016 +0000
- Revision:
- 0:638edba3adf6
initial
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yihui | 0:638edba3adf6 | 1 | /* mbed Microcontroller Library |
yihui | 0:638edba3adf6 | 2 | * Copyright (c) 2015 ARM Limited |
yihui | 0:638edba3adf6 | 3 | * |
yihui | 0:638edba3adf6 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
yihui | 0:638edba3adf6 | 5 | * you may not use this file except in compliance with the License. |
yihui | 0:638edba3adf6 | 6 | * You may obtain a copy of the License at |
yihui | 0:638edba3adf6 | 7 | * |
yihui | 0:638edba3adf6 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
yihui | 0:638edba3adf6 | 9 | * |
yihui | 0:638edba3adf6 | 10 | * Unless required by applicable law or agreed to in writing, software |
yihui | 0:638edba3adf6 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
yihui | 0:638edba3adf6 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
yihui | 0:638edba3adf6 | 13 | * See the License for the specific language governing permissions and |
yihui | 0:638edba3adf6 | 14 | * limitations under the License. |
yihui | 0:638edba3adf6 | 15 | */ |
yihui | 0:638edba3adf6 | 16 | #include "us_ticker_api.h" |
yihui | 0:638edba3adf6 | 17 | |
yihui | 0:638edba3adf6 | 18 | static ticker_event_queue_t events; |
yihui | 0:638edba3adf6 | 19 | |
yihui | 0:638edba3adf6 | 20 | static const ticker_interface_t us_interface = { |
yihui | 0:638edba3adf6 | 21 | .init = us_ticker_init, |
yihui | 0:638edba3adf6 | 22 | .read = us_ticker_read, |
yihui | 0:638edba3adf6 | 23 | .disable_interrupt = us_ticker_disable_interrupt, |
yihui | 0:638edba3adf6 | 24 | .clear_interrupt = us_ticker_clear_interrupt, |
yihui | 0:638edba3adf6 | 25 | .set_interrupt = us_ticker_set_interrupt, |
yihui | 0:638edba3adf6 | 26 | }; |
yihui | 0:638edba3adf6 | 27 | |
yihui | 0:638edba3adf6 | 28 | static const ticker_data_t us_data = { |
yihui | 0:638edba3adf6 | 29 | .interface = &us_interface, |
yihui | 0:638edba3adf6 | 30 | .queue = &events, |
yihui | 0:638edba3adf6 | 31 | }; |
yihui | 0:638edba3adf6 | 32 | |
yihui | 0:638edba3adf6 | 33 | const ticker_data_t* get_us_ticker_data(void) |
yihui | 0:638edba3adf6 | 34 | { |
yihui | 0:638edba3adf6 | 35 | return &us_data; |
yihui | 0:638edba3adf6 | 36 | } |
yihui | 0:638edba3adf6 | 37 | |
yihui | 0:638edba3adf6 | 38 | void us_ticker_irq_handler(void) |
yihui | 0:638edba3adf6 | 39 | { |
yihui | 0:638edba3adf6 | 40 | ticker_irq_handler(&us_data); |
yihui | 0:638edba3adf6 | 41 | } |