|
| 1 | +/* |
| 2 | + * Copyright (C) 2015 Freie Universität Berlin |
| 3 | + * |
| 4 | + * This file is subject to the terms and conditions of the GNU Lesser |
| 5 | + * General Public License v2.1. See the file LICENSE in the top level |
| 6 | + * directory for more details. |
| 7 | + */ |
| 8 | + |
| 9 | +/** |
| 10 | + * @ingroup boards_nucleo-f072 |
| 11 | + * @{ |
| 12 | + * |
| 13 | + * @file |
| 14 | + * @brief Peripheral MCU configuration for the nucleo-f072 board |
| 15 | + * |
| 16 | + * @author Hauke Petersen <[email protected]> |
| 17 | + * @author José Ignacio Alamos <[email protected]> |
| 18 | + */ |
| 19 | + |
| 20 | +#ifndef PERIPH_CONF_H_ |
| 21 | +#define PERIPH_CONF_H_ |
| 22 | + |
| 23 | +#ifdef __cplusplus |
| 24 | +extern "C" { |
| 25 | +#endif |
| 26 | + |
| 27 | +/** |
| 28 | + * @name Clock system configuration |
| 29 | + * @{ |
| 30 | + */ |
| 31 | +#define CLOCK_HSE (8000000U) /* external oscillator */ |
| 32 | +#define CLOCK_CORECLOCK (48000000U) /* desired core clock frequency */ |
| 33 | + |
| 34 | +/* the actual PLL values are automatically generated */ |
| 35 | +#define CLOCK_PLL_MUL (CLOCK_CORECLOCK / CLOCK_HSE) |
| 36 | +/** @} */ |
| 37 | + |
| 38 | +/** |
| 39 | + * @brief Timer configuration |
| 40 | + * @{ |
| 41 | + */ |
| 42 | +#define TIMER_NUMOF (1U) |
| 43 | +#define TIMER_0_EN 1 |
| 44 | +#define TIMER_IRQ_PRIO 1 |
| 45 | + |
| 46 | +/* Timer 0 configuration */ |
| 47 | +#define TIMER_0_DEV TIM2 |
| 48 | +#define TIMER_0_CHANNELS 4 |
| 49 | +#define TIMER_0_FREQ (CLOCK_CORECLOCK) |
| 50 | +#define TIMER_0_MAX_VALUE (0xffffffff) |
| 51 | +#define TIMER_0_CLKEN() (RCC->APB1ENR |= RCC_APB1ENR_TIM2EN) |
| 52 | +#define TIMER_0_IRQ_CHAN TIM2_IRQn |
| 53 | +#define TIMER_0_ISR isr_tim2 |
| 54 | +/** @} */ |
| 55 | + |
| 56 | +/** |
| 57 | + * @brief UART configuration |
| 58 | + * @} |
| 59 | + */ |
| 60 | +#define UART_NUMOF (2U) |
| 61 | +#define UART_0_EN 1 |
| 62 | +#define UART_1_EN 1 |
| 63 | +#define UART_IRQ_PRIO 1 |
| 64 | + |
| 65 | +/* UART 0 device configuration */ |
| 66 | +#define UART_0_DEV USART2 |
| 67 | +#define UART_0_CLKEN() (RCC->APB1ENR |= RCC_APB1ENR_USART2EN) |
| 68 | +#define UART_0_CLKDIS() (RCC->APB1ENR &= (~RCC_APB1ENR_USART2EN)) |
| 69 | +#define UART_0_IRQ USART2_IRQn |
| 70 | +#define UART_0_ISR isr_usart2 |
| 71 | +/* UART 0 pin configuration */ |
| 72 | +#define UART_0_PORT GPIOA |
| 73 | +#define UART_0_PORT_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOAEN) |
| 74 | +#define UART_0_RX_PIN 3 |
| 75 | +#define UART_0_TX_PIN 2 |
| 76 | +#define UART_0_AF 1 |
| 77 | + |
| 78 | +/* UART 1 device configuration */ |
| 79 | +#define UART_1_DEV USART1 |
| 80 | +#define UART_1_CLKEN() (RCC->APB2ENR |= RCC_APB2ENR_USART1EN) |
| 81 | +#define UART_1_CLKDIS() (RCC->APB2ENR &= (~RCC_APB2ENR_USART1EN)) |
| 82 | +#define UART_1_IRQ USART1_IRQn |
| 83 | +#define UART_1_ISR isr_usart1 |
| 84 | +/* UART 1 pin configuration */ |
| 85 | +#define UART_1_PORT GPIOB |
| 86 | +#define UART_1_PORT_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOBEN) |
| 87 | +#define UART_1_RX_PIN 7 |
| 88 | +#define UART_1_TX_PIN 6 |
| 89 | +#define UART_1_AF 0 |
| 90 | +/** @} */ |
| 91 | + |
| 92 | + |
| 93 | +/** |
| 94 | + * @brief ADC configuration |
| 95 | + * @{ |
| 96 | + */ |
| 97 | +#define ADC_CONFIG { \ |
| 98 | + { GPIO_PIN(PORT_A, 0), 0 },\ |
| 99 | + { GPIO_PIN(PORT_A, 1), 1 },\ |
| 100 | + { GPIO_PIN(PORT_A, 4), 4 },\ |
| 101 | + { GPIO_PIN(PORT_B, 0), 8 },\ |
| 102 | + { GPIO_PIN(PORT_C, 1), 11 },\ |
| 103 | + { GPIO_PIN(PORT_C, 0), 10 } \ |
| 104 | +} |
| 105 | + |
| 106 | +#define ADC_NUMOF (6) |
| 107 | + |
| 108 | +/** @} */ |
| 109 | + |
| 110 | + |
| 111 | +/** |
| 112 | + * @brief DAC configuration |
| 113 | + * @{ |
| 114 | + */ |
| 115 | +#define DAC_NUMOF (0) |
| 116 | +/** @} */ |
| 117 | + |
| 118 | +/** |
| 119 | + * @name RTC configuration |
| 120 | + * @{ |
| 121 | + */ |
| 122 | +/** |
| 123 | + * Nucleos with MB1136 C-02 or MB1136 C-03 -sticker on it have the required LSE |
| 124 | + * oscillator provided on the X2 slot. |
| 125 | + * See Nucleo User Manual UM1724 section 5.6.2. |
| 126 | + */ |
| 127 | +#define RTC_NUMOF (1U) |
| 128 | +/** @} */ |
| 129 | + |
| 130 | +#ifdef __cplusplus |
| 131 | +} |
| 132 | +#endif |
| 133 | + |
| 134 | +#endif /* PERIPH_CONF_H_ */ |
| 135 | +/** @} */ |
0 commit comments