Function riot_sys::timer_init

source ·
pub unsafe extern "C" fn timer_init(
    dev: tim_t,
    freq: u32,
    cb: timer_cb_t,
    arg: *mut c_void
) -> c_int
Expand description

@brief Initialize the given timer

Each timer device is running with the given speed. Each can contain one or more channels as defined in periph_conf.h. The timer is configured in up-counting mode and will count until TIMER_x_MAX_VALUE as defined in used board’s periph_conf.h until overflowing.

The timer will be started automatically after initialization with interrupts enabled.

@param[in] dev the timer to initialize @param[in] freq requested number of ticks per second @param[in] cb this callback is called in interrupt context, the emitting channel is passed as argument @param[in] arg argument to the callback

@return 0 on success @return -1 if speed not applicable or unknown device given