aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRocco Marco Guglielmi <roccomarco.guglielmi@live.com>2016-03-06 18:17:28 +0000
committerRocco Marco Guglielmi <roccomarco.guglielmi@live.com>2016-03-06 18:17:28 +0000
commit7d6f337b8cb2c311a6adcd811e362bc5bd918291 (patch)
treecc8bd34e6c5cc88e12d32ff4d92f37ba7481ea77
parent2eef164c17fbddd23fff2b83cd49d03b9577fdcd (diff)
downloadChibiOS-7d6f337b8cb2c311a6adcd811e362bc5bd918291.tar.gz
ChibiOS-7d6f337b8cb2c311a6adcd811e362bc5bd918291.tar.bz2
ChibiOS-7d6f337b8cb2c311a6adcd811e362bc5bd918291.zip
EX hierarchy re-organized,
Improved documentation for L3GD20 related files, SPI-L3GD20 demo updated, Minor indent fixes. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9043 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--os/ex/ST/l3gd20.c (renamed from os/ex/gyroscope/ST/l3gd20.c)0
-rw-r--r--os/ex/ST/l3gd20.h (renamed from os/ex/gyroscope/ST/l3gd20.h)121
-rw-r--r--os/ex/ST/l3gd20.mk (renamed from os/ex/gyroscope/ST/l3gd20.mk)4
-rw-r--r--testhal/STM32/STM32L4xx/SPI-L3GD20/.cproject1
-rw-r--r--testhal/STM32/STM32L4xx/SPI-L3GD20/Makefile4
-rw-r--r--testhal/STM32/STM32L4xx/SPI-L3GD20/main.c4
6 files changed, 67 insertions, 67 deletions
diff --git a/os/ex/gyroscope/ST/l3gd20.c b/os/ex/ST/l3gd20.c
index b42d5c1fc..b42d5c1fc 100644
--- a/os/ex/gyroscope/ST/l3gd20.c
+++ b/os/ex/ST/l3gd20.c
diff --git a/os/ex/gyroscope/ST/l3gd20.h b/os/ex/ST/l3gd20.h
index 9951d5041..39b5d7e48 100644
--- a/os/ex/gyroscope/ST/l3gd20.h
+++ b/os/ex/ST/l3gd20.h
@@ -96,7 +96,7 @@
#endif
#if L3GD20_USE_I2C && !HAL_USE_I2C
-#error "L3GD20_USE_SPI requires HAL_USE_I2C"
+#error "L3GD20_USE_I2C requires HAL_USE_I2C"
#endif
/*===========================================================================*/
/* Driver data structures and types. */
@@ -106,73 +106,72 @@
* @name L3GD20 data structures and types
* @{
*/
-
/**
- * @brief L3GD20 Output Data Rate
+ * @brief L3GD20 full scale
*/
typedef enum {
- L3GD20_ODR_95HZ_FC_12_5 = 0x00,
- L3GD20_ODR_95HZ_FC_25 = 0x10,
- L3GD20_ODR_190HZ_FC_12_5 = 0x40,
- L3GD20_ODR_190HZ_FC_25 = 0x50,
- L3GD20_ODR_190HZ_FC_50 = 0x60,
- L3GD20_ODR_190HZ_FC_70 = 0x70,
- L3GD20_ODR_380HZ_FC_20 = 0x80,
- L3GD20_ODR_380HZ_FC_25 = 0x90,
- L3GD20_ODR_380HZ_FC_50 = 0xA0,
- L3GD20_ODR_380HZ_FC_100 = 0xB0,
- L3GD20_ODR_760HZ_FC_30 = 0xC0,
- L3GD20_ODR_760HZ_FC_35 = 0xD0,
- L3GD20_ODR_760HZ_FC_50 = 0xE0,
- L3GD20_ODR_760HZ_FC_100 = 0xF0
-}l3gd20_odr_t;
+ L3GD20_FS_250DPS = 0x00, /**< Full scale 250 degree per second. */
+ L3GD20_FS_500DPS = 0x10, /**< Full scale 500 degree per second. */
+ L3GD20_FS_2000DPS = 0x20 /**< Full scale 2000 degree per second. */
+}l3gd20_fs_t;
/**
- * @brief L3GD20 Full Scale
+ * @brief L3GD20 output data rate and bandwidth
*/
typedef enum {
- L3GD20_FS_250DPS = 0x00,
- L3GD20_FS_500DPS = 0x10,
- L3GD20_FS_2000DPS = 0x20
-}l3gd20_fs_t;
+ L3GD20_ODR_95HZ_FC_12_5 = 0x00, /**< ODR 95 Hz, BW 12.5 Hz. */
+ L3GD20_ODR_95HZ_FC_25 = 0x10, /**< ODR 95 Hz, BW 25Hz. */
+ L3GD20_ODR_190HZ_FC_12_5 = 0x40, /**< ODR 190 Hz, BW 12.5 Hz. */
+ L3GD20_ODR_190HZ_FC_25 = 0x50, /**< ODR 190 Hz, BW 25 Hz. */
+ L3GD20_ODR_190HZ_FC_50 = 0x60, /**< ODR 190 Hz, BW 50 Hz. */
+ L3GD20_ODR_190HZ_FC_70 = 0x70, /**< ODR 190 Hz, BW 70 Hz. */
+ L3GD20_ODR_380HZ_FC_20 = 0x80, /**< ODR 380 Hz, BW 20 Hz. */
+ L3GD20_ODR_380HZ_FC_25 = 0x90, /**< ODR 380 Hz, BW 25 Hz. */
+ L3GD20_ODR_380HZ_FC_50 = 0xA0, /**< ODR 380 Hz, BW 50 Hz. */
+ L3GD20_ODR_380HZ_FC_100 = 0xB0, /**< ODR 380 Hz, BW 100 Hz. */
+ L3GD20_ODR_760HZ_FC_30 = 0xC0, /**< ODR 760 Hz, BW 30 Hz. */
+ L3GD20_ODR_760HZ_FC_35 = 0xD0, /**< ODR 760 Hz, BW 35 Hz. */
+ L3GD20_ODR_760HZ_FC_50 = 0xE0, /**< ODR 760 Hz, BW 50 Hz. */
+ L3GD20_ODR_760HZ_FC_100 = 0xF0 /**< ODR 760 Hz, BW 100 Hz. */
+}l3gd20_odr_t;
/**
- * @brief L3GD20 Axes Enabling
+ * @brief L3GD20 axes enabling
*/
typedef enum {
- L3GD20_AE_DISABLED = 0x00,
- L3GD20_AE_X = 0x01,
- L3GD20_AE_Y = 0x02,
- L3GD20_AE_XY = 0x03,
- L3GD20_AE_Z = 0x04,
- L3GD20_AE_XZ = 0x05,
- L3GD20_AE_YZ = 0x06,
- L3GD20_AE_XYZ = 0x07
+ L3GD20_AE_DISABLED = 0x00, /**< All axes disabled. */
+ L3GD20_AE_X = 0x01, /**< Only X-axis enabled. */
+ L3GD20_AE_Y = 0x02, /**< Only Y-axis enabled. */
+ L3GD20_AE_XY = 0x03, /**< X and Y axes enabled. */
+ L3GD20_AE_Z = 0x04, /**< Only Z-axis enabled. */
+ L3GD20_AE_XZ = 0x05, /**< X and Z axes enabled. */
+ L3GD20_AE_YZ = 0x06, /**< Y and Z axes enabled. */
+ L3GD20_AE_XYZ = 0x07 /**< All axes enabled. */
}l3gd20_ae_t;
/**
- * @brief L3GD20 Block Data Update
+ * @brief L3GD20 block data update
*/
typedef enum {
- L3GD20_BDU_CONTINOUS = 0x00,
- L3GD20_BDU_BLOCKED = 0x80
+ L3GD20_BDU_CONTINOUS = 0x00, /**< Block data continuously updated. */
+ L3GD20_BDU_BLOCKED = 0x80 /**< Block data updated after reading. */
}l3gd20_bdu_t;
/**
- * @brief L3GD20 Endianness
+ * @brief L3GD20 endianness
*/
typedef enum {
- L3GD20_END_LITTLE = 0x00,
- L3GD20_END_BIG = 0x40
+ L3GD20_END_LITTLE = 0x00, /**< Little endian. */
+ L3GD20_END_BIG = 0x40 /**< Big endian. */
}l3gd20_end_t;
/**
* @brief Driver state machine possible states.
*/
typedef enum {
- L3GD20_UNINIT = 0, /**< Not initialized. */
- L3GD20_STOP = 1, /**< Stopped. */
- L3GD20_READY = 2, /**< Ready. */
+ L3GD20_UNINIT = 0, /**< Not initialized. */
+ L3GD20_STOP = 1, /**< Stopped. */
+ L3GD20_READY = 2, /**< Ready. */
} l3gd20_state_t;
/**
@@ -184,42 +183,42 @@ typedef struct {
/**
* @brief SPI driver associated to this L3GD20.
*/
- SPIDriver *spip;
+ SPIDriver *spip;
/**
* @brief SPI configuration associated to this L3GD20.
*/
- const SPIConfig *spicfg;
+ const SPIConfig *spicfg;
#endif /* L3GD20_USE_SPI */
#if (L3GD20_USE_I2C) || defined(__DOXYGEN__)
/**
* @brief I2C driver associated to this L3GD20.
*/
- I2CDriver *i2cp;
+ I2CDriver *i2cp;
/**
* @brief I2C configuration associated to this L3GD20.
*/
- const I2CConfig *i2ccfg;
+ const I2CConfig *i2ccfg;
#endif /* L3GD20_USE_I2C */
/**
* @brief L3GD20 full scale value.
*/
- l3gd20_fs_t fullscale;
+ l3gd20_fs_t fullscale;
/**
* @brief L3GD20 output data rate selection.
*/
- l3gd20_odr_t outputdatarate;
+ l3gd20_odr_t outputdatarate;
/**
* @brief L3GD20 axes enabling.
*/
- l3gd20_ae_t axesenabling;
+ l3gd20_ae_t axesenabling;
/**
- * @brief L3GD20 endianness.
+ * @brief L3GD20 block data update.
*/
- l3gd20_end_t endianness;
+ l3gd20_bdu_t blockdataupdate;
/**
- * @brief L3GD20 block data update.
+ * @brief L3GD20 endianness.
*/
- l3gd20_bdu_t blockdataupdate;
+ l3gd20_end_t endianness;
} L3GD20Config;
/**
@@ -246,15 +245,15 @@ struct L3GD20VMT {
* @brief @p L3GD20Driver specific data.
*/
#define _l3gd20_data \
- _base_gyroscope_data \
- /* Driver state.*/ \
- l3gd20_state_t state; \
- /* Current configuration data.*/ \
- const L3GD20Config *config; \
- /* Current sensitivity.*/ \
- float sensitivity; \
- /* Bias data.*/ \
- int32_t bias[L3GD20_NUMBER_OF_AXES];
+ _base_gyroscope_data \
+ /* Driver state.*/ \
+ l3gd20_state_t state; \
+ /* Current configuration data.*/ \
+ const L3GD20Config *config; \
+ /* Current sensitivity.*/ \
+ float sensitivity; \
+ /* Bias data.*/ \
+ int32_t bias[L3GD20_NUMBER_OF_AXES];
/**
* @extends BaseGyroscope
diff --git a/os/ex/gyroscope/ST/l3gd20.mk b/os/ex/ST/l3gd20.mk
index 7671addbd..ee715b9a0 100644
--- a/os/ex/gyroscope/ST/l3gd20.mk
+++ b/os/ex/ST/l3gd20.mk
@@ -1,6 +1,6 @@
# List of all the L3GD20 device files.
-L3GD20SRC := $(CHIBIOS)/os/ex/gyroscope/ST/l3gd20.c
+L3GD20SRC := $(CHIBIOS)/os/ex/ST/l3gd20.c
# Required include directories
L3GD20INC := $(CHIBIOS)/os/hal/lib/peripherals/include \
- $(CHIBIOS)/os/ex/gyroscope/ST \ No newline at end of file
+ $(CHIBIOS)/os/ex/ST \ No newline at end of file
diff --git a/testhal/STM32/STM32L4xx/SPI-L3GD20/.cproject b/testhal/STM32/STM32L4xx/SPI-L3GD20/.cproject
index 4d86467e8..0012badfd 100644
--- a/testhal/STM32/STM32L4xx/SPI-L3GD20/.cproject
+++ b/testhal/STM32/STM32L4xx/SPI-L3GD20/.cproject
@@ -51,4 +51,5 @@
<resource resourceType="PROJECT" workspacePath="/RT-STM32L476RG-NUCLEO"/>
</configuration>
</storageModule>
+ <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cproject>
diff --git a/testhal/STM32/STM32L4xx/SPI-L3GD20/Makefile b/testhal/STM32/STM32L4xx/SPI-L3GD20/Makefile
index 168982cc1..87daea287 100644
--- a/testhal/STM32/STM32L4xx/SPI-L3GD20/Makefile
+++ b/testhal/STM32/STM32L4xx/SPI-L3GD20/Makefile
@@ -5,7 +5,7 @@
# Compiler options here.
ifeq ($(USE_OPT),)
- USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16
+ USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
endif
# C specific options here (added to USE_OPT).
@@ -98,7 +98,7 @@ include $(CHIBIOS)/os/hal/osal/rt/osal.mk
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
# Other files (optional).
-include $(CHIBIOS)/os/ex/gyroscope/ST/l3gd20.mk
+include $(CHIBIOS)/os/ex/ST/l3gd20.mk
include $(CHIBIOS)/os/hal/lib/streams/streams.mk
# Define linker script file here
diff --git a/testhal/STM32/STM32L4xx/SPI-L3GD20/main.c b/testhal/STM32/STM32L4xx/SPI-L3GD20/main.c
index 6ceb84297..b07e384ce 100644
--- a/testhal/STM32/STM32L4xx/SPI-L3GD20/main.c
+++ b/testhal/STM32/STM32L4xx/SPI-L3GD20/main.c
@@ -48,8 +48,8 @@ static L3GD20Config l3gd20cfg = {
L3GD20_FS_250DPS, /* Full scale value */
L3GD20_ODR_760HZ_FC_100, /* Output data rate */
L3GD20_AE_XYZ, /* Enabled axes */
- L3GD20_END_LITTLE, /* Endianness */
- L3GD20_BDU_BLOCKED /* Block data update */
+ L3GD20_BDU_BLOCKED, /* Block data update */
+ L3GD20_END_LITTLE /* Endianness */
};
/*