-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
106 lines (48 loc) · 1.37 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
/*
This is the main file for communication done between the MAX32655 and the MAX30009 to measure GSR
The current setup set out good frequencies for GSR, but there are functions to easily change the settings to measure
at different rates or to measure different vital signs depending on necessities
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
#include "MAX30009.h"
#include "MAX32655.h"
#include "mxc_device.h"
#include "led.h"
#include "board.h"
#include "mxc_delay.h"
#include "uart.h"
#include "dma.h"
#include "nvic_table.h"
#include "mxc_pins.h"
#include "spi.h"
#include"spiFunctions.h"
#include "bioZ.h"
/***** Definitions *****/
#define SPI_SPEED 1000000// Bit Rate
// Board Selection
#define SPI MXC_SPI1
#define SPI_IRQ SPI1_IRQn
/***** Globals *****/
uint8_t gReadBuf[100];
uint8_t gHold[100];
int errCnt;
extern int count;
int main(void){
printf("START\n");
/*
Collection of reads or writes including initialisation
*/
initSPI();//begin SPI communication
init();//initialise the MAX30009
GSRsettings();//put in correct setting for GSR communication
setMode(0);
spiBurst();//begin reading from the FIFO
printf("error count = %d\n",errCnt);
shutdownSPI();
printf("Finished\n");
return E_NO_ERROR;
}