|
| 1 | +/* mbed Microcontroller Library |
| 2 | + * Copyright (c) 2006-2019 ARM Limited |
| 3 | + * SPDX-License-Identifier: Apache-2.0 |
| 4 | + * |
| 5 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | + * you may not use this file except in compliance with the License. |
| 7 | + * You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | +#ifndef MBED_US_TICKER_DEFINES_H |
| 18 | +#define MBED_US_TICKER_DEFINES_H_ |
| 19 | + |
| 20 | +#include "us_ticker_data.h" |
| 21 | + |
| 22 | +/* All devices have 1MHz us_ticker */ |
| 23 | +#define US_TICKER_PERIOD_NUM 1 |
| 24 | +#define US_TICKER_PERIOD_DEN 1 |
| 25 | + |
| 26 | +#if TIM_MST_BIT_WIDTH == 16 |
| 27 | +#define US_TICKER_MASK 0xFFFF |
| 28 | +#elif TIM_MST_BIT_WIDTH == 32 |
| 29 | +#define US_TICKER_MASK 0xFFFFFFFF |
| 30 | +#else |
| 31 | +#error "Bad TIM_MST_BIT_WIDTH" |
| 32 | +#endif |
| 33 | + |
| 34 | +/* Macro-optimised form of us_ticker_read */ |
| 35 | +#define us_ticker_read() (TIM_MST->CNT) |
| 36 | + |
| 37 | +#endif /* MBED_US_TICKER_DEFINES_H_ */ |
0 commit comments