KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
oneshot_timer_t Struct Reference

Opaque structure describing one one-shot timer. More...

#include <oneshot_timer.h>

Related Symbols

(Note that these are not member symbols.)

oneshot_timer_toneshot_timer_create (void(*cb)(void *), void *data, unsigned int timeout_ms)
 Create a new one-shot timer.
 
void oneshot_timer_destroy (oneshot_timer_t *timer)
 Stop and destroy a one-shot timer.
 
void oneshot_timer_setup (oneshot_timer_t *timer, void(*cb)(void *), void *data, unsigned int timeout_ms)
 Re-configure a one-shot timer.
 
void oneshot_timer_start (oneshot_timer_t *timer)
 Start a one-shot timer.
 
void oneshot_timer_stop (oneshot_timer_t *timer)
 Stop a one-shot timer.
 
static void oneshot_timer_reset (oneshot_timer_t *timer)
 Reset a one-shot timer.
 

Detailed Description

Opaque structure describing one one-shot timer.

Friends And Related Symbol Documentation

◆ oneshot_timer_create()

oneshot_timer_t * oneshot_timer_create ( void(* cb )(void *),
void * data,
unsigned int timeout_ms )
related

Create a new one-shot timer.

This function will create a one-shot timer using the specified callback, programmed to expire after the given timeout. The timer will be stopped by default and still need to be started using oneshot_timer_start().

Parameters
cbThe function to call in case the one-shot timer expires.
dataA parameter to pass to the function called.
timeout_msThe timeout value for the one-shot timer, in milliseconds.
Returns
The new one-shot timer on success, NULL on failure.
See also
oneshot_timer_destroy, oneshot_timer_start

◆ oneshot_timer_destroy()

void oneshot_timer_destroy ( oneshot_timer_t * timer)
related

Stop and destroy a one-shot timer.

This function will stop the one-shot timer and free its memory.

Parameters
timerA pointer to the one-shot timer.
See also
oneshot_timer_create

◆ oneshot_timer_reset()

static void oneshot_timer_reset ( oneshot_timer_t * timer)
related

Reset a one-shot timer.

A convenience function to reset the one-shot timer by stopping it then starting it again.

Parameters
timerA pointer to the one-shot timer.
See also
oneshot_timer_start, oneshot_timer_stop

References oneshot_timer_start(), and oneshot_timer_stop().

◆ oneshot_timer_setup()

void oneshot_timer_setup ( oneshot_timer_t * timer,
void(* cb )(void *),
void * data,
unsigned int timeout_ms )
related

Re-configure a one-shot timer.

This function can be used to change the registered callback or the timeout. Using it on a running timer is unsupported.

Parameters
timerA pointer to the one-shot timer.
cbThe function to call in case the one-shot timer expires.
dataA parameter to pass to the function called.
timeout_msThe timeout value for the one-shot timer, in milliseconds.
See also
oneshot_timer_stop, oneshot_timer_start

◆ oneshot_timer_start()

void oneshot_timer_start ( oneshot_timer_t * timer)
related

Start a one-shot timer.

This function will start the one-shot timer. If not stopped until the timeout value expires, the one-shot timer will call the registered callback function.

Parameters
timerA pointer to the one-shot timer.
See also
oneshot_timer_stop, oneshot_timer_reset

◆ oneshot_timer_stop()

void oneshot_timer_stop ( oneshot_timer_t * timer)
related

Stop a one-shot timer.

This function will stop the one-shot timer. If it already expired, this function does nothing. If it did not expire yet, the one-shot timer is stopped and the registered callback won't be called.

Parameters
timerA pointer to the one-shot timer.
See also
oneshot_timer_start, oneshot_timer_reset

The documentation for this struct was generated from the following file: