Update platform drivers
src/delay.cpp
- Committer:
- EndaKilgarriff
- Date:
- 2020-06-15
- Revision:
- 9:9e247b9c9abf
- Parent:
- 8:70fc373a5f46
- Child:
- 10:b5115cd6b916
File content as of revision 9:9e247b9c9abf:
/***************************************************************************//** * @file delay.cpp * @brief Implementation of delay functionality ******************************************************************************** * Copyright (c) 2019, 2020 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> #include "platform_drivers.h" /******************************************************************************/ /********************** Macros and Constants Definitions **********************/ /******************************************************************************/ /******************************************************************************/ /************************ Functions Definitions *******************************/ /******************************************************************************/ /** * @brief Generate microseconds delay. * @param usecs - Delay in microseconds. * @return None. */ void udelay(uint32_t usecs) { if (usecs < 1000) { // Simple delay, minimum time is 1ms. HAL_Delay(1); } else { // This is a simple approach to guarantee a delay usecs /= 1000; usecs++; // Simple 'ceiling' to round up to guarantee minimum delay HAL_Delay(usecs); } } /** * @brief Generate miliseconds delay. * @param msecs - Delay in miliseconds. * @return None. */ void mdelay(uint32_t msecs) { if (msecs) { HAL_Delay(msecs); } }