aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/STM32L4xx/SPI-L3GD20/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'testhal/STM32/STM32L4xx/SPI-L3GD20/main.c')
-rw-r--r--testhal/STM32/STM32L4xx/SPI-L3GD20/main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/testhal/STM32/STM32L4xx/SPI-L3GD20/main.c b/testhal/STM32/STM32L4xx/SPI-L3GD20/main.c
index 7bd21d8cb..94850da3b 100644
--- a/testhal/STM32/STM32L4xx/SPI-L3GD20/main.c
+++ b/testhal/STM32/STM32L4xx/SPI-L3GD20/main.c
@@ -30,6 +30,7 @@ static L3GD20Driver L3GD20D1;
static int32_t rawdata[L3GD20_NUMBER_OF_AXES];
static float cookeddata[L3GD20_NUMBER_OF_AXES];
+static float temperature;
static char axesID[L3GD20_NUMBER_OF_AXES] = {'X', 'Y', 'Z'};
static uint32_t i;
@@ -109,7 +110,10 @@ int main(void) {
gyroscopeReadCooked(&L3GD20D1, cookeddata);
for(i = 0; i < L3GD20_NUMBER_OF_AXES; i++)
- chprintf(chp, "COOKED-%c:%f\r\n", axesID[i], cookeddata[i]);
+ chprintf(chp, "COOKED-%c:%.3f\r\n", axesID[i], cookeddata[i]);
+
+ gyroscopeGetTemp(&L3GD20D1, &temperature);
+ chprintf(chp, "TEMP:%.1f C°\r\n", temperature);
chprintf(chp, "Press JOY to continue...\r\n");
chThdSleepMilliseconds(150);
@@ -140,7 +144,10 @@ int main(void) {
gyroscopeReadCooked(&L3GD20D1, cookeddata);
for(i = 0; i < L3GD20_NUMBER_OF_AXES; i++)
- chprintf(chp, "COOKED-%c:%f\r\n", axesID[i], cookeddata[i]);
+ chprintf(chp, "COOKED-%c:%.3f\r\n", axesID[i], cookeddata[i]);
+
+ gyroscopeGetTemp(&L3GD20D1, &temperature);
+ chprintf(chp, "TEMP:%.1f C°\r\n", temperature);
chThdSleepMilliseconds(150);
#if CHPRINTF_USE_ANSI_CODE