Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
cs_Timer.h
Go to the documentation of this file.
1/*
2 * Author: Crownstone Team
3 * Copyrights: Distributed Organism B.V. (DoBots, http://dobots.nl)
4 * Date: 21 Apr., 2015
5 * License: LGPLv3+, Apache License 2.0, and/or MIT (triple-licensed)
6 */
7#pragma once
8
9#include <ble/cs_Nordic.h>
10#include <cfg/cs_Config.h>
11
12extern "C" {
13#include <components/libraries/scheduler/app_scheduler.h>
14#include <components/libraries/timer/app_timer.h>
15}
16
17#define HZ_TO_TICKS(hz) APP_TIMER_TICKS(1000 / hz)
18#define MS_TO_TICKS(ms) APP_TIMER_TICKS(ms)
19
22class Timer {
23public:
24 static Timer& getInstance();
25
26 void init();
27
35 void createSingleShot(app_timer_id_t& timer_handle, app_timer_timeout_handler_t func);
36
42 void start(app_timer_id_t& timer_handle, uint32_t ticks, void* obj);
43
47 void stop(app_timer_id_t& timer_handle);
48
54 void reset(app_timer_id_t& timer_handle, uint32_t ticks, void* obj);
55
56private:
57 Timer(){};
58
59 Timer(Timer const&);
60 void operator=(Timer const&);
61};
Timer on top of the timer peripheral.
Definition: cs_Timer.h:22
void init()
void reset(app_timer_id_t &timer_handle, uint32_t ticks, void *obj)
Resets a timer (if already active) to the new ticks @timer_handle Reference to previously created tim...
void stop(app_timer_id_t &timer_handle)
Stop a timer @timer_handle Reference to previously created timer.
void createSingleShot(app_timer_id_t &timer_handle, app_timer_timeout_handler_t func)
Create single shot timer.
void start(app_timer_id_t &timer_handle, uint32_t ticks, void *obj)
Start a previously created timer @timer_handle Reference to previously created timer @ticks Number of...
Timer()
Definition: cs_Timer.h:57
static Timer & getInstance()
void operator=(Timer const &)
Timer(Timer const &)
Definition: function.h:63