-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
56 lines (45 loc) · 1.06 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
/**
******************************************************************************
* @file main.c
* @author Ac6
* @version V1.0
* @date 01-December-2013
* @brief Default main function.
******************************************************************************
*/
#include "stm32f7xx.h"
#include "init.h"
#include "dma.h"
#include "adc.h"
#include "tim.h"
#include "uart.h"
#include "i2c.h"
//#include "string.h"
/*void send_string(char* s)
{
HAL_UART_Transmit(&uart, (uint8_t*)s, strlen(s), 1000);
}*/
int main(void) {
HAL_Init();
Initialize();
Tim_Config();
Adc_Config();
Dma_Config();
Uart_Config();
I2C_Config();
//send_string("AT+UART=115200,1,0\r\n");
Acc_Gyr_Config(0x58, 0x58); //setting acc to 208 Hz and +/-4g and gyr to 208 Hz and 1000dps and enalbling interrupts
while (1) {
if(acc_ready==1 && gyr_ready==1){
Read_Sensors_Data();
acc_ready=0;
gyr_ready=0;
}
if(dma_transfer_complete){
HAL_GPIO_TogglePin(GPIOG, GPIO_PIN_6);
sendADCdata();
dma_transfer_complete=0;
HAL_GPIO_TogglePin(GPIOG, GPIO_PIN_6);
}
}
}