diff --git a/boards/fox/board.c b/boards/fox/board.c index b5388b2e75..d469c99ccd 100644 --- a/boards/fox/board.c +++ b/boards/fox/board.c @@ -46,7 +46,7 @@ static void leds_init(void) { /* green pin */ RCC->APB2ENR |= RCC_APB2ENR_IOPBEN; - LED_GREEN_PORT->CRL = (0x3 << ((LED_GREEN_PIN-8)*4)); + LED_GREEN_PORT->CR[0] = (0x3 << ((LED_GREEN_PIN-8)*4)); /* red pin */; - LED_RED_PORT->CRL = (0x3 << ((LED_RED_PIN-8)*4)); + LED_RED_PORT->CR[0] = (0x3 << ((LED_RED_PIN-8)*4)); } diff --git a/boards/fox/include/board.h b/boards/fox/include/board.h index fc12a360d2..da666a6239 100644 --- a/boards/fox/include/board.h +++ b/boards/fox/include/board.h @@ -57,10 +57,10 @@ extern "C" { * @{ */ #define AT86RF231_SPI SPI_0 -#define AT86RF231_CS GPIO_11 -#define AT86RF231_INT GPIO_12 -#define AT86RF231_RESET GPIO_13 -#define AT86RF231_SLEEP GPIO_14 +#define AT86RF231_CS GPIO(PORT_A,1) +#define AT86RF231_INT GPIO(PORT_C,2) +#define AT86RF231_RESET GPIO(PORT_C,1) +#define AT86RF231_SLEEP GPIO(PORT_A,0) /** @} */ /** @@ -77,8 +77,8 @@ extern "C" { */ #define L3G4200D_I2C I2C_0 #define L3G4200D_ADDR 0x68 -#define L3G4200D_DRDY GPIO_2 -#define L3G4200D_INT GPIO_1 +#define L3G4200D_DRDY GPIO(PORT_B,8) +#define L3G4200D_INT GPIO(PORT_B,11) /** @} */ /** @@ -88,9 +88,9 @@ extern "C" { #define LSM303DLHC_I2C I2C_0 #define LSM303DLHC_ACC_ADDR (25) #define LSM303DLHC_MAG_ADDR (30) -#define LSM303DLHC_INT1 GPIO_4 -#define LSM303DLHC_INT2 GPIO_3 -#define LSM303DLHC_DRDY GPIO_9 +#define LSM303DLHC_INT1 GPIO(PORT_B,9) +#define LSM303DLHC_INT2 GPIO(PORT_B,5) +#define LSM303DLHC_DRDY GPIO(PORT_A,9) /** @} */ /** @@ -99,8 +99,10 @@ extern "C" { */ #define LED_RED_PORT (GPIOB) #define LED_RED_PIN (10) +#define LED_RED_GPIO GPIO(PORT_B,10) #define LED_GREEN_PORT (GPIOB) #define LED_GREEN_PIN (12) +#define LED_GREEN_GPIO GPIO(PORT_B,12) /** @} */ /** diff --git a/boards/fox/include/periph_conf.h b/boards/fox/include/periph_conf.h index cd0835f3d7..c844ad2fa9 100644 --- a/boards/fox/include/periph_conf.h +++ b/boards/fox/include/periph_conf.h @@ -80,6 +80,7 @@ extern "C" { /** * @brief UART configuration + * @{ */ #define UART_NUMOF (1U) #define UART_0_EN 1 @@ -111,129 +112,8 @@ extern "C" { #define UART_1_RX_PIN 10 #define UART_1_TX_PIN 9 #define UART_1_AF 0 +/** @} */ -/** - * @brief GPIO configuration - */ -#define GPIO_0_EN 1 -#define GPIO_1_EN 1 -#define GPIO_2_EN 1 -#define GPIO_3_EN 1 -#define GPIO_4_EN 1 -#define GPIO_5_EN 1 -#define GPIO_6_EN 1 -#define GPIO_7_EN 1 -#define GPIO_8_EN 1 -#define GPIO_9_EN 1 -#define GPIO_10_EN 1 -#define GPIO_11_EN 1 -#define GPIO_12_EN 1 -#define GPIO_13_EN 1 -#define GPIO_14_EN 1 -#define GPIO_IRQ_PRIO 1 - -/* IRQ config */ -#define GPIO_IRQ_0 GPIO_7 -#define GPIO_IRQ_2 GPIO_12 -#define GPIO_IRQ_4 GPIO_6 -#define GPIO_IRQ_5 GPIO_3 -#define GPIO_IRQ_6 GPIO_5 -#define GPIO_IRQ_7 GPIO_8 -#define GPIO_IRQ_8 GPIO_2 -#define GPIO_IRQ_9 GPIO_4 -#define GPIO_IRQ_11 GPIO_1 -#define GPIO_IRQ_13 GPIO_0 - -/* GPIO channel 0 config */ -#define GPIO_0_PORT GPIOC /* user button */ -#define GPIO_0_PIN 13 -#define GPIO_0_CLKEN() (RCC->APB2ENR |= RCC_APB2ENR_IOPCEN) -#define GPIO_0_EXTI_CFG() (AFIO->EXTICR[3] |= AFIO_EXTICR4_EXTI13_PC) -#define GPIO_0_IRQ EXTI15_10_IRQn -/* GPIO channel 1 config */ -#define GPIO_1_PORT GPIOB /* l3g4200d: int1 */ -#define GPIO_1_PIN 11 -#define GPIO_1_CLKEN() (RCC->APB2ENR |= RCC_APB2ENR_IOPBEN) -#define GPIO_1_EXTI_CFG() (AFIO->EXTICR[2] |= AFIO_EXTICR3_EXTI11_PC) -#define GPIO_1_IRQ EXTI15_10_IRQn -/* GPIO channel 2 config */ -#define GPIO_2_PORT GPIOB /* l3g4200d: int2/drdy */ -#define GPIO_2_PIN 8 -#define GPIO_2_CLKEN() (RCC->APB2ENR |= RCC_APB2ENR_IOPBEN) -#define GPIO_2_EXTI_CFG() (AFIO->EXTICR[2] |= AFIO_EXTICR3_EXTI8_PB) -#define GPIO_2_IRQ EXTI9_5_IRQn -/* GPIO channel 3 config */ -#define GPIO_3_PORT GPIOB /* lsm303dlhc: accelerometer: int2 */ -#define GPIO_3_PIN 5 -#define GPIO_3_CLKEN() (RCC->APB2ENR |= RCC_APB2ENR_IOPBEN) -#define GPIO_3_EXTI_CFG() (AFIO->EXTICR[1] |= AFIO_EXTICR2_EXTI5_PB) -#define GPIO_3_IRQ EXTI9_5_IRQn -/* GPIO channel 4 config */ -#define GPIO_4_PORT GPIOB /* lsm303dlhc: accelerometer: int1*/ -#define GPIO_4_PIN 9 -#define GPIO_4_CLKEN() (RCC->APB2ENR |= RCC_APB2ENR_IOPBEN) -#define GPIO_4_EXTI_CFG() (AFIO->EXTICR[2] |= AFIO_EXTICR3_EXTI9_PB) -#define GPIO_4_IRQ EXTI9_5_IRQn -/* GPIO channel 5 config */ -#define GPIO_5_PORT GPIOC /* battery: high power */ -#define GPIO_5_PIN 6 -#define GPIO_5_CLKEN() (RCC->APB2ENR |= RCC_APB2ENR_IOPCEN) -#define GPIO_5_EXTI_CFG() (AFIO->EXTICR[1] |= AFIO_EXTICR2_EXTI6_PC) -#define GPIO_5_IRQ EXTI9_5_IRQn -/* GPIO channel 6 config */ -#define GPIO_6_PORT GPIOC /* battery: enable feedback */ -#define GPIO_6_PIN 4 -#define GPIO_6_CLKEN() (RCC->APB2ENR |= RCC_APB2ENR_IOPCEN) -#define GPIO_6_EXTI_CFG() (AFIO->EXTICR[1] |= AFIO_EXTICR2_EXTI4_PC) -#define GPIO_6_IRQ EXTI4_IRQn -/* GPIO channel 7 config */ -#define GPIO_7_PORT GPIOC /* battery: feedback */ -#define GPIO_7_PIN 0 -#define GPIO_7_CLKEN() (RCC->APB2ENR |= RCC_APB2ENR_IOPCEN) -#define GPIO_7_EXTI_CFG() (AFIO->EXTICR[0] |= AFIO_EXTICR1_EXTI0_PC) -#define GPIO_7_IRQ EXTI0_IRQn -/* GPIO channel 8 config */ -#define GPIO_8_PORT GPIOA /* extension header */ -#define GPIO_8_PIN 7 -#define GPIO_8_CLKEN() (RCC->APB2ENR |= RCC_APB2ENR_IOPAEN) -#define GPIO_8_EXTI_CFG() (AFIO->EXTICR[1] |= AFIO_EXTICR2_EXTI7_PA) -#define GPIO_8_IRQ EXTI9_5_IRQn -/* GPIO channel 9 config */ -#define GPIO_9_PORT GPIOA /* lsm303dlhc: magnetometer: drdy */ -#define GPIO_9_PIN 9 -#define GPIO_9_CLKEN() (RCC->APB2ENR |= RCC_APB2ENR_IOPAEN) -#define GPIO_9_EXTI_CFG() (AFIO->EXTICR[2] |= AFIO_EXTICR3_EXTI9_PA) -#define GPIO_9_IRQ EXTI9_5_IRQn -/* GPIO channel 10 config */ -#define GPIO_10_PORT GPIOB /* extension header, don't use as EXTI */ -#define GPIO_10_PIN 0 -#define GPIO_10_CLKEN() (RCC->APB2ENR |= RCC_APB2ENR_IOPBEN) -#define GPIO_10_EXTI_CFG() (AFIO->EXTICR[0] |= AFIO_EXTICR1_EXTI0_PB) -#define GPIO_10_IRQ EXTI0_IRQn -/* GPIO channel 11 config */ -#define GPIO_11_PORT GPIOA /* radio: cs */ -#define GPIO_11_PIN 1 -#define GPIO_11_CLKEN() (RCC->APB2ENR |= RCC_APB2ENR_IOPAEN) -#define GPIO_11_EXTI_CFG() (AFIO->EXTICR[0] |= AFIO_EXTICR1_EXTI1_PA) -#define GPIO_11_IRQ EXTI1_IRQn -/* GPIO channel 12 config */ -#define GPIO_12_PORT GPIOC /* radio: INT */ -#define GPIO_12_PIN 2 -#define GPIO_12_CLKEN() (RCC->APB2ENR |= RCC_APB2ENR_IOPCEN) -#define GPIO_12_EXTI_CFG() (AFIO->EXTICR[0] |= AFIO_EXTICR1_EXTI2_PC) -#define GPIO_12_IRQ EXTI2_IRQn -/* GPIO channel 13 config */ -#define GPIO_13_PORT GPIOC /* radio: reset */ -#define GPIO_13_PIN 1 -#define GPIO_13_CLKEN() (RCC->APB2ENR |= RCC_APB2ENR_IOPCEN) -#define GPIO_13_EXTI_CFG() (AFIO->EXTICR[0] |= AFIO_EXTICR1_EXTI1_PC) -#define GPIO_13_IRQ EXTI1_IRQn -/* GPIO channel 14 config */ -#define GPIO_14_PORT GPIOA /* radio: sleep */ -#define GPIO_14_PIN 0 -#define GPIO_14_CLKEN() (RCC->APB2ENR |= RCC_APB2ENR_IOPAEN) -#define GPIO_14_EXTI_CFG() (AFIO->EXTICR[0] |= AFIO_EXTICR1_EXTI0_PA) -#define GPIO_14_IRQ EXTI0_IRQn /** * @brief SPI configuration * @{