-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.c
67 lines (48 loc) · 1.13 KB
/
setup.c
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
61
62
63
64
65
66
67
/*
* setup.c
*
* Created on: May 3, 2015
* Author: Tahmid
*/
#include "setup.h"
const unsigned long SMCLK_FREQ = 16000000;
void setup_lcd_fs(void){
_disable_interrupts();
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
BCSCTL1 = CALBC1_16MHZ; /* Set DCO for 16 MHz */
DCOCTL = CALDCO_16MHZ;
delay_ms(100);
// Initialize SD card:
spi_initialize();
dres = disk_initialize();
tft_init_hw();
tft_begin();
tft_fillScreen(ILI9340_WHITE);
tft_setCursor(0, 1);
tft_setTextColor(ILI9340_BLACK);
tft_setTextSize(1);
if (dres){
sprintf(buffer, "Disk error = %d\n", (int) dres);
tft_writeString(buffer);
while (1);
}
pres = pf_mount(&fs);
if (pres){
sprintf(buffer, "PFF error 1 = %d\n", (int) pres);
tft_writeString(buffer);
while (1);
}
tft_fillScreen(ILI9340_WHITE);
P1DIR |= BIT0 | BIT1;
P1OUT &= ~ (BIT0 | BIT1);
}
void setup_timer_buttons(void){
init_button();
init_systimer();
initButtons();
_enable_interrupts();
}
void init_touch_adc(void){
ADC10CTL1 = ADC10DIV_7 | ADC10SSEL_3;
ADC10CTL0 = ADC10SHT_3 | ADC10ON; // setup adc
}