-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfreqDelay.h
More file actions
46 lines (38 loc) · 1.21 KB
/
freqDelay.h
File metadata and controls
46 lines (38 loc) · 1.21 KB
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
/*
* freqDelay.h
*
* Created on: April 13, 2017
* Authors: Michael Le & Justin L'Heuruex
* Project: 01
* Class: CPE 329 - Section 01
* Quarter: Spring 2017
*
* At the highest supported frequency of 24 MHz,
* the shortest pulse generated is 1.25 us.
*/
#ifndef FREQDELAY_H
#define FREQDELAY_H
/* Supported frequencies of the MSP432R */
#define FREQ_1_5_MHz 1500000
#define FREQ_3_MHz 3000000
#define FREQ_6_MHz 6000000
#define FREQ_12_MHz 12000000
#define FREQ_24_MHz 24000000
#define FREQ_48_MHz 48000000
/* Conversion constants from integer to float */
#define MS 0.001
#define NS 0.000000001
/* Delay functions and their helper functions */
void delay_ms(int num_ms, int sys_freq);
void delay_ns(int num_ns, int sys_freq);
static void delayMs(int n);
static void delayNs(int n);
/* Set system clock */
void set_DCO(int sys_freq);
static void set_CLK_freq(int sys_freq);
static void set_48_MHz();
/* Time check functions */
static int is_proper_time_ms(int time_ms, int sys_freq);
static int is_proper_time_ns(int time_ns, int sys_freq);
static int isEqual(double a, double b, double precision);
#endif /* FREQDELAY_H_ */