Forked repo of Platform Drivers- Analog Devices
Diff: delay.cpp
- Revision:
- 17:af1f2416dd26
- Child:
- 20:26b1a4570f4b
diff -r 61ad39564f45 -r af1f2416dd26 delay.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/delay.cpp Tue Jul 13 13:58:07 2021 +0530 @@ -0,0 +1,59 @@ +/***************************************************************************//** + * @file delay.cpp + * @brief Implementation of Mbed specific delay functionality +******************************************************************************** + * Copyright (c) 2019 - 2021 Analog Devices, Inc. + * All rights reserved. + * + * This software is proprietary to Analog Devices, Inc. and its licensors. + * By using this software you agree to the terms of the associated + * Analog Devices Software License Agreement. +*******************************************************************************/ + +/******************************************************************************/ +/***************************** Include Files **********************************/ +/******************************************************************************/ + +#include <mbed.h> + +// Platform drivers needs to be C-compatible to work with other drivers +#ifdef __cplusplus +extern "C" +{ +#endif // _cplusplus + +#include "delay.h" + +/******************************************************************************/ +/********************** Macros and Constants Definitions **********************/ +/******************************************************************************/ + +/******************************************************************************/ +/************************ Functions Definitions *******************************/ +/******************************************************************************/ + +/** + * @brief Generate microseconds delay. + * @param usecs - Delay in microseconds. + * @return None. + */ +void udelay(uint32_t usecs) +{ + wait_us(usecs); +} + +/** + * @brief Generate miliseconds delay. + * @param msecs - Delay in miliseconds. + * @return None. + */ +void mdelay(uint32_t msecs) +{ + if (msecs) { + HAL_Delay(msecs); + } +} + +#ifdef __cplusplus // Closing extern c +} +#endif // _cplusplus