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 | |
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
-rw-r--r-- | demos/ARMCM3-STM32F103-GCC/board.h | 12 | ||||
-rw-r--r-- | demos/ARMCM3-STM32F103-GCC/main.c | 7 | ||||
-rw-r--r-- | docs/src/main.dox | 5 | ||||
-rw-r--r-- | readme.txt | 1 |
4 files changed, 16 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);
}
diff --git a/docs/src/main.dox b/docs/src/main.dox index 6eda34beb..fee2af8e5 100644 --- a/docs/src/main.dox +++ b/docs/src/main.dox @@ -401,6 +401,11 @@ * <h3>Reading or writing on pins associated to other functionalities</h3>
* The behavior is not specified.
*
+ * <h2>Usage</h2>
+ * The use of I/O ports requires the inclusion of the header file @p ioports.h,
+ * this file is not automatically included @o ch.h like the other header
+ * files.
+ *
* @ingroup IO
*/
diff --git a/readme.txt b/readme.txt index bf22eac06..29fcab5cc 100644 --- a/readme.txt +++ b/readme.txt @@ -70,6 +70,7 @@ GNU-Linux-GCC - ChibiOS/RT simulator for x86 Linux systems, it is interface for digital I/O operations, this should help to create more
portable applications and, in general, make easier to work with ChibiOS/RT
on multiple architectures.
+- NEW: Port driver for STM32.
- Documentation section reorganization and fixes.
- Changed the STM32 demo stack sizes, it was incorrectly adjusted in version
1.3.0 but it did not create problems (not a bug).
|