Skip to content

Commit

Permalink
boards/nucleo-f0207zg: use common clock and i2c configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
aabadie committed Jan 2, 2019
1 parent 24bc5ae commit 3eba44a
Showing 1 changed file with 2 additions and 55 deletions.
57 changes: 2 additions & 55 deletions boards/nucleo-f207zg/include/periph_conf.h
Expand Up @@ -22,42 +22,13 @@
#define PERIPH_CONF_H

#include "periph_cpu.h"
#include "f2/cfg_clock_120_8_1.h"
#include "cfg_i2c1_pb8_pb9.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @name Clock settings
*
* @note This is auto-generated from
* `cpu/stm32_common/dist/clk_conf/clk_conf.c`
* @{
*/
/* give the target core clock (HCLK) frequency [in Hz],
* maximum: 120MHz */
#define CLOCK_CORECLOCK (120000000U)
/* 0: no external high speed crystal available
* else: actual crystal frequency [in Hz] */
#define CLOCK_HSE (8000000U)
/* 0: no external low speed crystal available,
* 1: external crystal available (always 32.768kHz) */
#define CLOCK_LSE (1)
/* peripheral clock setup */
#define CLOCK_AHB_DIV RCC_CFGR_HPRE_DIV1
#define CLOCK_AHB (CLOCK_CORECLOCK / 1)
#define CLOCK_APB1_DIV RCC_CFGR_PPRE1_DIV4 /* max 30MHz */
#define CLOCK_APB1 (CLOCK_CORECLOCK / 4)
#define CLOCK_APB2_DIV RCC_CFGR_PPRE2_DIV2 /* max 60MHz */
#define CLOCK_APB2 (CLOCK_CORECLOCK / 2)

/* Main PLL factors */
#define CLOCK_PLL_M (4)
#define CLOCK_PLL_N (120)
#define CLOCK_PLL_P (2)
#define CLOCK_PLL_Q (5)
/** @} */

/**
* @name PWM configuration
* @{
Expand Down Expand Up @@ -226,30 +197,6 @@ static const spi_conf_t spi_config[] = {
#define SPI_NUMOF (sizeof(spi_config) / sizeof(spi_config[0]))
/** @} */

/**
* @name I2C configuration
* @{
*/
static const i2c_conf_t i2c_config[] = {
{
.dev = I2C1,
.speed = I2C_SPEED_NORMAL,
.scl_pin = GPIO_PIN(PORT_B, 8),
.sda_pin = GPIO_PIN(PORT_B, 9),
.scl_af = GPIO_AF4,
.sda_af = GPIO_AF4,
.bus = APB1,
.rcc_mask = RCC_APB1ENR_I2C1EN,
.clk = CLOCK_APB1,
.irqn = I2C1_EV_IRQn
}
};

#define I2C_0_ISR isr_i2c1_ev

#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0]))
/** @} */

/**
* @name ADC configuration
*
Expand Down

0 comments on commit 3eba44a

Please sign in to comment.