Timer Example#
Overview#
This sample tests both hardware timers and software timers.
Source file:
src/rtsmart/examples/peripheral/timer/test_timer.c
Sample Behavior#
create and destroy timers
configure mode and period
register callbacks
start and stop timers
clean up resources
Key APIs#
drv_hard_timer_inst_create()/drv_hard_timer_inst_destroy()drv_hard_timer_set_mode()/drv_hard_timer_set_freq()/drv_hard_timer_set_period()drv_hard_timer_register_irq()/drv_hard_timer_start()/drv_hard_timer_stop()drv_soft_timer_create()/drv_soft_timer_destroy()drv_soft_timer_set_mode()/drv_soft_timer_set_period()drv_soft_timer_register_irq()/drv_soft_timer_start()/drv_soft_timer_stop()
Build and Run#
cd src/rtsmart/examples/peripheral/timer
make
./test_timer
