Change EventFlag timeout paramter

Matches rest of RTOS class timeout parameters by using the unit name. Remove ambigious statement in reference to 0 ms being no-timeout as a timeout of 0 causes the function to not block and return immediately (osWaitForever is used as no timeout as it will wait forever)
pull/9670/head
kegilbert 2019-02-20 17:52:28 -06:00
parent f04d51b2cd
commit f1abca35cf
8 changed files with 21 additions and 21 deletions

View File

@ -62,14 +62,14 @@ uint32_t EventFlags::get() const
return osEventFlagsGet(_id); return osEventFlagsGet(_id);
} }
uint32_t EventFlags::wait_all(uint32_t flags, uint32_t timeout, bool clear) uint32_t EventFlags::wait_all(uint32_t flags, uint32_t millisec, bool clear)
{ {
return wait(flags, osFlagsWaitAll, timeout, clear); return wait(flags, osFlagsWaitAll, millisec, clear);
} }
uint32_t EventFlags::wait_any(uint32_t flags, uint32_t timeout, bool clear) uint32_t EventFlags::wait_any(uint32_t flags, uint32_t millisec, bool clear)
{ {
return wait(flags, osFlagsWaitAny, timeout, clear); return wait(flags, osFlagsWaitAny, millisec, clear);
} }
EventFlags::~EventFlags() EventFlags::~EventFlags()
@ -77,13 +77,13 @@ EventFlags::~EventFlags()
osEventFlagsDelete(_id); osEventFlagsDelete(_id);
} }
uint32_t EventFlags::wait(uint32_t flags, uint32_t opt, uint32_t timeout, bool clear) uint32_t EventFlags::wait(uint32_t flags, uint32_t opt, uint32_t millisec, bool clear)
{ {
if (clear == false) { if (clear == false) {
opt |= osFlagsNoClear; opt |= osFlagsNoClear;
} }
return osEventFlagsWait(_id, flags, opt, timeout); return osEventFlagsWait(_id, flags, opt, millisec);
} }
} }

View File

@ -87,23 +87,23 @@ public:
/** Wait for all of the specified event flags to become signaled. /** Wait for all of the specified event flags to become signaled.
@param flags the flags to wait for (default: 0 -- no flags). @param flags the flags to wait for (default: 0 -- no flags).
@param timeout timeout value or 0 in case of no time-out (default: osWaitForever). @param millisec timeout value (default: osWaitForever).
@param clear clear specified event flags after waiting for them (default: true). @param clear clear specified event flags after waiting for them (default: true).
@return event flags before clearing or error code if highest bit set (see @a osFlagsError for details). @return event flags before clearing or error code if highest bit set (see @a osFlagsError for details).
@note You may call this function from ISR context if the timeout parameter is set to 0. @note You may call this function from ISR context if the millisec parameter is set to 0.
*/ */
uint32_t wait_all(uint32_t flags = 0, uint32_t timeout = osWaitForever, bool clear = true); uint32_t wait_all(uint32_t flags = 0, uint32_t millisec = osWaitForever, bool clear = true);
/** Wait for any of the specified event flags to become signaled. /** Wait for any of the specified event flags to become signaled.
@param flags the flags to wait for (default: 0 -- no flags). @param flags the flags to wait for (default: 0 -- no flags).
@param timeout timeout value or 0 in case of no timeout (default: osWaitForever). @param millisec timeout value (default: osWaitForever).
@param clear clear specified event flags after waiting for them (default: true). @param clear clear specified event flags after waiting for them (default: true).
@return event flags before clearing or error code if highest bit set (see @a osFlagsError for details). @return event flags before clearing or error code if highest bit set (see @a osFlagsError for details).
@note This function may be called from ISR context if the timeout parameter is set to 0. @note This function may be called from ISR context if the millisec parameter is set to 0.
*/ */
uint32_t wait_any(uint32_t flags = 0, uint32_t timeout = osWaitForever, bool clear = true); uint32_t wait_any(uint32_t flags = 0, uint32_t millisec = osWaitForever, bool clear = true);
/** EventFlags destructor. /** EventFlags destructor.
@ -113,7 +113,7 @@ public:
private: private:
void constructor(const char *name = NULL); void constructor(const char *name = NULL);
uint32_t wait(uint32_t flags, uint32_t opt, uint32_t timeout, bool clear); uint32_t wait(uint32_t flags, uint32_t opt, uint32_t millisec, bool clear);
osEventFlagsId_t _id; osEventFlagsId_t _id;
mbed_rtos_storage_event_flags_t _obj_mem; mbed_rtos_storage_event_flags_t _obj_mem;
}; };

View File

@ -131,7 +131,7 @@ public:
/** Get a mail from the queue. /** Get a mail from the queue.
* *
* @param millisec Timeout value or 0 in case of no timeout (default: osWaitForever). * @param millisec Timeout value (default: osWaitForever).
* *
* @return Event that contains mail information or error code. * @return Event that contains mail information or error code.
* @retval osEventMessage Message received. * @retval osEventMessage Message received.

View File

@ -95,7 +95,7 @@ public:
@deprecated Do not use this function. This function has been replaced with lock(), trylock() and trylock_for() functions. @deprecated Do not use this function. This function has been replaced with lock(), trylock() and trylock_for() functions.
@param millisec timeout value or 0 in case of no time-out. @param millisec timeout value.
@return status code that indicates the execution status of the function: @return status code that indicates the execution status of the function:
@a osOK the mutex has been obtained. @a osOK the mutex has been obtained.
@a osErrorTimeout the mutex could not be obtained in the given time. @a osErrorTimeout the mutex could not be obtained in the given time.
@ -117,7 +117,7 @@ public:
bool trylock(); bool trylock();
/** Try to lock the mutex for a specified time /** Try to lock the mutex for a specified time
@param millisec timeout value or 0 in case of no time-out. @param millisec timeout value.
@return true if the mutex was acquired, false otherwise. @return true if the mutex was acquired, false otherwise.
@note the underlying RTOS may have a limit to the maximum wait time @note the underlying RTOS may have a limit to the maximum wait time
due to internal 32-bit computations, but this is guaranteed to work if the due to internal 32-bit computations, but this is guaranteed to work if the

View File

@ -167,7 +167,7 @@ public:
* share the same priority level, they are retrieved in first-in, first-out * share the same priority level, they are retrieved in first-in, first-out
* (FIFO) order. * (FIFO) order.
* *
* @param millisec Timeout value or 0 in case of no time-out. * @param millisec Timeout value.
* (default: osWaitForever). * (default: osWaitForever).
* *
* @return Event information that includes the message in event. Message * @return Event information that includes the message in event. Message

View File

@ -60,7 +60,7 @@ public:
Semaphore(int32_t count, uint16_t max_count); Semaphore(int32_t count, uint16_t max_count);
/** Wait until a Semaphore resource becomes available. /** Wait until a Semaphore resource becomes available.
@param millisec timeout value or 0 in case of no time-out. (default: osWaitForever). @param millisec timeout value. (default: osWaitForever).
@return number of available tokens, before taking one; or -1 in case of incorrect parameters @return number of available tokens, before taking one; or -1 in case of incorrect parameters
@note You may call this function from ISR context if the millisec parameter is set to 0. @note You may call this function from ISR context if the millisec parameter is set to 0.

View File

@ -105,7 +105,7 @@ uint32_t flags_wait_any(uint32_t flags, bool clear = true);
/** Wait for all of the specified Thread Flags to become signaled for the current thread. /** Wait for all of the specified Thread Flags to become signaled for the current thread.
@param flags specifies the flags to wait for @param flags specifies the flags to wait for
@param millisec timeout value or 0 in case of no time-out. @param millisec timeout value.
@param clear whether to clear the specified flags after waiting for them. (default: true) @param clear whether to clear the specified flags after waiting for them. (default: true)
@return actual thread flags before clearing, which may not satisfy the wait @return actual thread flags before clearing, which may not satisfy the wait
@note You cannot call this function from ISR context. @note You cannot call this function from ISR context.
@ -129,7 +129,7 @@ uint32_t flags_wait_all_until(uint32_t flags, uint64_t millisec, bool clear = tr
/** Wait for any of the specified Thread Flags to become signaled for the current thread. /** Wait for any of the specified Thread Flags to become signaled for the current thread.
@param flags specifies the flags to wait for @param flags specifies the flags to wait for
@param millisec timeout value or 0 in case of no time-out. @param millisec timeout value.
@param clear whether to clear the specified flags after waiting for them. (default: true) @param clear whether to clear the specified flags after waiting for them. (default: true)
@return actual thread flags before clearing, which may not satisfy the wait @return actual thread flags before clearing, which may not satisfy the wait
@note You cannot call this function from ISR context. @note You cannot call this function from ISR context.

View File

@ -414,7 +414,7 @@ public:
/** Wait for one or more Thread Flags to become signaled for the current RUNNING thread. /** Wait for one or more Thread Flags to become signaled for the current RUNNING thread.
@param signals wait until all specified signal flags are set or 0 for any single signal flag. @param signals wait until all specified signal flags are set or 0 for any single signal flag.
@param millisec timeout value or 0 in case of no time-out. (default: osWaitForever). @param millisec timeout value. (default: osWaitForever).
@return event flag information or error code. @note if @a millisec is set to 0 and flag is no set the event carries osOK value. @return event flag information or error code. @note if @a millisec is set to 0 and flag is no set the event carries osOK value.
@note You cannot call this function from ISR context. @note You cannot call this function from ISR context.