Peripheral MCU configuration for the bluepill/blackpill boards. More...

Detailed Description

#include "periph_cpu.h"
#include "clk_conf.h"
+ Include dependency graph for periph_conf.h:

Go to the source code of this file.

#define CONFIG_BOARD_HAS_LSE   1
 
#define CONFIG_BOARD_HAS_HSE   1
 

Real time counter configuration

#define RTT_FREQUENCY   (16384) /* in Hz */
 

ADC configuration

#define ADC_NUMOF   ARRAY_SIZE(adc_config)
 
static const adc_conf_t adc_config []
 

DMA streams configuration

#define DMA_0_ISR   isr_dma1_channel2
 
#define DMA_1_ISR   isr_dma1_channel3
 
#define DMA_2_ISR   isr_dma1_channel4
 
#define DMA_3_ISR   isr_dma1_channel5
 
#define DMA_4_ISR   isr_dma1_channel7
 
#define DMA_NUMOF   ARRAY_SIZE(dma_config)
 
static const dma_conf_t dma_config []
 

Timer configuration

#define TIMER_0_ISR   isr_tim2
 
#define TIMER_1_ISR   isr_tim3
 
#define TIMER_2_ISR   isr_tim4
 
#define TIMER_NUMOF   ARRAY_SIZE(timer_config)
 
static const timer_conf_t timer_config []
 

QDEC configuration

#define QDEC_NUMOF   ARRAY_SIZE(qdec_config)
 
static const qdec_conf_t qdec_config []
 

UART configuration

#define UART_0_ISR   (isr_usart1)
 
#define UART_1_ISR   (isr_usart2)
 
#define UART_2_ISR   (isr_usart3)
 
#define UART_NUMOF   ARRAY_SIZE(uart_config)
 
static const uart_conf_t uart_config []
 

I2C configuration

Note
This board may require external pullup resistors for i2c operation.
#define I2C_0_ISR   isr_i2c1_ev
 
#define I2C_1_ISR   isr_i2c2_ev
 
#define I2C_NUMOF   ARRAY_SIZE(i2c_config)
 
static const i2c_conf_t i2c_config []
 

PWM configuration

#define PWM_NUMOF   ARRAY_SIZE(pwm_config)
 
static const pwm_conf_t pwm_config []
 

SPI configuration

#define SPI_NUMOF   ARRAY_SIZE(spi_config)
 
static const spi_conf_t spi_config []
 

Variable Documentation

◆ adc_config

const adc_conf_t adc_config[]
static
Initial value:
= {
{ .pin = GPIO_PIN(PORT_A, 0), .dev = 0, .chan = 0 },
{ .pin = GPIO_PIN(PORT_A, 1), .dev = 0, .chan = 1 },
{ .pin = GPIO_PIN(PORT_A, 4), .dev = 0, .chan = 4 },
{ .pin = GPIO_PIN(PORT_A, 5), .dev = 0, .chan = 5 },
{ .pin = GPIO_PIN(PORT_A, 6), .dev = 0, .chan = 6 },
{ .pin = GPIO_PIN(PORT_A, 7), .dev = 0, .chan = 7 },
{ .pin = GPIO_PIN(PORT_B, 0), .dev = 0, .chan = 8 },
{ .pin = GPIO_PIN(PORT_B, 1), .dev = 0, .chan = 9 },
{ .pin = GPIO_UNDEF, .dev = 0, .chan = 16 },
{ .pin = GPIO_UNDEF, .dev = 0, .chan = 17 },
}

Definition at line 57 of file periph_conf.h.

◆ dma_config

const dma_conf_t dma_config[]
static
Initial value:
= {
{ .stream = 1 },
{ .stream = 2 },
{ .stream = 3 },
{ .stream = 4 },
{ .stream = 6 },
}

Definition at line 79 of file periph_conf.h.

◆ i2c_config

const i2c_conf_t i2c_config[]
static
Initial value:
= {
{
.dev = I2C1,
.speed = I2C_SPEED_NORMAL,
.scl_pin = GPIO_PIN(PORT_B, 6),
.sda_pin = GPIO_PIN(PORT_B, 7),
.bus = APB1,
.rcc_mask = RCC_APB1ENR_I2C1EN,
.clk = CLOCK_APB1,
.irqn = I2C1_EV_IRQn
},
{
.dev = I2C2,
.speed = I2C_SPEED_NORMAL,
.scl_pin = GPIO_PIN(PORT_B, 10),
.sda_pin = GPIO_PIN(PORT_B, 11),
.bus = APB1,
.rcc_mask = RCC_APB1ENR_I2C2EN,
.clk = CLOCK_APB1,
.irqn = I2C2_EV_IRQn
}
}

Definition at line 224 of file periph_conf.h.

◆ pwm_config

const pwm_conf_t pwm_config[]
static
Initial value:
= {
{
.dev = TIM1,
.rcc_mask = RCC_APB2ENR_TIM1EN,
.chan = { { .pin = GPIO_PIN(PORT_A, 8), .cc_chan = 0 },
{ .pin = GPIO_PIN(PORT_A, 9), .cc_chan = 1 },
{ .pin = GPIO_PIN(PORT_A, 10), .cc_chan = 2 },
{ .pin = GPIO_PIN(PORT_A, 11), .cc_chan = 3 } },
.af = GPIO_AF_OUT_PP,
.bus = APB2
}
}

Definition at line 257 of file periph_conf.h.

◆ qdec_config

const qdec_conf_t qdec_config[]
static
Initial value:
= {
{
.dev = TIM1,
.max = 0x0000ffff,
.rcc_mask = RCC_APB2ENR_TIM1EN,
.chan = { { .pin = GPIO_PIN(PORT_A, 8), .cc_chan = 0 },
{ .pin = GPIO_PIN(PORT_A, 9), .cc_chan = 1 } },
.bus = APB2,
.irqn = TIM1_UP_IRQn
},
{
.dev = TIM3,
.max = 0x0000ffff,
.rcc_mask = RCC_APB1ENR_TIM3EN,
.chan = { { .pin = GPIO_PIN(PORT_A, 6), .cc_chan = 0 },
{ .pin = GPIO_PIN(PORT_A, 7), .cc_chan = 1 } },
.bus = APB1,
.irqn = TIM3_IRQn
},
{
.dev = TIM4,
.max = 0x0000ffff,
.rcc_mask = RCC_APB1ENR_TIM4EN,
.chan = { { .pin = GPIO_PIN(PORT_B, 6), .cc_chan = 0 },
{ .pin = GPIO_PIN(PORT_B, 7), .cc_chan = 1 } },
.bus = APB1,
.irqn = TIM4_IRQn
}
}

Definition at line 136 of file periph_conf.h.

◆ timer_config

const timer_conf_t timer_config[]
static
Initial value:
= {
{
.dev = TIM2,
.max = 0x0000ffff,
.rcc_mask = RCC_APB1ENR_TIM2EN,
.bus = APB1,
.irqn = TIM2_IRQn
},
{
.dev = TIM3,
.max = 0x0000ffff,
.rcc_mask = RCC_APB1ENR_TIM3EN,
.bus = APB1,
.irqn = TIM3_IRQn
},
{
.dev = TIM4,
.max = 0x0000ffff,
.rcc_mask = RCC_APB1ENR_TIM4EN,
.bus = APB1,
.irqn = TIM4_IRQn
}
}

Definition at line 100 of file periph_conf.h.

I2C_SPEED_NORMAL
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition: i2c.h:177
PORT_A
@ PORT_A
port A
Definition: periph_cpu.h:36
GPIO_UNDEF
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
Definition: periph_cpu_common.h:52
GPIO_PIN
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:35
APB2
@ APB2
APB2 bus.
Definition: periph_cpu.h:177
PORT_B
@ PORT_B
port B
Definition: periph_cpu.h:37
APB1
@ APB1
APB1 bus.
Definition: periph_cpu.h:176