


Make sure that your projects sdk_config.h includes the configuration block for the application timer: This configuration is the default configuration in SDK 15.2, which is recommended in this tutorial. Then include the required header files by adding the following lines below the existing include statements: You might also need to add the following includes if you are using this as a guide to add the application timer in your own application (unless already present): /components/libraries/util/app_util_platform.cĪdd the following directory to the include paths (the path is relative to project file):./integration/nrfx/legacy/nrf_drv_clock.c.You might also need to add the following files if you are using this as a guide to add the application timer in your own application (unless allready present): /components/libraries/timer/app_timer.c.The application timer implementation file must be added to the project in order to use the application timer: Refer to the Application Timer API Reference as needed. These can be called repeatedly at a configurable interval or once at a configurable time from now. In this part of the tutorial you will configure the library, and use it to create timers that call your timeout event handlers. The frequency of the RTC can be lowered by using the 12 bit (1/x) prescaler. As the clock is 32.768 kHz and the RTC is 24 bit, the time/tick resolution is limited, but it takes a substantial amount of time before the counter wrap around (from 0xFFFFFF to 0). Therefore there is normally very little extra power consumption associated with using the application timer. When using a SoftDevice the LFCLK is always active. Most applications keep the LFCLK active at all times. The RTC uses the Low Frequency Clock (LFCLK). The Application Timer library provides a user-friendly way of using the Real Time Counter 1 (RTC1) peripheral to create multiple timer instances. You should be able to control LED 1 with button 1 and 2, and control LED 2 using button 3 and 4. Program/download the application to the target board. The application should build without any warnings or errors.Įrase the flash of the DK using nRF Connect Programmer or nrfjprog in order to ensure that no SoftDevice is installed. Open the project that suits your target device and prefered toolchain. The example project configures GPIO inputs and outputs for the buttons and LEDs that will be used in the tutorial.
Work timer app download#
To get started, download and extract the SDK and clone the example project under /examples/peripheral/: pca10040e for the nRF52 DK emulating nRF52810.Within the tutorial project folder there are subfolders for different boards: Example project: nrf5-application-timer-tutorial. (The completed branch shows the expected result after going through this tutorial).Segger Embedded Studio (SES) or any other supported toolchain, used to build and program the example.Please refer to the Pin Change Interrupt Example if you need to refresh this topic.

It is also expected that you are familiar with the concept of interrupts and event handlers. Refer to Getting Started in the SDK documentation if this is unfamiliar territory.
Work timer app how to#
It is expected that you have basic knowledge of how to use Keil or Segger Embedded Studio in order to build and download your application to your kit. The tutorial will not cover all aspects of the application timer but will focus on the most important uses and API functions.
