aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32
diff options
context:
space:
mode:
Diffstat (limited to 'testhal/STM32')
-rw-r--r--testhal/STM32/STM32F3xx/SPI-L3GD20/main.c50
-rw-r--r--testhal/STM32/STM32F4xx/SPI-L3GD20/main.c62
-rw-r--r--testhal/STM32/STM32L4xx/SPI-L3GD20/main.c50
3 files changed, 70 insertions, 92 deletions
diff --git a/testhal/STM32/STM32F3xx/SPI-L3GD20/main.c b/testhal/STM32/STM32F3xx/SPI-L3GD20/main.c
index beb2b6927..2f2199fc6 100644
--- a/testhal/STM32/STM32F3xx/SPI-L3GD20/main.c
+++ b/testhal/STM32/STM32F3xx/SPI-L3GD20/main.c
@@ -28,7 +28,7 @@
/* L3GD20 related. */
/*===========================================================================*/
-/* L3GD20 Driver: This object represent an L3GD20 instance */
+/* L3GD20 Driver: This object represent an L3GD20 instance.*/
static L3GD20Driver L3GD20D1;
static int32_t rawdata[L3GD20_NUMBER_OF_AXES];
@@ -40,20 +40,20 @@ static uint32_t i;
static const SPIConfig spicfg = {
NULL,
- GPIOE, /* port of L3GD20 CS */
- GPIOE_L3GD20_CS, /* pin of L3GD20 CS */
- SPI_CR1_BR | SPI_CR1_CPOL | SPI_CR1_CPHA, /* CR1 register */
- 0 /* CR2 register */
+ GPIOE, /* port of L3GD20 CS.*/
+ GPIOE_L3GD20_CS, /* pin of L3GD20 CS.*/
+ SPI_CR1_BR | SPI_CR1_CPOL | SPI_CR1_CPHA, /* CR1 register.*/
+ 0 /* CR2 register.*/
};
static L3GD20Config l3gd20cfg = {
- &SPID1, /* Pointer to SPI Driver */
- &spicfg, /* Pointer to SPI Configuration */
- {0, 0, 0}, /* Use default sensitivity */
- {0, 0, 0}, /* Use default bias */
- L3GD20_UNIT_DPS, /* Measurement unit DPS */
- L3GD20_FS_250DPS, /* Full scale value */
- L3GD20_ODR_760HZ, /* Output data rate */
+ &SPID1, /* Pointer to SPI Driver.*/
+ &spicfg, /* Pointer to SPI Configuration.*/
+ {0, 0, 0}, /* Use default sensitivity.*/
+ {0, 0, 0}, /* Use default bias.*/
+ L3GD20_UNIT_DPS, /* Measurement unit DPS.*/
+ L3GD20_FS_250DPS, /* Full scale value.*/
+ L3GD20_ODR_760HZ, /* Output data rate.*/
#if L3GD20_USE_ADVANCED || defined(__DOXYGEN__)
L3GD20_BDU_CONTINUOUS,
L3GD20_END_LITTLE,
@@ -75,9 +75,9 @@ static L3GD20Config l3gd20cfg = {
#define usb_lld_connect_bus(usbp)
#define usb_lld_disconnect_bus(usbp)
-/* Enable use of special ANSI escape sequences */
-#define CHPRINTF_USE_ANSI_CODE TRUE
-#define SHELL_WA_SIZE THD_WORKING_AREA_SIZE(2048)
+/* Enable use of special ANSI escape sequences.*/
+#define CHPRINTF_USE_ANSI_CODE TRUE
+#define SHELL_WA_SIZE THD_WORKING_AREA_SIZE(2048)
static void cmd_get(BaseSequentialStream *chp, int argc, char *argv[]) {
(void)argv;
@@ -259,9 +259,7 @@ int main(void) {
halInit();
chSysInit();
- /*
- * Initializes a serial-over-USB CDC driver.
- */
+ /* Initializes a serial-over-USB CDC driver.*/
sduObjectInit(&SDU1);
sduStart(&SDU1, &serusbcfg);
@@ -275,24 +273,16 @@ int main(void) {
usbStart(serusbcfg.usbp, &usbcfg);
usbConnectBus(serusbcfg.usbp);
- /*
- * Creates the blinker thread.
- */
+ /* Creates the blinker thread.*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO + 1, Thread1, NULL);
- /*
- * L3GD20 Object Initialization
- */
+ /* L3GD20 Object Initialization.*/
l3gd20ObjectInit(&L3GD20D1);
- /*
- * Activates the L3GD20 driver.
- */
+ /* Activates the L3GD20 driver.*/
l3gd20Start(&L3GD20D1, &l3gd20cfg);
- /*
- * Shell manager initialization.
- */
+ /* Shell manager initialization.*/
shellInit();
while(TRUE) {
diff --git a/testhal/STM32/STM32F4xx/SPI-L3GD20/main.c b/testhal/STM32/STM32F4xx/SPI-L3GD20/main.c
index af0cdcae9..e93e21a32 100644
--- a/testhal/STM32/STM32F4xx/SPI-L3GD20/main.c
+++ b/testhal/STM32/STM32F4xx/SPI-L3GD20/main.c
@@ -28,7 +28,7 @@
/* L3GD20 related. */
/*===========================================================================*/
-/* L3GD20 Driver: This object represent an L3GD20 instance */
+/* L3GD20 Driver: This object represent an L3GD20 instance.*/
static L3GD20Driver L3GD20D1;
static int32_t rawdata[L3GD20_NUMBER_OF_AXES];
@@ -40,20 +40,20 @@ static uint32_t i;
static const SPIConfig spicfg = {
NULL,
- GPIOE, /* port of L3GD20 CS */
- GPIOE_L3GD20_CS, /* pin of L3GD20 CS */
- SPI_CR1_BR_0 | SPI_CR1_CPOL | SPI_CR1_CPHA,/* CR1 register*/
- 0 /* CR2 register */
+ GPIOE, /* port of L3GD20 CS.*/
+ GPIOE_L3GD20_CS, /* pin of L3GD20 CS.*/
+ SPI_CR1_BR_0 | SPI_CR1_CPOL | SPI_CR1_CPHA,/* CR1 register.*/
+ 0 /* CR2 register.*/
};
static L3GD20Config l3gd20cfg = {
- &SPID1, /* Pointer to SPI Driver */
- &spicfg, /* Pointer to SPI Configuration */
- {0, 0, 0}, /* Use default sensitivity */
- {0, 0, 0}, /* Use default bias */
- L3GD20_UNIT_DPS, /* Measurement unit DPS */
- L3GD20_FS_250DPS, /* Full scale value */
- L3GD20_ODR_760HZ, /* Output data rate */
+ &SPID1, /* Pointer to SPI Driver.*/
+ &spicfg, /* Pointer to SPI Configuration.*/
+ {0, 0, 0}, /* Use default sensitivity.*/
+ {0, 0, 0}, /* Use default bias.*/
+ L3GD20_UNIT_DPS, /* Measurement unit DPS.*/
+ L3GD20_FS_250DPS, /* Full scale value.*/
+ L3GD20_ODR_760HZ, /* Output data rate.*/
#if L3GD20_USE_ADVANCED || defined(__DOXYGEN__)
L3GD20_BDU_CONTINUOUS,
L3GD20_END_LITTLE,
@@ -68,9 +68,16 @@ static L3GD20Config l3gd20cfg = {
/* Command line related. */
/*===========================================================================*/
-/* Enable use of special ANSI escape sequences */
-#define CHPRINTF_USE_ANSI_CODE TRUE
-#define SHELL_WA_SIZE THD_WORKING_AREA_SIZE(2048)
+
+
+
+
+
+
+
+/* Enable use of special ANSI escape sequences.*/
+#define CHPRINTF_USE_ANSI_CODE TRUE
+#define SHELL_WA_SIZE THD_WORKING_AREA_SIZE(2048)
static void cmd_get(BaseSequentialStream *chp, int argc, char *argv[]) {
(void)argv;
@@ -179,14 +186,15 @@ static void cmd_bias(BaseSequentialStream *chp, int argc, char *argv[]) {
#endif
chprintf(chp, "Please don't move the device while Green LED is on!\r\n");
chprintf(chp, "Press a key to start...\r\n");
- while (chnGetTimeout((BaseChannel *)chp, 500) == Q_TIMEOUT) {
+ while (chnGetTimeout((BaseChannel *)chp, 500) == Q_TIMEOUT)
;
- }
palSetLine(LINE_LED4);
+
chThdSleepMilliseconds(1000);
gyroscopeSampleBias(&L3GD20D1);
palClearLine(LINE_LED4);
+
chprintf(chp, "Procedure completed!\r\n");
}
else if(!strcmp (argv[0], "reset")) {
@@ -252,9 +260,7 @@ int main(void) {
halInit();
chSysInit();
- /*
- * Initializes a serial-over-USB CDC driver.
- */
+ /* Initializes a serial-over-USB CDC driver.*/
sduObjectInit(&SDU1);
sduStart(&SDU1, &serusbcfg);
@@ -268,24 +274,16 @@ int main(void) {
usbStart(serusbcfg.usbp, &usbcfg);
usbConnectBus(serusbcfg.usbp);
- /*
- * Creates the blinker thread.
- */
+ /* Creates the blinker thread.*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO + 1, Thread1, NULL);
- /*
- * L3GD20 Object Initialization
- */
+ /* L3GD20 Object Initialization.*/
l3gd20ObjectInit(&L3GD20D1);
- /*
- * Activates the L3GD20 driver.
- */
+ /* Activates the L3GD20 driver.*/
l3gd20Start(&L3GD20D1, &l3gd20cfg);
- /*
- * Shell manager initialization.
- */
+ /* Shell manager initialization.*/
shellInit();
while(TRUE) {
diff --git a/testhal/STM32/STM32L4xx/SPI-L3GD20/main.c b/testhal/STM32/STM32L4xx/SPI-L3GD20/main.c
index 403f78916..d2147de31 100644
--- a/testhal/STM32/STM32L4xx/SPI-L3GD20/main.c
+++ b/testhal/STM32/STM32L4xx/SPI-L3GD20/main.c
@@ -27,7 +27,7 @@
/* L3GD20 related. */
/*===========================================================================*/
-/* L3GD20 Driver: This object represent an L3GD20 instance */
+/* L3GD20 Driver: This object represent an L3GD20 instance.*/
static L3GD20Driver L3GD20D1;
static int32_t rawdata[L3GD20_NUMBER_OF_AXES];
@@ -39,20 +39,20 @@ static uint32_t i;
static const SPIConfig spicfg = {
NULL,
- GPIOD, /* port of L3GD20 CS */
- GPIOD_GYRO_CS, /* pin of L3GD20 CS */
- SPI_CR1_BR | SPI_CR1_CPOL | SPI_CR1_CPHA, /* CR1 register */
- 0 /* CR2 register */
+ GPIOD, /* port of L3GD20 CS.*/
+ GPIOD_GYRO_CS, /* pin of L3GD20 CS.*/
+ SPI_CR1_BR | SPI_CR1_CPOL | SPI_CR1_CPHA, /* CR1 register.*/
+ 0 /* CR2 register.*/
};
static L3GD20Config l3gd20cfg = {
- &SPID2, /* Pointer to SPI Driver */
- &spicfg, /* Pointer to SPI Configuration */
- {0, 0, 0}, /* Use default sensitivity */
- {0, 0, 0}, /* Use default bias */
- L3GD20_UNIT_DPS, /* Measurement unit DPS */
- L3GD20_FS_250DPS, /* Full scale value */
- L3GD20_ODR_760HZ, /* Output data rate */
+ &SPID2, /* Pointer to SPI Driver.*/
+ &spicfg, /* Pointer to SPI Configuration.*/
+ {0, 0, 0}, /* Use default sensitivity.*/
+ {0, 0, 0}, /* Use default bias.*/
+ L3GD20_UNIT_DPS, /* Measurement unit DPS.*/
+ L3GD20_FS_250DPS, /* Full scale value.*/
+ L3GD20_ODR_760HZ, /* Output data rate.*/
#if L3GD20_USE_ADVANCED || defined(__DOXYGEN__)
L3GD20_BDU_CONTINUOUS,
L3GD20_END_LITTLE,
@@ -74,9 +74,9 @@ static L3GD20Config l3gd20cfg = {
#define usb_lld_connect_bus(usbp)
#define usb_lld_disconnect_bus(usbp)
-/* Enable use of special ANSI escape sequences */
-#define CHPRINTF_USE_ANSI_CODE TRUE
-#define SHELL_WA_SIZE THD_WORKING_AREA_SIZE(2048)
+/* Enable use of special ANSI escape sequences.*/
+#define CHPRINTF_USE_ANSI_CODE TRUE
+#define SHELL_WA_SIZE THD_WORKING_AREA_SIZE(2048)
static void cmd_get(BaseSequentialStream *chp, int argc, char *argv[]) {
(void)argv;
@@ -253,29 +253,19 @@ int main(void) {
halInit();
chSysInit();
- /*
- * Activates the serial driver 2 using the driver default configuration.
- */
+ /* Activates the serial driver 2 using the driver default configuration.*/
sdStart(&SD2, NULL);
- /*
- * Creates the blinker thread.
- */
+ /* Creates the blinker thread.*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO + 1, Thread1, NULL);
- /*
- * L3GD20 Object Initialization
- */
+ /* L3GD20 Object Initialization.*/
l3gd20ObjectInit(&L3GD20D1);
- /*
- * Activates the L3GD20 driver.
- */
+ /* Activates the L3GD20 driver.*/
l3gd20Start(&L3GD20D1, &l3gd20cfg);
- /*
- * Shell manager initialization.
- */
+ /* Shell manager initialization.*/
shellInit();
while(TRUE) {
n> /* * GPT driver system settings. */ #define STM32_GPT_USE_TIM1 FALSE #define STM32_GPT_USE_TIM2 FALSE #define STM32_GPT_USE_TIM3 FALSE #define STM32_GPT_USE_TIM4 FALSE #define STM32_GPT_USE_TIM6 FALSE #define STM32_GPT_USE_TIM7 FALSE #define STM32_GPT_USE_TIM8 FALSE #define STM32_GPT_USE_TIM15 FALSE #define STM32_GPT_USE_TIM16 FALSE #define STM32_GPT_USE_TIM17 FALSE #define STM32_GPT_TIM1_IRQ_PRIORITY 7 #define STM32_GPT_TIM2_IRQ_PRIORITY 7 #define STM32_GPT_TIM3_IRQ_PRIORITY 7 #define STM32_GPT_TIM4_IRQ_PRIORITY 7 #define STM32_GPT_TIM6_IRQ_PRIORITY 7 #define STM32_GPT_TIM7_IRQ_PRIORITY 7 #define STM32_GPT_TIM8_IRQ_PRIORITY 7 /* * I2C driver system settings. */ #define STM32_I2C_USE_I2C1 FALSE #define STM32_I2C_USE_I2C2 FALSE #define STM32_I2C_BUSY_TIMEOUT 50 #define STM32_I2C_I2C1_IRQ_PRIORITY 10 #define STM32_I2C_I2C2_IRQ_PRIORITY 10 #define STM32_I2C_USE_DMA TRUE #define STM32_I2C_I2C1_DMA_PRIORITY 1 #define STM32_I2C_I2C2_DMA_PRIORITY 1 #define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure") /* * ICU driver system settings. */ #define STM32_ICU_USE_TIM1 TRUE #define STM32_ICU_USE_TIM2 FALSE #define STM32_ICU_USE_TIM3 TRUE #define STM32_ICU_USE_TIM4 FALSE #define STM32_ICU_USE_TIM8 TRUE #define STM32_ICU_USE_TIM15 FALSE #define STM32_ICU_TIM1_IRQ_PRIORITY 7 #define STM32_ICU_TIM2_IRQ_PRIORITY 7 #define STM32_ICU_TIM3_IRQ_PRIORITY 7 #define STM32_ICU_TIM4_IRQ_PRIORITY 7 #define STM32_ICU_TIM8_IRQ_PRIORITY 7 /* * PWM driver system settings. */ #define STM32_PWM_USE_ADVANCED FALSE #define STM32_PWM_USE_TIM1 FALSE #define STM32_PWM_USE_TIM2 FALSE #define STM32_PWM_USE_TIM3 FALSE #define STM32_PWM_USE_TIM4 TRUE #define STM32_PWM_USE_TIM8 FALSE #define STM32_PWM_USE_TIM15 FALSE #define STM32_PWM_USE_TIM16 FALSE #define STM32_PWM_USE_TIM17 FALSE #define STM32_PWM_TIM1_IRQ_PRIORITY 7 #define STM32_PWM_TIM2_IRQ_PRIORITY 7 #define STM32_PWM_TIM3_IRQ_PRIORITY 7 #define STM32_PWM_TIM4_IRQ_PRIORITY 7 #define STM32_PWM_TIM8_IRQ_PRIORITY 7 /* * RTC driver system settings. */ #define STM32_RTC_PRESA_VALUE 32 #define STM32_RTC_PRESS_VALUE 1024 #define STM32_RTC_CR_INIT 0 #define STM32_RTC_TAMPCR_INIT 0 /* * SERIAL driver system settings. */ #define STM32_SERIAL_USE_USART1 FALSE #define STM32_SERIAL_USE_USART2 FALSE #define STM32_SERIAL_USE_USART3 FALSE #define STM32_SERIAL_USE_UART4 FALSE #define STM32_SERIAL_USE_UART5 FALSE #define STM32_SERIAL_USART1_PRIORITY 12 #define STM32_SERIAL_USART2_PRIORITY 12 #define STM32_SERIAL_USART3_PRIORITY 12 #define STM32_SERIAL_UART4_PRIORITY 12 #define STM32_SERIAL_UART5_PRIORITY 12 /* * SPI driver system settings. */ #define STM32_SPI_USE_SPI1 FALSE #define STM32_SPI_USE_SPI2 FALSE #define STM32_SPI_USE_SPI3 FALSE #define STM32_SPI_SPI1_DMA_PRIORITY 1 #define STM32_SPI_SPI2_DMA_PRIORITY 1 #define STM32_SPI_SPI3_DMA_PRIORITY 1 #define STM32_SPI_SPI1_IRQ_PRIORITY 10 #define STM32_SPI_SPI2_IRQ_PRIORITY 10 #define STM32_SPI_SPI3_IRQ_PRIORITY 10 #define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure") /* * ST driver system settings. */ #define STM32_ST_IRQ_PRIORITY 8 #define STM32_ST_USE_TIMER 2 /* * UART driver system settings. */ #define STM32_UART_USE_USART1 FALSE #define STM32_UART_USE_USART2 FALSE #define STM32_UART_USE_USART3 FALSE #define STM32_UART_USART1_IRQ_PRIORITY 12 #define STM32_UART_USART2_IRQ_PRIORITY 12 #define STM32_UART_USART3_IRQ_PRIORITY 12 #define STM32_UART_USART1_DMA_PRIORITY 0 #define STM32_UART_USART2_DMA_PRIORITY 0 #define STM32_UART_USART3_DMA_PRIORITY 0 #define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure") /* * USB driver system settings. */ #define STM32_USB_USE_USB1 FALSE #define STM32_USB_LOW_POWER_ON_SUSPEND FALSE #define STM32_USB_USB1_HP_IRQ_PRIORITY 13 #define STM32_USB_USB1_LP_IRQ_PRIORITY 14 /* * WDG driver system settings. */ #define STM32_WDG_USE_IWDG FALSE #include "mcuconf_community.h" #endif /* MCUCONF_H */