YAHAL
Yet Another Hardware Abstraction Library
Loading...
Searching...
No Matches
timerA_msp432.h
1/*
2 *
3 * Created on: 21.07.2021
4 * Author: aterstegge
5 */
6
7#ifndef _TIMER_A_MSP432_H_
8#define _TIMER_A_MSP432_H_
9#include "timer_interface.h"
10#include "msp.h"
11
12extern "C" {
13void TA0_0_IRQHandler (void);
14void TA1_0_IRQHandler (void);
15void TA2_0_IRQHandler (void);
16void TA3_0_IRQHandler (void);
17}
18
20 public:
21 timerA_msp432(Timer_A_Type * timer = TIMER_A0);
22 virtual ~timerA_msp432();
23
24 void setPeriod(uint32_t us, TIMER::timer_mode mode = TIMER::ONE_SHOT);
25 uint32_t getPeriod();
26
27 void setCallback(function<void()> f);
28
29 void start();
30 void stop();
31 bool isRunning();
32
33 void reset();
34
35 // IRQ handlers are our best friends
36 friend void TA0_0_IRQHandler (void);
37 friend void TA1_0_IRQHandler (void);
38 friend void TA2_0_IRQHandler (void);
39 friend void TA3_0_IRQHandler (void);
40
41 private:
42
43 static function<void()> _intHandler0;
44 static function<void()> _intHandler1;
45 static function<void()> _intHandler2;
46 static function<void()> _intHandler3;
47
48 Timer_A_Type * _timer;
49 TIMER::timer_mode _mode;
50
51 uint32_t _period_us ; // period in us
52 uint32_t _ccr0;
53 uint32_t _divider;
54};
55
56#endif // _TIMER_A_MSP432_H_