diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-06-02 09:33:11 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-06-02 09:33:11 +0000 |
commit | 8ada44e092e20e825b78c3d25ee016861cf886a9 (patch) | |
tree | e013e80e54c989b0fea0688f57e8aea448de207c /demos | |
parent | e20aaf6c29fc5ca91e059bbca8194c8ad7c516b9 (diff) | |
download | ChibiOS-8ada44e092e20e825b78c3d25ee016861cf886a9.tar.gz ChibiOS-8ada44e092e20e825b78c3d25ee016861cf886a9.tar.bz2 ChibiOS-8ada44e092e20e825b78c3d25ee016861cf886a9.zip |
Modified the STM32 demo to use the new I/O port driver.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1010 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos')
-rw-r--r-- | demos/ARMCM3-STM32F103-GCC/board.h | 12 | ||||
-rw-r--r-- | demos/ARMCM3-STM32F103-GCC/main.c | 7 |
2 files changed, 10 insertions, 9 deletions
diff --git a/demos/ARMCM3-STM32F103-GCC/board.h b/demos/ARMCM3-STM32F103-GCC/board.h index 680668cc2..ef1ecbdaf 100644 --- a/demos/ARMCM3-STM32F103-GCC/board.h +++ b/demos/ARMCM3-STM32F103-GCC/board.h @@ -123,13 +123,13 @@ /*
* IO pins assignments.
*/
-#define GPIOA_BUTTON (1 << 0)
+#define GPIOA_BUTTON IOPORT_BIT(0)
-#define GPIOC_MMCWP (1 << 6)
-#define GPIOC_MMCCP (1 << 7)
-#define GPIOC_CANCNTL (1 << 10)
-#define GPIOC_DISC (1 << 11)
-#define GPIOC_LED (1 << 12)
+#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)
/*
* All inputs with pullups unless otherwise specified.
diff --git a/demos/ARMCM3-STM32F103-GCC/main.c b/demos/ARMCM3-STM32F103-GCC/main.c index ec59c4ffd..01e4eaab5 100644 --- a/demos/ARMCM3-STM32F103-GCC/main.c +++ b/demos/ARMCM3-STM32F103-GCC/main.c @@ -21,6 +21,7 @@ #include <test.h>
#include "board.h"
+#include "ioports.h"
#include "stm32_serial.h"
/*
@@ -30,9 +31,9 @@ static WORKING_AREA(waThread1, 128); static msg_t Thread1(void *arg) {
while (TRUE) {
- GPIOC->BRR = GPIOC_LED;
+ chPortClear(IOPORT_C, GPIOC_LED);
chThdSleepMilliseconds(500);
- GPIOC->BSRR = GPIOC_LED;
+ chPortSet(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 (GPIOA->IDR & GPIOA_BUTTON)
+ if (chPortRead(IOPORT_A) & GPIOA_BUTTON)
TestThread(&COM2);
chThdSleepMilliseconds(500);
}
|