aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/STM32F3xx/SPI-L3GD20
diff options
context:
space:
mode:
authorRocco Marco Guglielmi <roccomarco.guglielmi@live.com>2016-04-22 21:32:32 +0000
committerRocco Marco Guglielmi <roccomarco.guglielmi@live.com>2016-04-22 21:32:32 +0000
commit4061297c2a41081c374585a6f256a51f1b799058 (patch)
tree16c6c6dd6287fcce0194640d45174fd953bad600 /testhal/STM32/STM32F3xx/SPI-L3GD20
parent213d63733ba09da3927cfc18b67cf7a040bdd8ec (diff)
downloadChibiOS-4061297c2a41081c374585a6f256a51f1b799058.tar.gz
ChibiOS-4061297c2a41081c374585a6f256a51f1b799058.tar.bz2
ChibiOS-4061297c2a41081c374585a6f256a51f1b799058.zip
EX: added get temperature for L3GD20, improved related demos
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9341 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal/STM32/STM32F3xx/SPI-L3GD20')
-rw-r--r--testhal/STM32/STM32F3xx/SPI-L3GD20/main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/testhal/STM32/STM32F3xx/SPI-L3GD20/main.c b/testhal/STM32/STM32F3xx/SPI-L3GD20/main.c
index 31ec3004f..a845f92a7 100644
--- a/testhal/STM32/STM32F3xx/SPI-L3GD20/main.c
+++ b/testhal/STM32/STM32F3xx/SPI-L3GD20/main.c
@@ -38,6 +38,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;
@@ -136,7 +137,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 Button to continue...\r\n");
chThdSleepMilliseconds(150);
@@ -167,7 +171,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