From 4fc5b696fad6b10620dcd49149bf64b829e38f77 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 7 Jun 2009 10:27:48 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1019 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/ARMCM3-STM32F103-GCC/board.c | 23 +++++++++++------------ demos/ARMCM3-STM32F103-GCC/board.h | 21 ++++++--------------- demos/ARMCM3-STM32F103-GCC/main.c | 7 ++++--- 3 files changed, 21 insertions(+), 30 deletions(-) (limited to 'demos') 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 +#include #include #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 @@ -32,15 +32,6 @@ #define TRUE (!FALSE) #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. */ @@ -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 +#include #include #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); } -- cgit v1.2.3