2020-09-23 10:00:39 +00:00
|
|
|
/***************************************************************************
|
2023-02-08 15:33:02 +00:00
|
|
|
* Copyright (C) 2020 - 2023 by Silvano Seva IU2KWO *
|
2022-06-02 07:56:05 +00:00
|
|
|
* and Niccolò Izzo IU2KIN *
|
2020-09-23 10:00:39 +00:00
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/> *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef DELAYS_H
|
|
|
|
#define DELAYS_H
|
|
|
|
|
2021-03-10 11:13:38 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2020-09-23 10:00:39 +00:00
|
|
|
/**
|
|
|
|
* Function prototypes for microsecond and millisecond delays.
|
|
|
|
* Their implementation is device-specific, thus it is placed inside the drivers
|
|
|
|
* folder.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Exact microsecond delay.
|
|
|
|
* @param useconds: delay value
|
|
|
|
*/
|
|
|
|
void delayUs(unsigned int useconds);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Exact millisecond delay.
|
|
|
|
* @param mseconds: delay value
|
|
|
|
*/
|
|
|
|
void delayMs(unsigned int mseconds);
|
|
|
|
|
2021-03-10 14:17:22 +00:00
|
|
|
/**
|
|
|
|
* Puts the calling thread in a sleeping state for the specified amount of time.
|
|
|
|
* @param seconds: sleep time, seconds.
|
|
|
|
* @param mseconds: sleep time, milliseconds.
|
|
|
|
*/
|
|
|
|
void sleepFor(unsigned int seconds, unsigned int mseconds);
|
|
|
|
|
2022-06-29 15:51:06 +00:00
|
|
|
/**
|
|
|
|
* Puts the calling thread in a sleeping state until the system time reaches
|
|
|
|
* the target value passed as parameter.
|
|
|
|
* @param timestamp: traget timestamp for the wakeup.
|
|
|
|
*/
|
|
|
|
void sleepUntil(long long timestamp);
|
|
|
|
|
2021-03-10 14:17:22 +00:00
|
|
|
/**
|
|
|
|
* Get the current value of the system tick.
|
|
|
|
* @return current system tick value.
|
|
|
|
*/
|
|
|
|
long long getTick();
|
|
|
|
|
2021-03-10 11:13:38 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2020-09-23 10:00:39 +00:00
|
|
|
#endif /* DELAYS_H */
|