mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
mbed_wait_api_no_rtos.c
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 // This implementation of the wait functions will be compiled only 00019 // if the RTOS is not present. 00020 #ifndef MBED_CONF_RTOS_PRESENT 00021 00022 #include "platform/mbed_wait_api.h" 00023 #include "hal/us_ticker_api.h" 00024 00025 void wait(float s) 00026 { 00027 wait_us(s * 1000000.0f); 00028 } 00029 00030 void wait_ms(int ms) 00031 { 00032 wait_us(ms * 1000); 00033 } 00034 00035 void wait_us(int us) 00036 { 00037 const ticker_data_t *const ticker = get_us_ticker_data(); 00038 uint32_t start = ticker_read(ticker); 00039 while ((ticker_read(ticker) - start) < (uint32_t)us); 00040 } 00041 00042 #endif // #ifndef MBED_CONF_RTOS_PRESENT 00043
Generated on Tue Jul 12 2022 20:41:15 by 1.7.2