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
master
gdisirio 2009-06-02 09:33:11 +00:00
parent e20aaf6c29
commit 8ada44e092
4 changed files with 16 additions and 9 deletions

View File

@ -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.

View File

@ -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);
}

View File

@ -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
*/

View File

@ -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).