-
Notifications
You must be signed in to change notification settings - Fork 0
/
Timing.h
60 lines (49 loc) · 953 Bytes
/
Timing.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* Timing.h
*
* Created on: Mar 1, 2023
* Author: dylan
*
* Delay and millis()!
*/
#ifndef TIMING_H_
#define TIMING_H_
#include <msp430.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/*****
* API
*****/
/**
* Typedef to make it more explicit when we're dealing with milliseconds
*/
typedef uint16_t millis_t;
/*
* Halt program execution for `ms` milliseconds.
* This method is not safe to use in an ISR or while
* interrupts are disabled!
*/
void delay(millis_t ms);
/**
* Initialize ACLK, setting it up to use the 32 kHz crystal.
*/
void aclk_init();
/**
* Initialize SMCLK to be 16 MHz.
*/
void smclk_init();
/**
* Intialize the timer and counters required for millis() and delay()
* to function properly.
*/
void delay_init();
/**
* Get a monotonic counter that increments about once every millisecond.
*/
millis_t millis();
#ifdef __cplusplus
}
#endif
#endif /* TARGETCONFIGS_TIMER_HPP_ */