periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2024 BISSELL Homecare, Inc.
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 
19 #ifndef PERIPH_CONF_H
20 #define PERIPH_CONF_H
21 
22 /* Add specific clock configuration (HSE, LSE) for this board here */
23 #ifndef CONFIG_BOARD_HAS_LSE
24 #define CONFIG_BOARD_HAS_LSE 1
25 #endif
26 
27 #include "clk_conf.h"
28 #include "cfg_i2c1_pb8_pb9.h"
29 #include "cfg_rtt_default.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
39 static const timer_conf_t timer_config[] = {
40  {
41  .dev = TIM3,
42  .max = 0x0000ffff,
43  .rcc_mask = RCC_APBENR1_TIM3EN,
44  .bus = APB1,
45  .irqn = TIM3_IRQn
46  }
47 };
48 
49 #define TIMER_0_ISR isr_tim3
50 
51 #define TIMER_NUMOF ARRAY_SIZE(timer_config)
58 static const uart_conf_t uart_config[] = {
59  {
60  .dev = USART2,
61  .rcc_mask = RCC_APBENR1_USART2EN,
62  .rx_pin = GPIO_PIN(PORT_A, 3),
63  .tx_pin = GPIO_PIN(PORT_A, 2),
64  .rx_af = GPIO_AF1,
65  .tx_af = GPIO_AF1,
66  .bus = APB1,
67  .irqn = USART2_IRQn,
68  },
69  { /* Arduino pinout on D0/D1 */
70  .dev = USART1,
71  .rcc_mask = RCC_APBENR2_USART1EN,
72  .rx_pin = GPIO_PIN(PORT_B, 7),
73  .tx_pin = GPIO_PIN(PORT_B, 6),
74  .rx_af = GPIO_AF0,
75  .tx_af = GPIO_AF0,
76  .bus = APB12, //?
77  .irqn = USART1_IRQn,
78  },
79 };
80 
81 #define UART_0_ISR (isr_usart2)
82 #define UART_1_ISR (isr_usart1)
83 
84 #define UART_NUMOF ARRAY_SIZE(uart_config)
111 static const adc_conf_t adc_config[] = {
112  { .pin = GPIO_PIN(PORT_A, 0), .dev = 0, .chan = 0 }, /* ARD_A0_IN0 */
113  { .pin = GPIO_PIN(PORT_A, 1), .dev = 0, .chan = 1 }, /* ARD_A1_IN1 */
114  { .pin = GPIO_PIN(PORT_A, 4), .dev = 0, .chan = 4 }, /* ARD_A2_IN4 */
115  { .pin = GPIO_PIN(PORT_B, 1), .dev = 0, .chan = 18 }, /* ARD_A3_IN18 */
116  { .pin = GPIO_PIN(PORT_A, 11), .dev = 0, .chan = 11 }, /* ARD_A4_IN11 */
117  { .pin = GPIO_PIN(PORT_A, 12), .dev = 0, .chan = 12 }, /* ARD_A5_IN12 */
118 };
119 
120 #define ADC_NUMOF ARRAY_SIZE(adc_config)
138 static const pwm_conf_t pwm_config[] = {
139  {
140  .dev = TIM3,
141  .rcc_mask = RCC_APBENR1_TIM3EN,
142  .chan = { { .pin = GPIO_PIN(PORT_B, 5) /*CN9 D6 */, .cc_chan = 1 },
143  { .pin = GPIO_PIN(PORT_B, 0) /*CN5 D10 */, .cc_chan = 2 },
144  { .pin = GPIO_PIN(PORT_B, 1) /*CN8 A3 */, .cc_chan = 3 },
145  { .pin = GPIO_UNDEF, .cc_chan = 0 } },
146  .af = GPIO_AF1,
147  .bus = APB1
148  },
149 };
150 
151 #define PWM_NUMOF ARRAY_SIZE(pwm_config)
158 static const spi_conf_t spi_config[] = {
159  {
160  .dev = SPI1,
161  .mosi_pin = GPIO_PIN(PORT_A, 7), /* Arduino D11 */
162  .miso_pin = GPIO_PIN(PORT_A, 6), /* Arduino D12 */
163  .sclk_pin = GPIO_PIN(PORT_A, 5), /* Arduino D13 */
164  .cs_pin = GPIO_UNDEF,
165  .mosi_af = GPIO_AF0,
166  .miso_af = GPIO_AF0,
167  .sclk_af = GPIO_AF0,
168  .cs_af = GPIO_AF0,
169  .rccmask = RCC_APBENR2_SPI1EN,
170  .apbbus = APB12,
171  },
172 };
173 
174 #define SPI_NUMOF ARRAY_SIZE(spi_config)
177 #ifdef __cplusplus
178 }
179 #endif
180 
181 #endif /* PERIPH_CONF_H */
@ PORT_B
port B
Definition: periph_cpu.h:48
@ PORT_A
port A
Definition: periph_cpu.h:47
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:46
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
static const uart_conf_t uart_config[]
UART configuration.
Definition: periph_conf.h:39
static const spi_conf_t spi_config[]
SPI configuration.
Definition: periph_conf.h:97
static const timer_conf_t timer_config[]
All timers on board.
Definition: periph_conf.h:40
static const adc_conf_t adc_config[]
ADC configuration.
Definition: periph_conf.h:251
static const pwm_conf_t pwm_config[]
Actual PWM configuration.
Definition: periph_conf.h:222
Common configuration for STM32 I2C.
@ GPIO_AF1
use alternate function 1
Definition: cpu_gpio.h:103
@ GPIO_AF0
use alternate function 0
Definition: cpu_gpio.h:102
@ APB1
Advanced Peripheral Bus 1
Definition: periph_cpu.h:79
ADC device configuration.
Definition: periph_cpu.h:379
gpio_t pin
pin connected to the channel
Definition: periph_cpu.h:288
PWM device configuration.
mini_timer_t * dev
Timer used.
SPI device configuration.
Definition: periph_cpu.h:337
SPI_t * dev
pointer to the used SPI device
Definition: periph_cpu.h:338
Timer device configuration.
Definition: periph_cpu.h:264
TC0_t * dev
Pointer to the used as Timer device.
Definition: periph_cpu.h:265
UART device configuration.
Definition: periph_cpu.h:218
USART_t * dev
pointer to the used UART device
Definition: periph_cpu.h:219