diff --git a/boards/f4vi1/include/periph_conf.h b/boards/f4vi1/include/periph_conf.h index 40628145751d4fad33c86ad7bc8639c0981b01d7..1cc77da0cb8db6dc217eec0bf2d2f560d9d9e338 100644 --- a/boards/f4vi1/include/periph_conf.h +++ b/boards/f4vi1/include/periph_conf.h @@ -78,28 +78,29 @@ static const timer_conf_t timer_config[] = { /** @} */ /** - * @name UART configuration + * @brief UART configuration * @{ */ static const uart_conf_t uart_config[] = { { .dev = USART6, .rcc_mask = RCC_APB2ENR_USART6EN, - .rx_pin = GPIO_PIN(PORT_C,7), - .tx_pin = GPIO_PIN(PORT_C,6), - .af = GPIO_AF8, + .rx_pin = GPIO_PIN(PORT_C, 7), + .tx_pin = GPIO_PIN(PORT_C, 6), + .rx_af = GPIO_AF8, + .tx_af = GPIO_AF8, .bus = APB2, - .irqn = USART6_IRQn, + .irqn = USART6_IRQn +#ifdef UART_USE_DMA .dma_stream = 14, .dma_chan = 5 - }, +#endif + } }; -/* assign ISR vector names */ -#define UART_0_ISR isr_usart6 -#define UART_0_DMA_ISR isr_dma2_stream6 +#define UART_0_ISR (isr_usart6) +#define UART_0_DMA_ISR (isr_dma2_stream6) -/* deduct number of defined UART interfaces */ #define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0])) /** @} */ diff --git a/boards/fox/include/periph_conf.h b/boards/fox/include/periph_conf.h index e5e15d0ec3ffe1fd01b5e2b810898766fa4825d4..5760ed53ae074142286c0d1756192677ffb8e410 100644 --- a/boards/fox/include/periph_conf.h +++ b/boards/fox/include/periph_conf.h @@ -93,25 +93,25 @@ static const timer_conf_t timer_config[] = { */ static const uart_conf_t uart_config[] = { { - .dev = USART2, - .rx_pin = GPIO_PIN(PORT_A, 3), - .tx_pin = GPIO_PIN(PORT_A, 2), - .rcc_pin = RCC_APB1ENR_USART2EN, - .bus = APB1, - .irqn = USART2_IRQn + .dev = USART2, + .rcc_mask = RCC_APB1ENR_USART2EN, + .rx_pin = GPIO_PIN(PORT_A, 3), + .tx_pin = GPIO_PIN(PORT_A, 2), + .bus = APB1, + .irqn = USART2_IRQn }, { - .dev = USART1, - .rx_pin = GPIO_PIN(PORT_A, 10), - .tx_pin = GPIO_PIN(PORT_A, 9), - .rcc_pin = RCC_APB2ENR_USART1EN, - .bus = APB2, - .irqn = USART1_IRQn + .dev = USART1, + .rcc_mask = RCC_APB2ENR_USART1EN, + .rx_pin = GPIO_PIN(PORT_A, 10), + .tx_pin = GPIO_PIN(PORT_A, 9), + .bus = APB2, + .irqn = USART1_IRQn } }; -#define UART_0_ISR isr_usart2 -#define UART_1_ISR isr_usart1 +#define UART_0_ISR (isr_usart2) +#define UART_1_ISR (isr_usart1) #define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0])) /** @} */ diff --git a/boards/iotlab-common/include/periph_conf_common.h b/boards/iotlab-common/include/periph_conf_common.h index a5a342b986a4f38be4cf7762aeb4ea7d1fd171c7..7aaf0204f4559e8650f5aa90ef2f8d344c59738b 100644 --- a/boards/iotlab-common/include/periph_conf_common.h +++ b/boards/iotlab-common/include/periph_conf_common.h @@ -94,25 +94,25 @@ static const timer_conf_t timer_config[] = { */ static const uart_conf_t uart_config[] = { { - .dev = USART1, - .rx_pin = GPIO_PIN(PORT_A, 10), - .tx_pin = GPIO_PIN(PORT_A, 9), - .rcc_pin = RCC_APB2ENR_USART1EN, - .bus = APB2, - .irqn = USART1_IRQn + .dev = USART1, + .rcc_mask = RCC_APB2ENR_USART1EN, + .rx_pin = GPIO_PIN(PORT_A, 10), + .tx_pin = GPIO_PIN(PORT_A, 9), + .bus = APB2, + .irqn = USART1_IRQn }, { - .dev = USART2, - .rx_pin = GPIO_PIN(PORT_A, 3), - .tx_pin = GPIO_PIN(PORT_A, 2), - .rcc_pin = RCC_APB1ENR_USART2EN, - .bus = APB1, - .irqn = USART2_IRQn + .dev = USART2, + .rcc_mask = RCC_APB1ENR_USART2EN, + .rx_pin = GPIO_PIN(PORT_A, 3), + .tx_pin = GPIO_PIN(PORT_A, 2), + .bus = APB1, + .irqn = USART2_IRQn } }; -#define UART_0_ISR isr_usart1 -#define UART_1_ISR isr_usart2 +#define UART_0_ISR (isr_usart1) +#define UART_1_ISR (isr_usart2) #define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0])) /** @} */ diff --git a/boards/limifrog-v1/include/periph_conf.h b/boards/limifrog-v1/include/periph_conf.h index 51b54d5cff818e6c1645f0f10d8cba8872e864b7..13e884febc8db1e19d875cfd7826aa9cab53f2da 100644 --- a/boards/limifrog-v1/include/periph_conf.h +++ b/boards/limifrog-v1/include/periph_conf.h @@ -71,37 +71,36 @@ static const timer_conf_t timer_config[] = { /** @} */ /** - * @brief UART configuration + * @brief UART configuration * @{ */ -#define UART_NUMOF (2U) -#define UART_0_EN 1 -#define UART_1_EN 1 -#define UART_IRQ_PRIO 1 - -/* UART 0 device configuration */ -#define UART_0_DEV USART3 -#define UART_0_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_USART3EN)) -#define UART_0_CLK (CLOCK_CORECLOCK) -#define UART_0_IRQ USART3_IRQn -#define UART_0_ISR isr_usart3 -#define UART_0_BUS_FREQ 32000000 -/* UART 0 pin configuration */ -#define UART_0_RX_PIN GPIO_PIN(PORT_C, 11) -#define UART_0_TX_PIN GPIO_PIN(PORT_C, 10) -#define UART_0_AF GPIO_AF7 - -/* UART 1 device configuration */ -#define UART_1_DEV USART1 /* Panasonic PAN1740 BLE module */ -#define UART_1_CLKEN() (periph_clk_en(APB2, RCC_APB2ENR_USART1EN)) -#define UART_1_CLK (CLOCK_CORECLOCK) -#define UART_1_IRQ USART1_IRQn -#define UART_1_ISR isr_usart1 -#define UART_0_BUS_FREQ 32000000 -/* UART 1 pin configuration */ -#define UART_1_RX_PIN GPIO_PIN(PORT_A, 10) -#define UART_1_TX_PIN GPIO_PIN(PORT_A, 9) -#define UART_1_AF GPIO_AF7 +static const uart_conf_t uart_config[] = { + { + .dev = USART3, + .rcc_mask = RCC_APB1ENR_USART3EN, + .rx_pin = GPIO_PIN(PORT_C, 11), + .tx_pin = GPIO_PIN(PORT_C, 10), + .rx_af = GPIO_AF7, + .tx_af = GPIO_AF7, + .bus = APB1, + .irqn = USART3_IRQn + }, + { + .dev = USART1, + .rcc_mask = RCC_APB2ENR_USART1EN, + .rx_pin = GPIO_PIN(PORT_A, 10), + .tx_pin = GPIO_PIN(PORT_A, 9), + .rx_af = GPIO_AF7, + .tx_af = GPIO_AF7, + .bus = APB2, + .irqn = USART1_IRQn + } +}; + +#define UART_0_ISR (isr_usart3) +#define UART_1_ISR (isr_usart1) + +#define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0])) /** @} */ /** diff --git a/boards/msbiot/include/periph_conf.h b/boards/msbiot/include/periph_conf.h index 7694524fb482d7d4760bb32d9788cf93df34ac6c..5c998abf61dc1e6622a205ac52fd3bbb1d37b98c 100644 --- a/boards/msbiot/include/periph_conf.h +++ b/boards/msbiot/include/periph_conf.h @@ -131,45 +131,54 @@ static const uart_conf_t uart_config[] = { { .dev = USART2, .rcc_mask = RCC_APB1ENR_USART2EN, - .rx_pin = GPIO_PIN(PORT_A,3), - .tx_pin = GPIO_PIN(PORT_A,2), - .af = GPIO_AF7, + .rx_pin = GPIO_PIN(PORT_A, 3), + .tx_pin = GPIO_PIN(PORT_A, 2), + .rx_af = GPIO_AF7, + .tx_af = GPIO_AF7, .bus = APB1, .irqn = USART2_IRQn, +#ifdef UART_USE_DMA .dma_stream = 6, .dma_chan = 4 +#endif }, { .dev = USART1, .rcc_mask = RCC_APB2ENR_USART1EN, - .rx_pin = GPIO_PIN(PORT_A,10), - .tx_pin = GPIO_PIN(PORT_A,9), - .af = GPIO_AF7, + .rx_pin = GPIO_PIN(PORT_A, 10), + .tx_pin = GPIO_PIN(PORT_A, 9), + .rx_af = GPIO_AF7, + .tx_af = GPIO_AF7, .bus = APB2, .irqn = USART1_IRQn, +#ifdef UART_USE_DMA .dma_stream = 15, .dma_chan = 4 +#endif }, { .dev = USART3, .rcc_mask = RCC_APB1ENR_USART3EN, - .rx_pin = GPIO_PIN(PORT_D,9), - .tx_pin = GPIO_PIN(PORT_D,8), - .af = GPIO_AF7, + .rx_pin = GPIO_PIN(PORT_D, 9), + .tx_pin = GPIO_PIN(PORT_D, 8), + .rx_af = GPIO_AF7, + .tx_af = GPIO_AF7, .bus = APB1, .irqn = USART3_IRQn, +#ifdef UART_USE_DMA .dma_stream = 3, .dma_chan = 4 +#endif }, }; /* assign ISR vector names */ -#define UART_0_ISR isr_usart2 -#define UART_0_DMA_ISR isr_dma1_stream6 -#define UART_1_ISR isr_usart1 -#define UART_1_DMA_ISR isr_dma2_stream7 -#define UART_2_ISR isr_usart3 -#define UART_2_DMA_ISR isr_dma1_stream3 +#define UART_0_ISR (isr_usart2) +#define UART_0_DMA_ISR (isr_dma1_stream6) +#define UART_1_ISR (isr_usart1) +#define UART_1_DMA_ISR (isr_dma2_stream7) +#define UART_2_ISR (isr_usart3) +#define UART_2_DMA_ISR (isr_dma1_stream3) /* deduct number of defined UART interfaces */ #define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0])) diff --git a/boards/nucleo-f030/include/periph_conf.h b/boards/nucleo-f030/include/periph_conf.h index 1d47d945d84064b611e72b442bad81a6076b9c8e..f8a807625445463489514a97ad4aa14ef9dd10aa 100644 --- a/boards/nucleo-f030/include/periph_conf.h +++ b/boards/nucleo-f030/include/periph_conf.h @@ -63,41 +63,37 @@ static const timer_conf_t timer_config[] = { /** @} */ /** - * @brief UART configuration - * @} + * @brief UART configuration + * @{ */ -#define UART_NUMOF (2U) -#define UART_0_EN 1 -#define UART_1_EN 1 -#define UART_IRQ_PRIO 1 - -/* UART 0 device configuration */ -#define UART_0_DEV USART2 -#define UART_0_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_USART2EN)) -#define UART_0_CLKDIS() (periph_clk_dis(APB1, RCC_APB1ENR_USART2EN)) -#define UART_0_IRQ USART2_IRQn -#define UART_0_ISR isr_usart2 -/* UART 0 pin configuration */ -#define UART_0_PORT GPIOA -#define UART_0_PORT_CLKEN() (periph_clk_en(AHB, RCC_AHBENR_GPIOAEN)) -#define UART_0_RX_PIN 3 -#define UART_0_TX_PIN 2 -#define UART_0_AF 1 - -/* UART 1 device configuration */ -#define UART_1_DEV USART1 -#define UART_1_CLKEN() (periph_clk_en(APB2, RCC_APB2ENR_USART1EN)) -#define UART_1_CLKDIS() (periph_clk_dis(APB2, RCC_APB2ENR_USART1EN)) -#define UART_1_IRQ USART1_IRQn -#define UART_1_ISR isr_usart1 -/* UART 1 pin configuration */ -#define UART_1_PORT GPIOB -#define UART_1_PORT_CLKEN() (periph_clk_en(AHB, RCC_AHBENR_GPIOBEN)) -#define UART_1_RX_PIN 7 -#define UART_1_TX_PIN 6 -#define UART_1_AF 0 -/** @} */ +static const uart_conf_t uart_config[] = { + { + .dev = USART2, + .rcc_mask = RCC_APB1ENR_USART2EN, + .rx_pin = GPIO_PIN(PORT_A, 3), + .tx_pin = GPIO_PIN(PORT_A, 2), + .rx_af = GPIO_AF1, + .tx_af = GPIO_AF1, + .bus = APB1, + .irqn = USART2_IRQn + }, + { + .dev = USART1, + .rcc_mask = RCC_APB2ENR_USART1EN, + .rx_pin = GPIO_PIN(PORT_B, 7), + .tx_pin = GPIO_PIN(PORT_B, 6), + .rx_af = GPIO_AF0, + .tx_af = GPIO_AF0, + .bus = APB2, + .irqn = USART1_IRQn + } +}; +#define UART_0_ISR (isr_usart2) +#define UART_1_ISR (isr_usart1) + +#define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0])) +/** @} */ /** * @brief ADC configuration diff --git a/boards/nucleo-f070/include/periph_conf.h b/boards/nucleo-f070/include/periph_conf.h index 5f1fc905b45845d2ef7ee55fbd1c73d49f9abf9e..a6775d15e298e8b23583e5eb8c3674552095b50b 100644 --- a/boards/nucleo-f070/include/periph_conf.h +++ b/boards/nucleo-f070/include/periph_conf.h @@ -63,41 +63,37 @@ static const timer_conf_t timer_config[] = { /** @} */ /** - * @brief UART configuration - * @} + * @brief UART configuration + * @{ */ -#define UART_NUMOF (2U) -#define UART_0_EN 1 -#define UART_1_EN 1 -#define UART_IRQ_PRIO 1 - -/* UART 0 device configuration */ -#define UART_0_DEV USART2 -#define UART_0_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_USART2EN)) -#define UART_0_CLKDIS() (periph_clk_dis(APB1, RCC_APB1ENR_USART2EN)) -#define UART_0_IRQ USART2_IRQn -#define UART_0_ISR isr_usart2 -/* UART 0 pin configuration */ -#define UART_0_PORT GPIOA -#define UART_0_PORT_CLKEN() (periph_clk_en(AHB, RCC_AHBENR_GPIOAEN)) -#define UART_0_RX_PIN 3 -#define UART_0_TX_PIN 2 -#define UART_0_AF 1 - -/* UART 1 device configuration */ -#define UART_1_DEV USART3 -#define UART_1_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_USART3EN)) -#define UART_1_CLKDIS() (periph_clk_dis(APB1, RCC_APB1ENR_USART3EN)) -#define UART_1_IRQ USART3_4_IRQn -#define UART_1_ISR isr_usart3_8 -/* UART 1 pin configuration */ -#define UART_1_PORT GPIOC -#define UART_1_PORT_CLKEN() (periph_clk_en(AHB, RCC_AHBENR_GPIOCEN)) -#define UART_1_RX_PIN 11 -#define UART_1_TX_PIN 10 -#define UART_1_AF 1 -/** @} */ +static const uart_conf_t uart_config[] = { + { + .dev = USART2, + .rcc_mask = RCC_APB1ENR_USART2EN, + .rx_pin = GPIO_PIN(PORT_A, 3), + .tx_pin = GPIO_PIN(PORT_A, 2), + .rx_af = GPIO_AF1, + .tx_af = GPIO_AF1, + .bus = APB1, + .irqn = USART2_IRQn + }, + { + .dev = USART3, + .rcc_mask = RCC_APB1ENR_USART3EN, + .rx_pin = GPIO_PIN(PORT_C, 11), + .tx_pin = GPIO_PIN(PORT_C, 10), + .rx_af = GPIO_AF1, + .tx_af = GPIO_AF1, + .bus = APB1, + .irqn = USART3_4_IRQn + } +}; +#define UART_0_ISR (isr_usart2) +#define UART_1_ISR (isr_usart3_8) + +#define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0])) +/** @} */ /** * @brief ADC configuration diff --git a/boards/nucleo-f072/include/periph_conf.h b/boards/nucleo-f072/include/periph_conf.h index 79e29c96ab471db60fe36efdcbf050a194e975de..8b704dc51f798ca0041d70bd4eed65bbdaf4b121 100644 --- a/boards/nucleo-f072/include/periph_conf.h +++ b/boards/nucleo-f072/include/periph_conf.h @@ -62,41 +62,37 @@ static const timer_conf_t timer_config[] = { /** @} */ /** - * @brief UART configuration - * @} + * @brief UART configuration + * @{ */ -#define UART_NUMOF (2U) -#define UART_0_EN 1 -#define UART_1_EN 1 -#define UART_IRQ_PRIO 1 - -/* UART 0 device configuration */ -#define UART_0_DEV USART2 -#define UART_0_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_USART2EN)) -#define UART_0_CLKDIS() (periph_clk_dis(APB1, RCC_APB1ENR_USART2EN)) -#define UART_0_IRQ USART2_IRQn -#define UART_0_ISR isr_usart2 -/* UART 0 pin configuration */ -#define UART_0_PORT GPIOA -#define UART_0_PORT_CLKEN() (periph_clk_en(AHB, RCC_AHBENR_GPIOAEN)) -#define UART_0_RX_PIN 3 -#define UART_0_TX_PIN 2 -#define UART_0_AF 1 - -/* UART 1 device configuration */ -#define UART_1_DEV USART1 -#define UART_1_CLKEN() (periph_clk_en(APB2, RCC_APB2ENR_USART1EN)) -#define UART_1_CLKDIS() (periph_clk_dis(APB2, RCC_APB2ENR_USART1EN)) -#define UART_1_IRQ USART1_IRQn -#define UART_1_ISR isr_usart1 -/* UART 1 pin configuration */ -#define UART_1_PORT GPIOB -#define UART_1_PORT_CLKEN() (periph_clk_en(AHB, RCC_AHBENR_GPIOBEN)) -#define UART_1_RX_PIN 7 -#define UART_1_TX_PIN 6 -#define UART_1_AF 0 -/** @} */ +static const uart_conf_t uart_config[] = { + { + .dev = USART2, + .rcc_mask = RCC_APB1ENR_USART2EN, + .rx_pin = GPIO_PIN(PORT_A, 3), + .tx_pin = GPIO_PIN(PORT_A, 2), + .rx_af = GPIO_AF1, + .tx_af = GPIO_AF1, + .bus = APB1, + .irqn = USART2_IRQn + }, + { + .dev = USART1, + .rcc_mask = RCC_APB2ENR_USART1EN, + .rx_pin = GPIO_PIN(PORT_B, 7), + .tx_pin = GPIO_PIN(PORT_B, 6), + .rx_af = GPIO_AF0, + .tx_af = GPIO_AF0, + .bus = APB2, + .irqn = USART1_IRQn + } +}; +#define UART_0_ISR (isr_usart2) +#define UART_1_ISR (isr_usart1) + +#define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0])) +/** @} */ /** * @brief ADC configuration diff --git a/boards/nucleo-f091/include/periph_conf.h b/boards/nucleo-f091/include/periph_conf.h index 73a6ee37c758149529631c061a8ec7f9b2e6bdb3..d0c3545d3d529491ef9a2fdf6bdfbf0d2724e9ec 100644 --- a/boards/nucleo-f091/include/periph_conf.h +++ b/boards/nucleo-f091/include/periph_conf.h @@ -61,39 +61,36 @@ static const timer_conf_t timer_config[] = { /** @} */ /** - * @brief UART configuration - * @} + * @brief UART configuration + * @{ */ -#define UART_NUMOF (2U) -#define UART_0_EN 1 -#define UART_1_EN 1 -#define UART_IRQ_PRIO 1 - -/* UART 0 device configuration */ -#define UART_0_DEV USART2 -#define UART_0_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_USART2EN)) -#define UART_0_CLKDIS() (periph_clk_dis(APB1, RCC_APB1ENR_USART2EN)) -#define UART_0_IRQ USART2_IRQn -#define UART_0_ISR isr_usart2 -/* UART 0 pin configuration */ -#define UART_0_PORT GPIOA -#define UART_0_PORT_CLKEN() (periph_clk_en(AHB, RCC_AHBENR_GPIOAEN)) -#define UART_0_RX_PIN 3 -#define UART_0_TX_PIN 2 -#define UART_0_AF 1 - -/* UART 1 device configuration */ -#define UART_1_DEV USART1 -#define UART_1_CLKEN() (periph_clk_en(APB2, RCC_APB2ENR_USART1EN)) -#define UART_1_CLKDIS() (periph_clk_dis(APB2, RCC_APB2ENR_USART1EN)) -#define UART_1_IRQ USART1_IRQn -#define UART_1_ISR isr_usart1 -/* UART 1 pin configuration */ -#define UART_1_PORT GPIOB -#define UART_1_PORT_CLKEN() (periph_clk_en(AHB, RCC_AHBENR_GPIOBEN)) -#define UART_1_RX_PIN 7 -#define UART_1_TX_PIN 6 -#define UART_1_AF 0 +static const uart_conf_t uart_config[] = { + { + .dev = USART2, + .rcc_mask = RCC_APB1ENR_USART2EN, + .rx_pin = GPIO_PIN(PORT_A, 3), + .tx_pin = GPIO_PIN(PORT_A, 2), + .rx_af = GPIO_AF1, + .tx_af = GPIO_AF1, + .bus = APB1, + .irqn = USART2_IRQn + }, + { + .dev = USART1, + .rcc_mask = RCC_APB2ENR_USART1EN, + .rx_pin = GPIO_PIN(PORT_B, 7), + .tx_pin = GPIO_PIN(PORT_B, 6), + .rx_af = GPIO_AF0, + .tx_af = GPIO_AF0, + .bus = APB2, + .irqn = USART1_IRQn + } +}; + +#define UART_0_ISR (isr_usart2) +#define UART_1_ISR (isr_usart1) + +#define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0])) /** @} */ /** diff --git a/boards/nucleo-f103/include/periph_conf.h b/boards/nucleo-f103/include/periph_conf.h index c3e40472b4d119cde7483660f4383864ce903c52..fb59e397160eb866d224e02b1c33f63ac91737f7 100644 --- a/boards/nucleo-f103/include/periph_conf.h +++ b/boards/nucleo-f103/include/periph_conf.h @@ -90,39 +90,39 @@ static const timer_conf_t timer_config[] = { /** @} */ /** - * @brief UART configuration + * @brief UART configuration * @{ */ static const uart_conf_t uart_config[] = { { - .dev = USART2, - .rx_pin = GPIO_PIN(PORT_A, 3), - .tx_pin = GPIO_PIN(PORT_A, 2), - .rcc_pin = RCC_APB1ENR_USART2EN, - .bus = APB1, - .irqn = USART2_IRQn + .dev = USART2, + .rcc_mask = RCC_APB1ENR_USART2EN, + .rx_pin = GPIO_PIN(PORT_A, 3), + .tx_pin = GPIO_PIN(PORT_A, 2), + .bus = APB1, + .irqn = USART2_IRQn }, { - .dev = USART1, - .rx_pin = GPIO_PIN(PORT_A, 10), - .tx_pin = GPIO_PIN(PORT_A, 9), - .rcc_pin = RCC_APB2ENR_USART1EN, - .bus = APB2, - .irqn = USART1_IRQn + .dev = USART1, + .rcc_mask = RCC_APB2ENR_USART1EN, + .rx_pin = GPIO_PIN(PORT_A, 10), + .tx_pin = GPIO_PIN(PORT_A, 9), + .bus = APB2, + .irqn = USART1_IRQn }, { - .dev = USART3, - .rx_pin = GPIO_PIN(PORT_B, 11), - .tx_pin = GPIO_PIN(PORT_B, 10), - .rcc_pin = RCC_APB1ENR_USART3EN, - .bus = APB1, - .irqn = USART3_IRQn + .dev = USART3, + .rcc_mask = RCC_APB1ENR_USART3EN, + .rx_pin = GPIO_PIN(PORT_B, 11), + .tx_pin = GPIO_PIN(PORT_B, 10), + .bus = APB1, + .irqn = USART3_IRQn } }; -#define UART_0_ISR isr_usart2 -#define UART_1_ISR isr_usart1 -#define UART_2_ISR isr_usart3 +#define UART_0_ISR (isr_usart2) +#define UART_1_ISR (isr_usart1) +#define UART_2_ISR (isr_usart3) #define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0])) /** @} */ diff --git a/boards/nucleo-f207/include/periph_conf.h b/boards/nucleo-f207/include/periph_conf.h index d9d6e10f74244992fe1a10ca599b634e3897c909..056872f9a573d6e7a640a5a3db75ec127c200b8b 100644 --- a/boards/nucleo-f207/include/periph_conf.h +++ b/boards/nucleo-f207/include/periph_conf.h @@ -104,76 +104,64 @@ static const timer_conf_t timer_config[] = { #define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) /** @} */ - /** * @brief UART configuration * @{ */ static const uart_conf_t uart_config[] = { - { - .dev = USART3, - .rcc_mask = RCC_APB1ENR_USART3EN, - .rx_pin = GPIO_PIN(PORT_D, 9), - .tx_pin = GPIO_PIN(PORT_D, 8), - .rx_mode = GPIO_IN, - .tx_mode = GPIO_OUT, - .rts_pin = GPIO_PIN(PORT_D, 12), - .cts_pin = GPIO_PIN(PORT_D, 11), - .rts_mode = GPIO_OUT, - .cts_mode = GPIO_IN, - .af = GPIO_AF7, - .irqn = USART3_IRQn, - .dma_stream = 3, - .dma_chan = 4, - .hw_flow_ctrl = 0 + { + .dev = USART3, + .rcc_mask = RCC_APB1ENR_USART3EN, + .rx_pin = GPIO_PIN(PORT_D, 9), + .tx_pin = GPIO_PIN(PORT_D, 8), + .rx_af = GPIO_AF7, + .tx_af = GPIO_AF7, + .bus = APB1, + .irqn = USART3_IRQn, +#ifdef UART_USE_DMA + .dma_stream = 3, + .dma_chan = 4 +#endif }, { - .dev = USART2, - .rcc_mask = RCC_APB1ENR_USART2EN, - .rx_pin = GPIO_PIN(PORT_D, 6), - .tx_pin = GPIO_PIN(PORT_D, 5), - .rx_mode = GPIO_IN, - .tx_mode = GPIO_OUT, - .rts_pin = GPIO_PIN(PORT_D, 4), - .cts_pin = GPIO_PIN(PORT_D, 3), - .rts_mode = GPIO_OUT, - .cts_mode = GPIO_IN, - .af = GPIO_AF7, - .irqn = USART2_IRQn, - .dma_stream = 6, - .dma_chan = 4, - .hw_flow_ctrl = 1 + .dev = USART2, + .rcc_mask = RCC_APB1ENR_USART2EN, + .rx_pin = GPIO_PIN(PORT_D, 6), + .tx_pin = GPIO_PIN(PORT_D, 5), + .rx_af = GPIO_AF7, + .tx_af = GPIO_AF7, + .bus = APB1, + .irqn = USART2_IRQn, +#ifdef UART_USE_DMA + .dma_stream = 6, + .dma_chan = 4 +#endif }, { - .dev = USART1, - .rcc_mask = RCC_APB2ENR_USART1EN, - .rx_pin = GPIO_PIN(PORT_A, 10), - .tx_pin = GPIO_PIN(PORT_A, 9), - .rx_mode = GPIO_IN, - .tx_mode = GPIO_OUT, - .rts_pin = GPIO_PIN(PORT_A, 12), - .cts_pin = GPIO_PIN(PORT_A, 11), - .rts_mode = GPIO_OUT, - .cts_mode = GPIO_IN, - .af = GPIO_AF7, - .irqn = USART1_IRQn, - .dma_stream = 7, - .dma_chan = 4, - .hw_flow_ctrl = 1 + .dev = USART1, + .rcc_mask = RCC_APB2ENR_USART1EN, + .rx_pin = GPIO_PIN(PORT_A, 10), + .tx_pin = GPIO_PIN(PORT_A, 9), + .rx_af = GPIO_AF7, + .tx_af = GPIO_AF7, + .bus = APB2, + .irqn = USART1_IRQn, +#ifdef UART_USE_DMA + .dma_stream = 7, + .dma_chan = 4 +#endif } }; -/* assign ISR vector names */ -#define UART_0_ISR isr_usart3 -#define UART_0_DMA_ISR isr_dma1_stream3 +#define UART_0_ISR (isr_usart3) +#define UART_0_DMA_ISR (isr_dma1_stream3) -#define UART_1_ISR isr_usart2 -#define UART_1_DMA_ISR isr_dma1_stream6 +#define UART_1_ISR (isr_usart2) +#define UART_1_DMA_ISR (isr_dma1_stream6) -#define UART_2_ISR isr_usart1 -#define UART_2_DMA_ISR isr_dma1_stream7 +#define UART_2_ISR (isr_usart1) +#define UART_2_DMA_ISR (isr_dma1_stream7) -/* deduct number of defined UART interfaces */ #define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0])) /** @} */ diff --git a/boards/nucleo-f303/include/periph_conf.h b/boards/nucleo-f303/include/periph_conf.h index 4da4b8449ed82c10574941a378ef001950f3d0ff..72cf1cacb144688b9fe2575bbd8adcee7bc3d4ec 100755 --- a/boards/nucleo-f303/include/periph_conf.h +++ b/boards/nucleo-f303/include/periph_conf.h @@ -74,53 +74,47 @@ static const timer_conf_t timer_config[] = { /** @} */ /** - * @brief UART configuration + * @brief UART configuration * @{ */ -#define UART_NUMOF (3U) -#define UART_0_EN 1 -#define UART_1_EN 1 -#define UART_2_EN 1 -#define UART_IRQ_PRIO 1 - -/* UART 0 device configuration */ -#define UART_0_DEV USART2 -#define UART_0_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_USART2EN)) -#define UART_0_CLK (CLOCK_CORECLOCK / 2) /* UART clock runs with 36MHz (F_CPU / 2) */ -#define UART_0_IRQ_CHAN USART2_IRQn -#define UART_0_ISR isr_usart2 -/* UART 0 pin configuration */ -#define UART_0_PORT_CLKEN() (periph_clk_en(AHB, RCC_AHBENR_GPIOAEN)) -#define UART_0_PORT GPIOA -#define UART_0_TX_PIN 2 -#define UART_0_RX_PIN 3 -#define UART_0_AF 7 - -/* UART 1 device configuration */ -#define UART_1_DEV USART1 -#define UART_1_CLKEN() (periph_clk_en(APB2, RCC_APB2ENR_USART1EN)) -#define UART_1_CLK (CLOCK_CORECLOCK / 1) /* UART clock runs with 72MHz (F_CPU / 1) */ -#define UART_1_IRQ_CHAN USART1_IRQn -#define UART_1_ISR isr_usart1 -/* UART 1 pin configuration */ -#define UART_1_PORT_CLKEN() (periph_clk_en(AHB, RCC_AHBENR_GPIOAEN)) -#define UART_1_PORT GPIOA -#define UART_1_TX_PIN 9 -#define UART_1_RX_PIN 10 -#define UART_1_AF 7 - -/* UART 2 device configuration */ -#define UART_2_DEV USART3 -#define UART_2_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_USART3EN)) -#define UART_2_CLK (CLOCK_CORECLOCK / 2) /* UART clock runs with 36MHz (F_CPU / 2) */ -#define UART_2_IRQ_CHAN USART3_IRQn -#define UART_2_ISR isr_usart3 -/* UART 2 pin configuration */ -#define UART_2_PORT_CLKEN() (periph_clk_en(AHB, RCC_AHBENR_GPIOBEN)) -#define UART_2_PORT GPIOB -#define UART_2_TX_PIN 10 -#define UART_2_RX_PIN 11 -#define UART_2_AF 7 +static const uart_conf_t uart_config[] = { + { + .dev = USART2, + .rcc_mask = RCC_APB1ENR_USART2EN, + .rx_pin = GPIO_PIN(PORT_A, 3), + .tx_pin = GPIO_PIN(PORT_A, 2), + .rx_af = GPIO_AF7, + .tx_af = GPIO_AF7, + .bus = APB1, + .irqn = USART2_IRQn + }, + { + .dev = USART1, + .rcc_mask = RCC_APB2ENR_USART1EN, + .rx_pin = GPIO_PIN(PORT_A, 10), + .tx_pin = GPIO_PIN(PORT_A, 9), + .rx_af = GPIO_AF7, + .tx_af = GPIO_AF7, + .bus = APB2, + .irqn = USART1_IRQn + }, + { + .dev = USART3, + .rcc_mask = RCC_APB1ENR_USART3EN, + .rx_pin = GPIO_PIN(PORT_B, 11), + .tx_pin = GPIO_PIN(PORT_B, 10), + .rx_af = GPIO_AF7, + .tx_af = GPIO_AF7, + .bus = APB1, + .irqn = USART3_IRQn + } +}; + +#define UART_0_ISR (isr_usart2) +#define UART_1_ISR (isr_usart1) +#define UART_2_ISR (isr_usart3) + +#define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0])) /** @} */ /** diff --git a/boards/nucleo-f334/include/periph_conf.h b/boards/nucleo-f334/include/periph_conf.h index 11e1b39285ae6b1ad56dc525e571ae010dc48d00..99bf7e87aa2169d8ef06e7e9166bf51eaf054cc4 100644 --- a/boards/nucleo-f334/include/periph_conf.h +++ b/boards/nucleo-f334/include/periph_conf.h @@ -80,25 +80,25 @@ static const timer_conf_t timer_config[] = { /** @} */ /** - * @brief UART configuration - * @} + * @brief UART configuration + * @{ */ -#define UART_NUMOF (1U) -#define UART_0_EN 1 -#define UART_IRQ_PRIO 1 - -/* UART 0 device configuration */ -#define UART_0_DEV USART2 -#define UART_0_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_USART2EN)) -#define UART_0_CLK (CLOCK_CORECLOCK / 2) /* UART clock runs with 32MHz (F_CPU / 1) */ -#define UART_0_IRQ_CHAN USART2_IRQn -#define UART_0_ISR isr_usart2 -/* UART 0 pin configuration */ -#define UART_0_PORT GPIOA -#define UART_0_PORT_CLKEN() (periph_clk_en(AHB, RCC_AHBENR_GPIOAEN)) -#define UART_0_RX_PIN 3 -#define UART_0_TX_PIN 2 -#define UART_0_AF 7 +static const uart_conf_t uart_config[] = { + { + .dev = USART2, + .rcc_mask = RCC_APB1ENR_USART2EN, + .rx_pin = GPIO_PIN(PORT_A, 3), + .tx_pin = GPIO_PIN(PORT_A, 2), + .rx_af = GPIO_AF7, + .tx_af = GPIO_AF7, + .bus = APB1, + .irqn = USART2_IRQn + } +}; + +#define UART_0_ISR (isr_usart2) + +#define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0])) /** @} */ /** diff --git a/boards/nucleo-f401/include/periph_conf.h b/boards/nucleo-f401/include/periph_conf.h index 4bb04c00d01369869fc0ec9b53508f53eec24af8..6f8608a39482dbd1aeb373323c87c7e0cd773fd7 100644 --- a/boards/nucleo-f401/include/periph_conf.h +++ b/boards/nucleo-f401/include/periph_conf.h @@ -83,21 +83,22 @@ static const uart_conf_t uart_config[] = { { .dev = USART2, .rcc_mask = RCC_APB1ENR_USART2EN, - .rx_pin = GPIO_PIN(PORT_A,3), - .tx_pin = GPIO_PIN(PORT_A,2), - .af = GPIO_AF7, + .rx_pin = GPIO_PIN(PORT_A, 3), + .tx_pin = GPIO_PIN(PORT_A, 2), + .rx_af = GPIO_AF7, + .tx_af = GPIO_AF7, .bus = APB1, .irqn = USART2_IRQn, +#ifdef UART_USE_DMA .dma_stream = 6, .dma_chan = 4 +#endif } }; -/* assign ISR vector names */ -#define UART_0_ISR isr_usart2 -#define UART_0_DMA_ISR isr_dma1_stream6 +#define UART_0_ISR (isr_usart2) +#define UART_0_DMA_ISR (isr_dma1_stream6) -/* deduct number of defined UART interfaces */ #define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0])) /** @} */ diff --git a/boards/nucleo-f446/include/periph_conf.h b/boards/nucleo-f446/include/periph_conf.h index e44c4e2f3ff1f079fb3d9d63a3e59c29819a1cb7..21670decc67dfd6eb326b0c270556c5ecd706ad0 100644 --- a/boards/nucleo-f446/include/periph_conf.h +++ b/boards/nucleo-f446/include/periph_conf.h @@ -83,21 +83,22 @@ static const uart_conf_t uart_config[] = { { .dev = USART2, .rcc_mask = RCC_APB1ENR_USART2EN, - .rx_pin = GPIO_PIN(PORT_A,3), - .tx_pin = GPIO_PIN(PORT_A,2), - .af = GPIO_AF7, + .rx_pin = GPIO_PIN(PORT_A, 3), + .tx_pin = GPIO_PIN(PORT_A, 2), + .rx_af = GPIO_AF7, + .tx_af = GPIO_AF7, .bus = APB1, .irqn = USART2_IRQn, +#ifdef UART_USE_DMA .dma_stream = 6, .dma_chan = 4 +#endif } }; -/* assign ISR vector names */ -#define UART_0_ISR isr_usart2 -#define UART_0_DMA_ISR isr_dma1_stream6 +#define UART_0_ISR (isr_usart2) +#define UART_0_DMA_ISR (isr_dma1_stream6) -/* deduct number of defined UART interfaces */ #define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0])) /** @} */ diff --git a/boards/nucleo-l1/include/periph_conf.h b/boards/nucleo-l1/include/periph_conf.h index 77540afc495b773bb5561fb3eb434a2ac0e8260f..e9e7ceaf24a55339ea4a6912c517052e0a0ec71e 100644 --- a/boards/nucleo-l1/include/periph_conf.h +++ b/boards/nucleo-l1/include/periph_conf.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 Freie Universität Berlin + * Copyright (C) 2014-2016 Freie Universität Berlin * * This file is subject to the terms and conditions of the GNU Lesser General * Public License v2.1. See the file LICENSE in the top level directory for more @@ -14,6 +14,7 @@ * @brief Peripheral MCU configuration for the nucleo-l1 board * * @author Thomas Eichinger <thomas.eichinger@fu-berlin.de> + * @author Hauke Petersen <hauke.petersen@fu-berlin.de> */ #ifndef PERIPH_CONF_H_ @@ -81,23 +82,26 @@ static const timer_conf_t timer_config[] = { #define RTC_NUMOF (1U) /** - * @brief UART configuration + * @brief UART configuration + * @{ */ -#define UART_NUMOF (1U) -#define UART_0_EN 1 -#define UART_IRQ_PRIO 1 - -/* UART 0 device configuration */ -#define UART_0_DEV USART2 -#define UART_0_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_USART2EN)) -#define UART_0_CLK (CLOCK_CORECLOCK) /* UART clock runs with 32MHz (F_CPU / 1) */ -#define UART_0_IRQ USART2_IRQn -#define UART_0_ISR isr_usart2 -#define UART_0_BUS_FREQ 32000000 -/* UART 0 pin configuration */ -#define UART_0_RX_PIN GPIO_PIN(PORT_A, 3) -#define UART_0_TX_PIN GPIO_PIN(PORT_A, 2) -#define UART_0_AF GPIO_AF7 +static const uart_conf_t uart_config[] = { + { + .dev = USART2, + .rcc_mask = RCC_APB1ENR_USART2EN, + .rx_pin = GPIO_PIN(PORT_A, 3), + .tx_pin = GPIO_PIN(PORT_A, 2), + .rx_af = GPIO_AF7, + .tx_af = GPIO_AF7, + .bus = APB1, + .irqn = USART2_IRQn + } +}; + +#define UART_0_ISR (isr_usart2) + +#define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0])) +/** @} */ /** * @brief SPI configuration diff --git a/boards/spark-core/include/periph_conf.h b/boards/spark-core/include/periph_conf.h index 83e2a641b347877559a6dc34f1bff4d1c4baf16b..7af812681cf687c4b93ab6d3917245cbbd508371 100644 --- a/boards/spark-core/include/periph_conf.h +++ b/boards/spark-core/include/periph_conf.h @@ -88,21 +88,21 @@ static const timer_conf_t timer_config[] = { /** @} */ /** - * @brief UART configuration + * @brief UART configuration * @{ */ static const uart_conf_t uart_config[] = { { - .dev = USART2, - .rx_pin = GPIO_PIN(PORT_A, 3), - .tx_pin = GPIO_PIN(PORT_A, 2), - .rcc_pin = RCC_APB1ENR_USART2EN, - .bus = APB1, - .irqn = USART2_IRQn + .dev = USART2, + .rcc_mask = RCC_APB1ENR_USART2EN, + .rx_pin = GPIO_PIN(PORT_A, 3), + .tx_pin = GPIO_PIN(PORT_A, 2), + .bus = APB1, + .irqn = USART2_IRQn } }; -#define UART_0_ISR isr_usart2 +#define UART_0_ISR (isr_usart2) #define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0])) /** @} */ diff --git a/boards/stm32f0discovery/include/periph_conf.h b/boards/stm32f0discovery/include/periph_conf.h index 775fec08d1106cbaff330d02fd7d2aa4e6156207..045913fb8629e6f3b6b1a869bff99b4b2d7b1587 100644 --- a/boards/stm32f0discovery/include/periph_conf.h +++ b/boards/stm32f0discovery/include/periph_conf.h @@ -61,39 +61,36 @@ static const timer_conf_t timer_config[] = { /** @} */ /** - * @name UART configuration + * @brief UART configuration * @{ */ -#define UART_NUMOF (2U) -#define UART_0_EN 1 -#define UART_1_EN 1 -#define UART_IRQ_PRIO 1 - -/* UART 0 device configuration */ -#define UART_0_DEV USART1 -#define UART_0_CLKEN() (periph_clk_en(APB2, RCC_APB2ENR_USART1EN)) -#define UART_0_CLKDIS() (periph_clk_dis(APB2, RCC_APB2ENR_USART1EN)) -#define UART_0_IRQ USART1_IRQn -#define UART_0_ISR isr_usart1 -/* UART 0 pin configuration */ -#define UART_0_PORT GPIOB -#define UART_0_PORT_CLKEN() (periph_clk_en(AHB, RCC_AHBENR_GPIOBEN)) -#define UART_0_RX_PIN 7 -#define UART_0_TX_PIN 6 -#define UART_0_AF 0 - -/* UART 1 device configuration */ -#define UART_1_DEV USART2 -#define UART_1_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_USART2EN)) -#define UART_1_CLKDIS() (periph_clk_dis(APB1, RCC_APB1ENR_USART2EN)) -#define UART_1_IRQ USART2_IRQn -#define UART_1_ISR isr_usart2 -/* UART 1 pin configuration */ -#define UART_1_PORT GPIOA -#define UART_1_PORT_CLKEN() (periph_clk_en(AHB, RCC_AHBENR_GPIOAEN)) -#define UART_1_RX_PIN 3 -#define UART_1_TX_PIN 2 -#define UART_1_AF 1 +static const uart_conf_t uart_config[] = { + { + .dev = USART1, + .rcc_mask = RCC_APB2ENR_USART1EN, + .rx_pin = GPIO_PIN(PORT_B, 7), + .tx_pin = GPIO_PIN(PORT_B, 6), + .rx_af = GPIO_AF0, + .tx_af = GPIO_AF0, + .bus = APB2, + .irqn = USART1_IRQn, + }, + { + .dev = USART2, + .rcc_mask = RCC_APB1ENR_USART2EN, + .rx_pin = GPIO_PIN(PORT_A, 3), + .tx_pin = GPIO_PIN(PORT_A, 2), + .rx_af = GPIO_AF1, + .tx_af = GPIO_AF1, + .bus = APB1, + .irqn = USART2_IRQn + } +}; + +#define UART_0_ISR (isr_usart1) +#define UART_1_ISR (isr_usart2) + +#define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0])) /** @} */ /** diff --git a/boards/stm32f3discovery/include/periph_conf.h b/boards/stm32f3discovery/include/periph_conf.h index eccc128fd29d9c67977480d8ec2981d3b002e2b1..391ff7f3af3b8fc83ab68b159626cd409482c831 100644 --- a/boards/stm32f3discovery/include/periph_conf.h +++ b/boards/stm32f3discovery/include/periph_conf.h @@ -76,53 +76,47 @@ static const timer_conf_t timer_config[] = { /** @} */ /** - * @brief UART configuration + * @brief UART configuration * @{ */ -#define UART_NUMOF (3U) -#define UART_0_EN 1 -#define UART_1_EN 1 -#define UART_2_EN 1 -#define UART_IRQ_PRIO 1 - -/* UART 0 device configuration */ -#define UART_0_DEV USART1 -#define UART_0_CLKEN() (periph_clk_en(APB2, RCC_APB2ENR_USART1EN)) -#define UART_0_CLK (CLOCK_CORECLOCK / 1) /* UART clock runs with 72MHz (F_CPU / 1) */ -#define UART_0_IRQ_CHAN USART1_IRQn -#define UART_0_ISR isr_usart1 -/* UART 0 pin configuration */ -#define UART_0_PORT_CLKEN() (periph_clk_en(AHB, RCC_AHBENR_GPIOAEN)) -#define UART_0_PORT GPIOA -#define UART_0_TX_PIN 9 -#define UART_0_RX_PIN 10 -#define UART_0_AF 7 +static const uart_conf_t uart_config[] = { + { + .dev = USART1, + .rcc_mask = RCC_APB2ENR_USART1EN, + .rx_pin = GPIO_PIN(PORT_A, 10), + .tx_pin = GPIO_PIN(PORT_A, 9), + .rx_af = GPIO_AF7, + .tx_af = GPIO_AF7, + .bus = APB2, + .irqn = USART1_IRQn + }, + { + .dev = USART2, + .rcc_mask = RCC_APB1ENR_USART2EN, + .rx_pin = GPIO_PIN(PORT_D, 6), + .tx_pin = GPIO_PIN(PORT_D, 5), + .rx_af = GPIO_AF7, + .tx_af = GPIO_AF7, + .bus = APB1, + .irqn = USART2_IRQn + }, + { + .dev = USART3, + .rcc_mask = RCC_APB1ENR_USART3EN, + .rx_pin = GPIO_PIN(PORT_D, 9), + .tx_pin = GPIO_PIN(PORT_D, 8), + .rx_af = GPIO_AF7, + .tx_af = GPIO_AF7, + .bus = APB1, + .irqn = USART3_IRQn + } +}; -/* UART 1 device configuration */ -#define UART_1_DEV USART2 -#define UART_1_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_USART2EN)) -#define UART_1_CLK (CLOCK_CORECLOCK / 2) /* UART clock runs with 36MHz (F_CPU / 2) */ -#define UART_1_IRQ_CHAN USART2_IRQn -#define UART_1_ISR isr_usart2 -/* UART 1 pin configuration */ -#define UART_1_PORT_CLKEN() (periph_clk_en(AHB, RCC_AHBENR_GPIODEN)) -#define UART_1_PORT GPIOD -#define UART_1_TX_PIN 5 -#define UART_1_RX_PIN 6 -#define UART_1_AF 7 +#define UART_0_ISR (isr_usart1) +#define UART_1_ISR (isr_usart2) +#define UART_2_ISR (isr_usart3) -/* UART 1 device configuration */ -#define UART_2_DEV USART3 -#define UART_2_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_USART3EN)) -#define UART_2_CLK (CLOCK_CORECLOCK / 2) /* UART clock runs with 36MHz (F_CPU / 2) */ -#define UART_2_IRQ_CHAN USART3_IRQn -#define UART_2_ISR isr_usart3 -/* UART 1 pin configuration */ -#define UART_2_PORT_CLKEN() (periph_clk_en(AHB, RCC_AHBENR_GPIODEN)) -#define UART_2_PORT GPIOD -#define UART_2_TX_PIN 8 -#define UART_2_RX_PIN 9 -#define UART_2_AF 7 +#define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0])) /** @} */ /** diff --git a/boards/stm32f4discovery/include/periph_conf.h b/boards/stm32f4discovery/include/periph_conf.h index 1116c1d66b3e5821c73aad49aeebd33f0a448372..e3476f8c83de435cfa394deaf46e4930e6c5fc8e 100644 --- a/boards/stm32f4discovery/include/periph_conf.h +++ b/boards/stm32f4discovery/include/periph_conf.h @@ -84,34 +84,38 @@ static const uart_conf_t uart_config[] = { { .dev = USART2, .rcc_mask = RCC_APB1ENR_USART2EN, - .rx_pin = GPIO_PIN(PORT_A,3), - .tx_pin = GPIO_PIN(PORT_A,2), - .af = GPIO_AF7, + .rx_pin = GPIO_PIN(PORT_A, 3), + .tx_pin = GPIO_PIN(PORT_A, 2), + .rx_af = GPIO_AF7, + .tx_af = GPIO_AF7, .bus = APB1, .irqn = USART2_IRQn, +#ifdef UART_USE_DMA .dma_stream = 6, .dma_chan = 4 +#endif }, { .dev = USART3, .rcc_mask = RCC_APB1ENR_USART3EN, - .rx_pin = GPIO_PIN(PORT_D,9), - .tx_pin = GPIO_PIN(PORT_D,8), - .af = GPIO_AF7, + .rx_pin = GPIO_PIN(PORT_D, 9), + .tx_pin = GPIO_PIN(PORT_D, 8), + .rx_af = GPIO_AF7, + .tx_af = GPIO_AF7, .bus = APB1, .irqn = USART3_IRQn, +#ifdef UART_USE_DMA .dma_stream = 3, .dma_chan = 4 +#endif } }; -/* assign ISR vector names */ -#define UART_0_ISR isr_usart2 -#define UART_0_DMA_ISR isr_dma1_stream6 -#define UART_1_ISR isr_usart3 -#define UART_1_DMA_ISR isr_dma1_stream3 +#define UART_0_ISR (isr_usart2) +#define UART_0_DMA_ISR (isr_dma1_stream6) +#define UART_1_ISR (isr_usart3) +#define UART_1_DMA_ISR (isr_dma1_stream3) -/* deduct number of defined UART interfaces */ #define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0])) /** @} */