Note

This is the documentation for the latest development branch and may refer to features that are not available in released versions. If you are looking for the documentation for a specific release, use the drop-down menu on the left and select the desired version.

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
Comments list
Comments
Log in