The code from https://github.com/vpcola/Nucleo

Committer:
sinrab
Date:
Wed Oct 08 11:00:24 2014 +0000
Revision:
0:5464d5e415e5
The code from https://github.com/vpcola/Nucleo

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sinrab 0:5464d5e415e5 1 /* mbed Microcontroller Library
sinrab 0:5464d5e415e5 2 * Copyright (c) 2006-2013 ARM Limited
sinrab 0:5464d5e415e5 3 *
sinrab 0:5464d5e415e5 4 * Licensed under the Apache License, Version 2.0 (the "License");
sinrab 0:5464d5e415e5 5 * you may not use this file except in compliance with the License.
sinrab 0:5464d5e415e5 6 * You may obtain a copy of the License at
sinrab 0:5464d5e415e5 7 *
sinrab 0:5464d5e415e5 8 * http://www.apache.org/licenses/LICENSE-2.0
sinrab 0:5464d5e415e5 9 *
sinrab 0:5464d5e415e5 10 * Unless required by applicable law or agreed to in writing, software
sinrab 0:5464d5e415e5 11 * distributed under the License is distributed on an "AS IS" BASIS,
sinrab 0:5464d5e415e5 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
sinrab 0:5464d5e415e5 13 * See the License for the specific language governing permissions and
sinrab 0:5464d5e415e5 14 * limitations under the License.
sinrab 0:5464d5e415e5 15 */
sinrab 0:5464d5e415e5 16 #include "wait_api.h"
sinrab 0:5464d5e415e5 17 #include "us_ticker_api.h"
sinrab 0:5464d5e415e5 18
sinrab 0:5464d5e415e5 19 void wait(float s) {
sinrab 0:5464d5e415e5 20 wait_us(s * 1000000.0f);
sinrab 0:5464d5e415e5 21 }
sinrab 0:5464d5e415e5 22
sinrab 0:5464d5e415e5 23 void wait_ms(int ms) {
sinrab 0:5464d5e415e5 24 wait_us(ms * 1000);
sinrab 0:5464d5e415e5 25 }
sinrab 0:5464d5e415e5 26
sinrab 0:5464d5e415e5 27 void wait_us(int us) {
sinrab 0:5464d5e415e5 28 uint32_t start = us_ticker_read();
sinrab 0:5464d5e415e5 29 while ((us_ticker_read() - start) < (uint32_t)us);
sinrab 0:5464d5e415e5 30 }
sinrab 0:5464d5e415e5 31