aboutsummaryrefslogtreecommitdiffstats
path: root/testex/STM32/STM32F3xx/I2C-LSM303DLHC/main.c
diff options
context:
space:
mode:
authorRocco Marco Guglielmi <roccomarco.guglielmi@gmail.com>2018-02-28 10:04:48 +0000
committerRocco Marco Guglielmi <roccomarco.guglielmi@gmail.com>2018-02-28 10:04:48 +0000
commit118f847cbaa87aae9a4ece29c4209354e1b9749c (patch)
tree4a49e50aee7056a4f556fb8d764e00677dcd0db9 /testex/STM32/STM32F3xx/I2C-LSM303DLHC/main.c
parent4e4b7ef08e7e826a14201c16f7a4c104e66a637a (diff)
downloadChibiOS-118f847cbaa87aae9a4ece29c4209354e1b9749c.tar.gz
ChibiOS-118f847cbaa87aae9a4ece29c4209354e1b9749c.tar.bz2
ChibiOS-118f847cbaa87aae9a4ece29c4209354e1b9749c.zip
Updated LSM303DLHC STM32F3 Discovery demo
git-svn-id: https://svn.code.sf.net/p/chibios/svn2/trunk@11592 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'testex/STM32/STM32F3xx/I2C-LSM303DLHC/main.c')
-rw-r--r--testex/STM32/STM32F3xx/I2C-LSM303DLHC/main.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/testex/STM32/STM32F3xx/I2C-LSM303DLHC/main.c b/testex/STM32/STM32F3xx/I2C-LSM303DLHC/main.c
index b60e5b6a4..566078a8e 100644
--- a/testex/STM32/STM32F3xx/I2C-LSM303DLHC/main.c
+++ b/testex/STM32/STM32F3xx/I2C-LSM303DLHC/main.c
@@ -18,7 +18,6 @@
#include "hal.h"
#include "chprintf.h"
-
#include "lsm303dlhc.h"
#define cls(chp) chprintf(chp, "\033[2J\033[1;1H")
@@ -47,7 +46,9 @@ static const I2CConfig i2ccfg = {
0
};
-static const LSM303DLHCAccConfig lsm303dlhcacccfg = {
+static const LSM303DLHCConfig lsm303dlhccfg = {
+ &I2CD1,
+ &i2ccfg,
NULL,
NULL,
LSM303DLHC_ACC_FS_4G,
@@ -58,9 +59,6 @@ static const LSM303DLHCAccConfig lsm303dlhcacccfg = {
LSM303DLHC_ACC_BDU_BLOCK,
LSM303DLHC_ACC_END_LITTLE,
#endif
-};
-
-static const LSM303DLHCCompConfig lsm303dlhccompcfg = {
NULL,
NULL,
LSM303DLHC_COMP_FS_1P3GA,
@@ -70,13 +68,6 @@ static const LSM303DLHCCompConfig lsm303dlhccompcfg = {
#endif
};
-static const LSM303DLHCConfig lsm303dlhccfg = {
- &I2CD1,
- &i2ccfg,
- &lsm303dlhcacccfg,
- &lsm303dlhccompcfg
-};
-
/*===========================================================================*/
/* Generic code. */
/*===========================================================================*/
@@ -132,28 +123,28 @@ int main(void) {
lsm303dlhcStart(&LSM303DLHCD1, &lsm303dlhccfg);
/*
- * Normal main() thread activity, spawning shells.
+ * Normal main() thread activity, printing MEMS data on the serial driver 1.
*/
while (true) {
- accelerometerReadRaw(&(LSM303DLHCD1.accelerometer_if), accraw);
+ lsm303dlhcAccelerometerReadRaw(&LSM303DLHCD1, accraw);
chprintf(chp, "LSM303DLHC Accelerometer raw data...\r\n");
for(i = 0; i < LSM303DLHC_ACC_NUMBER_OF_AXES; i++) {
chprintf(chp, "%c-axis: %d\r\n", axisID[i], accraw[i]);
}
- compassReadRaw(&(LSM303DLHCD1.compass_if), compraw);
+ lsm303dlhcCompassReadRaw(&LSM303DLHCD1, compraw);
chprintf(chp, "LSM303DLHC Compass raw data...\r\n");
for(i = 0; i < LSM303DLHC_COMP_NUMBER_OF_AXES; i++) {
chprintf(chp, "%c-axis: %d\r\n", axisID[i], compraw[i]);
}
- accelerometerReadCooked(&(LSM303DLHCD1.accelerometer_if), acccooked);
+ lsm303dlhcAccelerometerReadCooked(&LSM303DLHCD1, acccooked);
chprintf(chp, "LSM303DLHC Accelerometer cooked data...\r\n");
for(i = 0; i < LSM303DLHC_ACC_NUMBER_OF_AXES; i++) {
chprintf(chp, "%c-axis: %.3f\r\n", axisID[i], acccooked[i]);
}
- compassReadCooked(&(LSM303DLHCD1.compass_if), compcooked);
+ lsm303dlhcCompassReadCooked(&LSM303DLHCD1, compcooked);
chprintf(chp, "LSM303DLHC Compass cooked data...\r\n");
for(i = 0; i < LSM303DLHC_COMP_NUMBER_OF_AXES; i++) {
chprintf(chp, "%c-axis: %.3f\r\n", axisID[i], compcooked[i]);