Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: target-freescale
Fork of mbed-hal by
common/wait_api.c@20:fbc6173aa5b2, 2016-04-06 (annotated)
- Committer:
- Christopher Haster
- Date:
- Wed Apr 06 09:41:33 2016 -0500
- Revision:
- 20:fbc6173aa5b2
- Parent:
- 0:9c59db1fbc9e
Added Binder class for statically allocated function binding
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| screamer | 0:9c59db1fbc9e | 1 | /* mbed Microcontroller Library |
| screamer | 0:9c59db1fbc9e | 2 | * Copyright (c) 2006-2013 ARM Limited |
| screamer | 0:9c59db1fbc9e | 3 | * |
| screamer | 0:9c59db1fbc9e | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| screamer | 0:9c59db1fbc9e | 5 | * you may not use this file except in compliance with the License. |
| screamer | 0:9c59db1fbc9e | 6 | * You may obtain a copy of the License at |
| screamer | 0:9c59db1fbc9e | 7 | * |
| screamer | 0:9c59db1fbc9e | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| screamer | 0:9c59db1fbc9e | 9 | * |
| screamer | 0:9c59db1fbc9e | 10 | * Unless required by applicable law or agreed to in writing, software |
| screamer | 0:9c59db1fbc9e | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| screamer | 0:9c59db1fbc9e | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| screamer | 0:9c59db1fbc9e | 13 | * See the License for the specific language governing permissions and |
| screamer | 0:9c59db1fbc9e | 14 | * limitations under the License. |
| screamer | 0:9c59db1fbc9e | 15 | */ |
| screamer | 0:9c59db1fbc9e | 16 | #include "wait_api.h" |
| screamer | 0:9c59db1fbc9e | 17 | #include "us_ticker_api.h" |
| screamer | 0:9c59db1fbc9e | 18 | |
| screamer | 0:9c59db1fbc9e | 19 | void wait(float s) { |
| screamer | 0:9c59db1fbc9e | 20 | wait_us(s * 1000000.0f); |
| screamer | 0:9c59db1fbc9e | 21 | } |
| screamer | 0:9c59db1fbc9e | 22 | |
| screamer | 0:9c59db1fbc9e | 23 | void wait_ms(int ms) { |
| screamer | 0:9c59db1fbc9e | 24 | wait_us(ms * 1000); |
| screamer | 0:9c59db1fbc9e | 25 | } |
| screamer | 0:9c59db1fbc9e | 26 | |
| screamer | 0:9c59db1fbc9e | 27 | void wait_us(int us) { |
| screamer | 0:9c59db1fbc9e | 28 | uint32_t start = us_ticker_read(); |
| screamer | 0:9c59db1fbc9e | 29 | while ((us_ticker_read() - start) < (uint32_t)us); |
| screamer | 0:9c59db1fbc9e | 30 | } |
| screamer | 0:9c59db1fbc9e | 31 |
