diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-06-07 10:27:48 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-06-07 10:27:48 +0000 |
commit | 4fc5b696fad6b10620dcd49149bf64b829e38f77 (patch) | |
tree | 4e2509a8201057aa54fc2cb22eac8188c738c4e5 /demos | |
parent | 9659a679baf31f9890d941c4e25617a7ca70756f (diff) | |
download | ChibiOS-4fc5b696fad6b10620dcd49149bf64b829e38f77.tar.gz ChibiOS-4fc5b696fad6b10620dcd49149bf64b829e38f77.tar.bz2 ChibiOS-4fc5b696fad6b10620dcd49149bf64b829e38f77.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1019 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos')
-rw-r--r-- | demos/ARMCM3-STM32F103-GCC/board.c | 23 | ||||
-rw-r--r-- | demos/ARMCM3-STM32F103-GCC/board.h | 21 | ||||
-rw-r--r-- | demos/ARMCM3-STM32F103-GCC/main.c | 7 |
3 files changed, 21 insertions, 30 deletions
diff --git a/demos/ARMCM3-STM32F103-GCC/board.c b/demos/ARMCM3-STM32F103-GCC/board.c index 2c73879f7..52701992a 100644 --- a/demos/ARMCM3-STM32F103-GCC/board.c +++ b/demos/ARMCM3-STM32F103-GCC/board.c @@ -18,6 +18,7 @@ */
#include <ch.h>
+#include <pal.h>
#include <nvic.h>
#include "board.h"
@@ -59,23 +60,21 @@ void hwinit0(void) { ;
/*
- * I/O ports initialization as specified in board.h. Note that being this
- * a low level initialization routine it is OK to invoke directly the
- * low level port functions.
+ * I/O ports initialization as specified in board.h.
*/
- ioport_init_lld();
+ palInit();
- ioport_stm32_setup_lld(IOPORT_A, VAL_GPIOACRH, VAL_GPIOACRL);
- ioport_write_lld(IOPORT_A, VAL_GPIOAODR);
+ pal_lld_stm32_setup(IOPORT_A, VAL_GPIOACRH, VAL_GPIOACRL);
+ palWritePort(IOPORT_A, VAL_GPIOAODR);
- ioport_stm32_setup_lld(IOPORT_B, VAL_GPIOBCRH, VAL_GPIOBCRL);
- ioport_write_lld(IOPORT_B, VAL_GPIOBODR);
+ pal_lld_stm32_setup(IOPORT_B, VAL_GPIOBCRH, VAL_GPIOBCRL);
+ palWritePort(IOPORT_B, VAL_GPIOBODR);
- ioport_stm32_setup_lld(IOPORT_C, VAL_GPIOCCRH, VAL_GPIOCCRL);
- ioport_write_lld(IOPORT_C, VAL_GPIOCODR);
+ pal_lld_stm32_setup(IOPORT_C, VAL_GPIOCCRH, VAL_GPIOCCRL);
+ palWritePort(IOPORT_C, VAL_GPIOCODR);
- ioport_stm32_setup_lld(IOPORT_D, VAL_GPIODCRH, VAL_GPIODCRL);
- ioport_write_lld(IOPORT_D, VAL_GPIODODR);
+ pal_lld_stm32_setup(IOPORT_D, VAL_GPIODCRH, VAL_GPIODCRL);
+ palWritePort(IOPORT_D, VAL_GPIODODR);
}
/*
diff --git a/demos/ARMCM3-STM32F103-GCC/board.h b/demos/ARMCM3-STM32F103-GCC/board.h index 236b4787b..250b2b2d2 100644 --- a/demos/ARMCM3-STM32F103-GCC/board.h +++ b/demos/ARMCM3-STM32F103-GCC/board.h @@ -33,15 +33,6 @@ #endif
/*
- * This module requires the port driver. - */
-#ifndef _IOPORTS_LLD_H_
-#include "ioports.h"
-#endif
-
-#define BOARD_OLIMEX_STM32_P103
-
-/*
* Uncomment this if you want a 48MHz system clock, else it will be 72MHz.
*/
//#define SYSCLK_48
@@ -130,13 +121,13 @@ /*
* IO pins assignments.
*/
-#define GPIOA_BUTTON IOPORT_BIT(0)
+#define GPIOA_BUTTON 0
-#define GPIOC_MMCWP IOPORT_BIT(6)
-#define GPIOC_MMCCP IOPORT_BIT(7)
-#define GPIOC_CANCNTL IOPORT_BIT(10)
-#define GPIOC_DISC IOPORT_BIT(11)
-#define GPIOC_LED IOPORT_BIT(12)
+#define GPIOC_MMCWP 6
+#define GPIOC_MMCCP 7
+#define GPIOC_CANCNTL 10
+#define GPIOC_DISC 11
+#define GPIOC_LED 12
/*
* All inputs with pullups unless otherwise specified.
diff --git a/demos/ARMCM3-STM32F103-GCC/main.c b/demos/ARMCM3-STM32F103-GCC/main.c index 81a9af702..f89131d37 100644 --- a/demos/ARMCM3-STM32F103-GCC/main.c +++ b/demos/ARMCM3-STM32F103-GCC/main.c @@ -18,6 +18,7 @@ */
#include <ch.h>
+#include <pal.h>
#include <test.h>
#include "board.h"
@@ -30,9 +31,9 @@ static WORKING_AREA(waThread1, 128); static msg_t Thread1(void *arg) {
while (TRUE) {
- chPortClear(IOPORT_C, GPIOC_LED);
+ palClearPad(IOPORT_C, GPIOC_LED);
chThdSleepMilliseconds(500);
- chPortSet(IOPORT_C, GPIOC_LED);
+ palSetPad(IOPORT_C, GPIOC_LED);
chThdSleepMilliseconds(500);
}
return 0;
@@ -54,7 +55,7 @@ int main(int argc, char **argv) { * sleeping in a loop and check the button state.
*/
while (TRUE) {
- if (chPortRead(IOPORT_A) & GPIOA_BUTTON)
+ if (palReadPad(IOPORT_A, GPIOA_BUTTON))
TestThread(&COM2);
chThdSleepMilliseconds(500);
}
|