-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_example.c
48 lines (41 loc) · 1.39 KB
/
main_example.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
#include <stdio.h>
#include <fbm320_a13n.h>
/* Private variable */
int32_t real_p, real_t, altitude;
//float real_p, real_t;
extern volatile uint32_t TMR0_Ticks = 0; //one tick per millisecond(ms)
extern volatile uint32_t fbm320_update_rdy = 0;
/**
* @brief A timer generate an interrupt every millisecond
*/
void TMR0_IRQHandler(void)
{
if (TIMER_GetIntFlag(TIMER0) == 1)
{
/* Clear Timer0 time-out interrupt flag */
TIMER_ClearIntFlag(TIMER0);
TMR0_Ticks++;
}
}
/*---------------------------------------------------------------------------------------------------------*/
/* Main Function */
/*---------------------------------------------------------------------------------------------------------*/
int32_t main(void)
{
/* fbm320 initiation */
fbm320_init();
while (1)
{
/* Updating fbm320 data */
fbm320_update_data();
if (fbm320_update_rdy) {
/* If you need the pressure value read is in uint of Pa, use this function. */
// real_p = fbm320_read_pressure();
/* If you need the temperature value read is in unit of degree Celsius, use this function. */
// real_t = fbm320_read_temperature();
/* This function read pressure and temperature values. Pressure uint:Pa, Temperature unit:0.01 degree Celsius */
fbm320_read_data(&real_p, &real_t);
fbm320_update_rdy = 0;
}
}
}