aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-11-13 08:59:15 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-11-13 08:59:15 +0000
commitbe60d348aa1f67e1c9a4667aa996318c1a43067f (patch)
tree1daf675592bab8c53aa77c03ae70f5ced0d8e36d
parent688c495b28d6307050f370717c295f2f889e3b3c (diff)
downloadChibiOS-be60d348aa1f67e1c9a4667aa996318c1a43067f.tar.gz
ChibiOS-be60d348aa1f67e1c9a4667aa996318c1a43067f.tar.bz2
ChibiOS-be60d348aa1f67e1c9a4667aa996318c1a43067f.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2356 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--boards/ST_STM8L_DISCOVERY/board.h26
-rw-r--r--demos/STM8L-STM8L152-DISCOVERY-STVD/demo/halconf.h2
-rw-r--r--demos/STM8L-STM8L152-DISCOVERY-STVD/demo/main.c4
-rw-r--r--demos/STM8L-STM8L152-DISCOVERY-STVD/demo/mcuconf.h2
-rw-r--r--os/hal/platforms/STM8L/hal_lld.c10
-rw-r--r--os/hal/platforms/STM8L/hal_lld.h4
-rw-r--r--os/hal/platforms/STM8L/hal_lld_stm8l_md.h2
-rw-r--r--os/hal/platforms/STM8L/pal_lld.h10
8 files changed, 32 insertions, 28 deletions
diff --git a/boards/ST_STM8L_DISCOVERY/board.h b/boards/ST_STM8L_DISCOVERY/board.h
index bfb8f23c4..a349aa9e4 100644
--- a/boards/ST_STM8L_DISCOVERY/board.h
+++ b/boards/ST_STM8L_DISCOVERY/board.h
@@ -28,7 +28,7 @@
* Board identifiers.
*/
#define BOARD_ST_STM8L_DISCOVERY
-#define BOARD_NAME "ST STM8L-Discovery"
+#define BOARD_NAME "ST STM8L-Discovery"
/*
* Board frequencies and bypass modes.
@@ -101,7 +101,7 @@
*/
#define VAL_GPIOAODR 0
#define VAL_GPIOADDR 0 /* All inputs. */
-#define VAL_GPIOACR1 0xFF /* All pull-up. */
+#define VAL_GPIOACR1 0xFF /* All pull-up/push-pull. */
#define VAL_GPIOACR2 0
/*
@@ -109,15 +109,15 @@
*/
#define VAL_GPIOBODR 0
#define VAL_GPIOBDDR 0 /* All inputs. */
-#define VAL_GPIOBCR1 0xFF /* All pull-up. */
+#define VAL_GPIOBCR1 0xFF /* All pull-up/push-pull. */
#define VAL_GPIOBCR2 0
/*
* Port C initial setup.
*/
-#define VAL_GPIOCODR (1 < PC_LED4)
+#define VAL_GPIOCODR 0
#define VAL_GPIOCDDR (1 < PC_LED4)
-#define VAL_GPIOCCR1 0xFF /* All pull-up/open drain. */
+#define VAL_GPIOCCR1 0xFF /* All pull-up/push-pull. */
#define VAL_GPIOCCR2 0
/*
@@ -125,15 +125,15 @@
*/
#define VAL_GPIODODR 0
#define VAL_GPIODDDR 0 /* All inputs. */
-#define VAL_GPIODCR1 0xFF /* All pull-up. */
+#define VAL_GPIODCR1 0xFF /* All pull-up/push-pull. */
#define VAL_GPIODCR2 0
/*
* Port E initial setup.
*/
-#define VAL_GPIOEODR (1 < PE_LED3)
+#define VAL_GPIOEODR 0
#define VAL_GPIOEDDR (1 < PE_LED3)
-#define VAL_GPIOECR1 0xFF /* All pull-up/open drain. */
+#define VAL_GPIOECR1 0xFF /* All pull-up/push-pull. */
#define VAL_GPIOECR2 0
/*
@@ -141,17 +141,9 @@
*/
#define VAL_GPIOFODR 0
#define VAL_GPIOFDDR 0 /* All inputs. */
-#define VAL_GPIOFCR1 0xFF /* All pull-up. */
+#define VAL_GPIOFCR1 0xFF /* All pull-up/push-pull. */
#define VAL_GPIOFCR2 0
-/*
- * Port G initial setup (not present but still initialized).
- */
-#define VAL_GPIOGODR 0
-#define VAL_GPIOGDDR 0 /* All inputs. */
-#define VAL_GPIOGCR1 0xFF /* All pull-up. */
-#define VAL_GPIOGCR2 0
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/demos/STM8L-STM8L152-DISCOVERY-STVD/demo/halconf.h b/demos/STM8L-STM8L152-DISCOVERY-STVD/demo/halconf.h
index 3186be527..40bb5dbb1 100644
--- a/demos/STM8L-STM8L152-DISCOVERY-STVD/demo/halconf.h
+++ b/demos/STM8L-STM8L152-DISCOVERY-STVD/demo/halconf.h
@@ -90,7 +90,7 @@
* @brief Enables the SERIAL subsystem.
*/
#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
-#define HAL_USE_SERIAL TRUE
+#define HAL_USE_SERIAL FALSE
#endif
/**
diff --git a/demos/STM8L-STM8L152-DISCOVERY-STVD/demo/main.c b/demos/STM8L-STM8L152-DISCOVERY-STVD/demo/main.c
index 459ac2e7a..d0d7b4060 100644
--- a/demos/STM8L-STM8L152-DISCOVERY-STVD/demo/main.c
+++ b/demos/STM8L-STM8L152-DISCOVERY-STVD/demo/main.c
@@ -51,6 +51,10 @@ void main(void) {
*/
hwinit();
+ palClearPad(GPIOC, PC_LED4);
+ palSetPad(GPIOE, PE_LED3);
+ while(1);
+
/*
* OS initialization.
*/
diff --git a/demos/STM8L-STM8L152-DISCOVERY-STVD/demo/mcuconf.h b/demos/STM8L-STM8L152-DISCOVERY-STVD/demo/mcuconf.h
index d37723781..ea9759ad5 100644
--- a/demos/STM8L-STM8L152-DISCOVERY-STVD/demo/mcuconf.h
+++ b/demos/STM8L-STM8L152-DISCOVERY-STVD/demo/mcuconf.h
@@ -28,7 +28,7 @@
/*
* HAL general settings.
*/
-#define STM8L_CLOCK_INIT TRUE
+#define STM8L_NO_CLOCK_INIT TRUE
#define STM8L_HSI_ENABLED TRUE
#define STM8L_LSI_ENABLED TRUE
#define STM8L_HSE_ENABLED FALSE
diff --git a/os/hal/platforms/STM8L/hal_lld.c b/os/hal/platforms/STM8L/hal_lld.c
index 881a09fdd..5f4dacb53 100644
--- a/os/hal/platforms/STM8L/hal_lld.c
+++ b/os/hal/platforms/STM8L/hal_lld.c
@@ -49,11 +49,15 @@ ROMCONST PALConfig pal_default_config =
{VAL_GPIODODR, 0, VAL_GPIODDDR, VAL_GPIODCR1, VAL_GPIODCR2},
{VAL_GPIOEODR, 0, VAL_GPIOEDDR, VAL_GPIOECR1, VAL_GPIOECR2},
{VAL_GPIOFODR, 0, VAL_GPIOFDDR, VAL_GPIOFCR1, VAL_GPIOFCR2},
+#if STM8L_HAS_GPIOG
{VAL_GPIOGODR, 0, VAL_GPIOGDDR, VAL_GPIOGCR1, VAL_GPIOGCR2},
-#if defined(STM8L15X_MDP) || defined(STM8L15X_HD)
+#if STM8L_HAS_GPIOI
{VAL_GPIOHODR, 0, VAL_GPIOHDDR, VAL_GPIOHCR1, VAL_GPIOHCR2},
+#if STM8L_HAS_GPIOH
{VAL_GPIOIODR, 0, VAL_GPIOIDDR, VAL_GPIOICR1, VAL_GPIOICR2},
#endif
+#endif
+#endif
}
};
@@ -80,7 +84,7 @@ ROMCONST PALConfig pal_default_config =
*/
void hal_lld_init(void) {
-#if STM8L_CLOCK_INIT
+#if !STM8L_NO_CLOCK_INIT
/* Makes sure that HSI is stable before proceeding.*/
CLK->ICKCR |= CLK_ICKCR_HSION;
while ((CLK->ICKCR & CLK_ICKCR_HSIRDY) == 0)
@@ -141,7 +145,7 @@ void hal_lld_init(void) {
#if !STM8L_HSI_ENABLED
CLK->ICKCR &= ~CLK_ICKCR_HSION;
#endif
-#endif /* STM8L_CLOCK_INIT */
+#endif /* !STM8L_NO_CLOCK_INIT */
}
/** @} */
diff --git a/os/hal/platforms/STM8L/hal_lld.h b/os/hal/platforms/STM8L/hal_lld.h
index 45fcc29aa..a26e6ba84 100644
--- a/os/hal/platforms/STM8L/hal_lld.h
+++ b/os/hal/platforms/STM8L/hal_lld.h
@@ -102,10 +102,10 @@
/*===========================================================================*/
/**
- * @brief Enables the clock initialization in the HAL.
+ * @brief Disables the clock initialization in the HAL.
*/
#if !defined(STM8L_NO_CLOCK_INIT) || defined(__DOXYGEN__)
-#define STM8L_CLOCK_INIT TRUE
+#define STM8L_NO_CLOCK_INIT FALSE
#endif
/**
diff --git a/os/hal/platforms/STM8L/hal_lld_stm8l_md.h b/os/hal/platforms/STM8L/hal_lld_stm8l_md.h
index c32ec112f..f1b1e89b8 100644
--- a/os/hal/platforms/STM8L/hal_lld_stm8l_md.h
+++ b/os/hal/platforms/STM8L/hal_lld_stm8l_md.h
@@ -55,7 +55,7 @@
#define STM8L_HAS_GPIOD TRUE
#define STM8L_HAS_GPIOE TRUE
#define STM8L_HAS_GPIOF TRUE
-#define STM8L_HAS_GPIOG TRUE
+#define STM8L_HAS_GPIOG FALSE
#define STM8L_HAS_GPIOH FALSE
#define STM8L_HAS_GPIOI FALSE
diff --git a/os/hal/platforms/STM8L/pal_lld.h b/os/hal/platforms/STM8L/pal_lld.h
index 6cf2afb26..347fed85a 100644
--- a/os/hal/platforms/STM8L/pal_lld.h
+++ b/os/hal/platforms/STM8L/pal_lld.h
@@ -58,10 +58,14 @@
* or whole ports can be reprogrammed at later time.
*/
typedef struct {
-#if defined(STM8L15X_MD) || defined(__DOXYGEN__)
- GPIO_TypeDef P[7];
-#elif defined(STM8L15X_MDP) || defined(STM8L15X_HD)
+#if STM8L_HAS_GPIOI || defined(__DOXYGEN__)
GPIO_TypeDef P[9];
+#elif STM8L_HAS_GPIOH || defined(__DOXYGEN__)
+ GPIO_TypeDef P[8];
+#elif STM8L_HAS_GPIOG || defined(__DOXYGEN__)
+ GPIO_TypeDef P[7];
+#else
+ GPIO_TypeDef P[6];
#endif
} PALConfig;