-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.c
115 lines (94 loc) · 2.02 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
* Main.c
*
* Created on: 12-02-2016
* Author: Mateusz
*/
#include <DAVE3.h> //Declarations from DAVE3 Code Generation (includes SFR declaration)
#include "BluetoothDriver.h"
#include "timerFunctions.h"
#include "LSM9DS1_Driver.h"
#include <string.h>
#include "SendMeasurementsToBt.h"
#include "TSL2561.h"
void timerHandlerSendMessage(void *T);
extern char device[20];
/*void FIFO_Receive_Int_Handler(void)
{
int kurde = 0;
uint16_t DataReceive1 = 0;
I2C001_ReadData(&I2C001_Handle0,&DataReceive1);
}*/
void check(void)
{
if(I2C001_SET == I2C001_GetFlagStatus(&I2C001_Handle0,I2C001_FLAG_RSIF))
{
;
}
else if(I2C001_SET == I2C001_GetFlagStatus(&I2C001_Handle0,I2C001_FLAG_DLIF))
{
;
}
else if(I2C001_SET == I2C001_GetFlagStatus(&I2C001_Handle0,I2C001_FLAG_TSIF))
{
;
}
else if(I2C001_SET == I2C001_GetFlagStatus(&I2C001_Handle0,I2C001_FLAG_TBIF))
{
;
}
else if(I2C001_SET == I2C001_GetFlagStatus(&I2C001_Handle0,I2C001_FLAG_RIF))
{
;
}
else if(I2C001_SET == I2C001_GetFlagStatus(&I2C001_Handle0,I2C001_FLAG_WRONG_TDF))
{
;
}
else if(I2C001_SET == I2C001_GetFlagStatus(&I2C001_Handle0,I2C001_FLAG_NACK_RECEIVED))
{
;
}
else if(I2C001_SET == I2C001_GetFlagStatus(&I2C001_Handle0,I2C001_FLAG_SRBI))
{
int a;
}
else if(I2C001_SET == I2C001_GetFlagStatus(&I2C001_Handle0,I2C001_FLAG_RBERI))
{
int b;
}
else if(I2C001_SET == I2C001_GetFlagStatus(&I2C001_Handle0,I2C001_FLAG_STBI))
{
int c;
}
else if(I2C001_SET == I2C001_GetFlagStatus(&I2C001_Handle0,I2C001_FLAG_TBERI))
{
int d;
}
}
int gain;
unsigned char time;
unsigned int ms;
int main(void)
{
// status_t status; // Declaration of return variable for DAVE3 APIs (toggle comment if required)
int siema = 0;
DAVE_Init(); // Initialization of DAVE Apps
initLSM9DS1();
calibrate(TRUE);
resetConnectionIndicator();
initBluetooth();
//startMeasurements();
begin1();
gain = 0;
time = 2;
setTiming1(gain, time, &ms);
setPowerUp();
while(1)
{
sendMeasurementsToBt();
manageConnection();
check();
}
return 0;
}