-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
53 lines (38 loc) · 1.08 KB
/
main.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
/*
* File: main.c
* Author: Pierre
*
* Created on March 18, 2014, 2:01 PM
*/
#include "main.h"
#include "config.h"
int error=1;
int main(void) {
ADPCFG = 0xFFFF; //make ADC pins all digital
setupOsc();
setupUART(57600);
printf("\n------------------------------------------------------------------------------------\n************************ dsPIC Quadcopter Controller ************************\n------------------------------------------------------------------------------------");
setupI2C(400000);
MPU9150TestI2C();
do{
setupIMU();
error=MPU9150CheckRegisters();
}while(error!=0);
setupPWM();
setupLeds();
setLedsHigh();
setupTimer1(); //Main timer
setupTimer2(); //Input capture timer
setupTimer3(); //PWM timer
calibrateGyros();
calibrateAccel();
calibrateMag();
setupPID();
setupIC();
setupTimer4(); //RX timeout timer
calibrateESCEndpoints();
IEC0bits.T1IE = 1;
while(1){
}
return (EXIT_SUCCESS);
}