mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
Merge pull request #12140 from aabadie/pr/tests/driver_bmp180_cleanup
tests/driver_bmp180: cleanup application
This commit is contained in:
commit
7cbc239a00
@ -2,7 +2,6 @@ include ../Makefile.tests_common
|
|||||||
|
|
||||||
USEMODULE += bmp180
|
USEMODULE += bmp180
|
||||||
USEMODULE += xtimer
|
USEMODULE += xtimer
|
||||||
USEMODULE += printf_float
|
|
||||||
|
|
||||||
# set default altitude
|
# set default altitude
|
||||||
TEST_ALTITUDE ?= 158 # altitude in Polytechnique School campus
|
TEST_ALTITUDE ?= 158 # altitude in Polytechnique School campus
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
@ -73,12 +74,12 @@ int main(void)
|
|||||||
/* Get altitude in meters */
|
/* Get altitude in meters */
|
||||||
int16_t altitude = bmp180_altitude(&dev, pressure_0);
|
int16_t altitude = bmp180_altitude(&dev, pressure_0);
|
||||||
|
|
||||||
printf("Temperature [°C]: %d.%d\n"
|
printf("Temperature [°C]: %i.%d\n"
|
||||||
"Pressure [hPa]: %lu.%d\n"
|
"Pressure [hPa]: %lu.%d\n"
|
||||||
"Pressure at see level [hPa]: %lu.%d\n"
|
"Pressure at see level [hPa]: %lu.%d\n"
|
||||||
"Altitude [m]: %i\n"
|
"Altitude [m]: %i\n"
|
||||||
"\n+-------------------------------------+\n",
|
"\n+-------------------------------------+\n",
|
||||||
(int)(temperature / 10), (int)(temperature % 10),
|
(int)(temperature / 10), abs(temperature % 10),
|
||||||
(unsigned long)pressure / 100, (int)(pressure % 100),
|
(unsigned long)pressure / 100, (int)(pressure % 100),
|
||||||
(unsigned long)pressure_0 / 100, (int)(pressure_0 % 100),
|
(unsigned long)pressure_0 / 100, (int)(pressure_0 % 100),
|
||||||
(int)altitude);
|
(int)altitude);
|
||||||
|
Loading…
Reference in New Issue
Block a user