YAHAL
Yet Another Hardware Abstraction Library
Loading...
Searching...
No Matches
src
MCU
esp8266
timer_esp8266.h
1
// ---------------------------------------------
2
// This file is part of
3
// _ _ __ _ _ __ __
4
// ( \/ ) /__\ ( )_( ) /__\ ( )
5
// \ / /(__)\ ) _ ( /(__)\ )(__
6
// (__)(__)(__)(_) (_)(__)(__)(____)
7
//
8
// Yet Another HW Abstraction Library
9
// Copyright (C) Andreas Terstegge
10
// BSD Licensed (see file LICENSE)
11
//
12
// ---------------------------------------------
13
//
14
// Timer implementation for ESP8266.
15
//
16
#ifndef _TIMER_ESP8266_H_
17
#define _TIMER_ESP8266_H_
18
19
#include "timer_interface.h"
20
21
class
timer_esp8266
:
public
timer_interface
{
22
public
:
23
timer_esp8266
();
24
~timer_esp8266
()
override
;
25
26
void
setPeriod(uint32_t us, TIMER::timer_mode mode)
override
;
27
uint32_t getPeriod()
override
;
28
29
void
setCallback(function<
void
()> f)
override
;
30
31
void
start()
override
;
32
void
stop()
override
;
33
bool
isRunning()
override
;
34
35
uint32_t getCounter();
36
void
resetCounter();
37
38
friend
void
timer_irq_handler(
timer_esp8266
*);
39
40
private
:
41
function<void()> _handler;
42
uint32_t _period_us;
// load value in us
43
uint32_t _period_load;
44
uint32_t _divider;
45
};
46
47
void
timer_irq_handler(
timer_esp8266
*);
48
49
#endif
// _TIMER_ESP8266_H_
timer_esp8266
Definition
timer_esp8266.h:21
timer_interface
Definition
timer_interface.h:35
Generated by
1.12.0