2767 |
kaklik |
1 |
#include <main.h> |
|
|
2 |
|
|
|
3 |
/* |
|
|
4 |
MPL115A1 SDN - +3.3V (always power on) |
|
|
5 |
MPL115A1 #CS - PIN_C2 |
2769 |
kaklik |
6 |
MPL115A1 DOUT - PIN_C4 |
|
|
7 |
MPL115A1 DIN - PIN_C5 |
2767 |
kaklik |
8 |
MPL115A1 SCLK - PIN_C3 |
|
|
9 |
MPL115A1 GND - GND |
|
|
10 |
MPL115A1 VDD - +3.3V |
|
|
11 |
*/ |
|
|
12 |
|
|
|
13 |
#define CSN_SPI PIN_C2 |
2778 |
kaklik |
14 |
#include "MPL115A1.c" |
2767 |
kaklik |
15 |
|
2772 |
kaklik |
16 |
void main() |
|
|
17 |
{ |
|
|
18 |
printf("Start \r\n"); |
|
|
19 |
setup_spi(SPI_MASTER | SPI_MODE_0 | SPI_CLK_DIV_64); |
|
|
20 |
output_high(CSN_SPI); |
|
|
21 |
delay_ms(100); |
|
|
22 |
|
2778 |
kaklik |
23 |
MPL_init(); // get correction coefficients from the sensor |
2772 |
kaklik |
24 |
|
|
|
25 |
while(true) |
|
|
26 |
{ |
2777 |
kaklik |
27 |
printf("%f %f \r\n", MPL_get_pressure(), MPL_get_temperature()); |
2774 |
kaklik |
28 |
delay_ms(500); |
2772 |
kaklik |
29 |
} |
|
|
30 |
} |