-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
43 lines (37 loc) · 1.17 KB
/
main.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
#pragma once
#include <stdio.h>
#include "driverlib/driverlib.h"
#include "hal_LCD.h"
#include "uart.h"
#include "mytimer.h"
#include "distance.h"
#include "util.h"
#include "constants.h"
#pragma once
#define TIMER_A_PERIOD 1000 //T = 1/f = (TIMER_A_PERIOD * 1 us)
#define HIGH_COUNT 500 //Number of cycles signal is high (Duty Cycle = HIGH_COUNT / TIMER_A_PERIOD)
//Output pin to buzzer
#define PWM_PORT GPIO_PORT_P1
#define PWM_PIN GPIO_PIN7
//LaunchPad LED1 - note unavailable if UART is used
#define LED1_PORT GPIO_PORT_P1
#define LED1_PIN GPIO_PIN0
//LaunchPad LED2
#define LED2_PORT GPIO_PORT_P4
#define LED2_PIN GPIO_PIN0
//LaunchPad Pushbutton Switch 1
#define SW1_PORT GPIO_PORT_P1
#define SW1_PIN GPIO_PIN2
//LaunchPad Pushbutton Switch 2
#define SW2_PORT GPIO_PORT_P2
#define SW2_PIN GPIO_PIN6
//Input to ADC - in this case input A9 maps to pin P8.1
#define ADC_IN_PORT GPIO_PORT_P8
#define ADC_IN_PIN GPIO_PIN1
#define ADC_IN_CHANNEL ADC_INPUT_A9
void Init_GPIO(void);
void Init_Clock(void);
void Init_UART(void);
void Init_PWM(void);
void Init_ADC(void);
Timer_A_outputPWMParam param; //Timer configuration data structure for PWM