boards*: adapt stm32f4 based board with new i2c conf style
This commit is contained in:
parent
27d2841a60
commit
4e09a2b6b7
@ -186,28 +186,25 @@ static const spi_conf_t spi_config[] = {
|
|||||||
* @name I2C configuration
|
* @name I2C configuration
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define I2C_NUMOF (1U)
|
static const i2c_conf_t i2c_config[] = {
|
||||||
#define I2C_0_EN 1
|
{
|
||||||
#define I2C_IRQ_PRIO 1
|
.dev = I2C1,
|
||||||
#define I2C_APBCLK (CLOCK_APB1)
|
.speed = I2C_SPEED_NORMAL,
|
||||||
|
.scl_pin = GPIO_PIN(PORT_B, 6),
|
||||||
|
.sda_pin = GPIO_PIN(PORT_B, 7),
|
||||||
|
.scl_af = GPIO_AF4,
|
||||||
|
.sda_af = GPIO_AF4,
|
||||||
|
.bus = APB1,
|
||||||
|
.rcc_mask = RCC_APB1ENR_I2C1EN,
|
||||||
|
.clk = CLOCK_APB1,
|
||||||
|
.irqn = I2C1_EV_IRQn
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/* I2C 0 device configuration */
|
#define I2C_0_ISR isr_i2c1_ev
|
||||||
#define I2C_0_DEV I2C1
|
|
||||||
#define I2C_0_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_I2C1EN))
|
#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0]))
|
||||||
#define I2C_0_CLKDIS() (periph_clk_dis(APB1, RCC_APB1ENR_I2C1EN))
|
/** @} */
|
||||||
#define I2C_0_EVT_IRQ I2C1_EV_IRQn
|
|
||||||
#define I2C_0_EVT_ISR isr_i2c1_ev
|
|
||||||
#define I2C_0_ERR_IRQ I2C1_ER_IRQn
|
|
||||||
#define I2C_0_ERR_ISR isr_i2c1_er
|
|
||||||
/* I2C 0 pin configuration */
|
|
||||||
#define I2C_0_SCL_PORT GPIOB
|
|
||||||
#define I2C_0_SCL_PIN 6
|
|
||||||
#define I2C_0_SCL_AF 4
|
|
||||||
#define I2C_0_SCL_CLKEN() (periph_clk_en(AHB1, RCC_AHB1ENR_GPIOBEN))
|
|
||||||
#define I2C_0_SDA_PORT GPIOB
|
|
||||||
#define I2C_0_SDA_PIN 7
|
|
||||||
#define I2C_0_SDA_AF 4
|
|
||||||
#define I2C_0_SDA_CLKEN() (periph_clk_en(AHB1, RCC_AHB1ENR_GPIOBEN))
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@ -254,28 +254,24 @@ static const spi_conf_t spi_config[] = {
|
|||||||
* @name I2C configuration
|
* @name I2C configuration
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define I2C_NUMOF (1U)
|
static const i2c_conf_t i2c_config[] = {
|
||||||
#define I2C_0_EN 1
|
{
|
||||||
#define I2C_IRQ_PRIO 1
|
.dev = I2C1,
|
||||||
#define I2C_APBCLK (CLOCK_APB1)
|
.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
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/* I2C 0 device configuration */
|
#define I2C_0_ISR isr_i2c1_ev
|
||||||
#define I2C_0_DEV I2C1
|
|
||||||
#define I2C_0_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_I2C1EN))
|
#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0]))
|
||||||
#define I2C_0_CLKDIS() (periph_clk_dis(APB1, RCC_APB1ENR_I2C1EN))
|
|
||||||
#define I2C_0_EVT_IRQ I2C1_EV_IRQn
|
|
||||||
#define I2C_0_EVT_ISR isr_i2c1_ev
|
|
||||||
#define I2C_0_ERR_IRQ I2C1_ER_IRQn
|
|
||||||
#define I2C_0_ERR_ISR isr_i2c1_er
|
|
||||||
/* I2C 0 pin configuration */
|
|
||||||
#define I2C_0_SCL_PORT GPIOB
|
|
||||||
#define I2C_0_SCL_PIN 8
|
|
||||||
#define I2C_0_SCL_AF 4
|
|
||||||
#define I2C_0_SCL_CLKEN() (periph_clk_en(AHB1, RCC_AHB1ENR_GPIOBEN))
|
|
||||||
#define I2C_0_SDA_PORT GPIOB
|
|
||||||
#define I2C_0_SDA_PIN 9
|
|
||||||
#define I2C_0_SDA_AF 4
|
|
||||||
#define I2C_0_SDA_CLKEN() (periph_clk_en(AHB1, RCC_AHB1ENR_GPIOBEN))
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -166,28 +166,24 @@ static const spi_conf_t spi_config[] = {
|
|||||||
* @name I2C configuration
|
* @name I2C configuration
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define I2C_NUMOF (1U)
|
static const i2c_conf_t i2c_config[] = {
|
||||||
#define I2C_0_EN 1
|
{
|
||||||
#define I2C_IRQ_PRIO 1
|
.dev = I2C1,
|
||||||
#define I2C_APBCLK (CLOCK_APB1)
|
.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
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/* I2C 0 device configuration */
|
#define I2C_0_ISR isr_i2c1_ev
|
||||||
#define I2C_0_DEV I2C1
|
|
||||||
#define I2C_0_CLKEN() (RCC->APB1ENR |= RCC_APB1ENR_I2C1EN)
|
#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0]))
|
||||||
#define I2C_0_CLKDIS() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C1EN))
|
|
||||||
#define I2C_0_EVT_IRQ I2C1_EV_IRQn
|
|
||||||
#define I2C_0_EVT_ISR isr_i2c1_ev
|
|
||||||
#define I2C_0_ERR_IRQ I2C1_ER_IRQn
|
|
||||||
#define I2C_0_ERR_ISR isr_i2c1_er
|
|
||||||
/* I2C 0 pin configuration */
|
|
||||||
#define I2C_0_SCL_PORT GPIOB
|
|
||||||
#define I2C_0_SCL_PIN 8
|
|
||||||
#define I2C_0_SCL_AF 4
|
|
||||||
#define I2C_0_SCL_CLKEN() (RCC->AHB1ENR |= RCC_AHB1ENR_GPIOBEN)
|
|
||||||
#define I2C_0_SDA_PORT GPIOB
|
|
||||||
#define I2C_0_SDA_PIN 9
|
|
||||||
#define I2C_0_SDA_AF 4
|
|
||||||
#define I2C_0_SDA_CLKEN() (RCC->AHB1ENR |= RCC_AHB1ENR_GPIOBEN)
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -212,28 +212,24 @@ static const spi_conf_t spi_config[] = {
|
|||||||
* @name I2C configuration
|
* @name I2C configuration
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define I2C_NUMOF (1U)
|
static const i2c_conf_t i2c_config[] = {
|
||||||
#define I2C_0_EN 1
|
{
|
||||||
#define I2C_IRQ_PRIO 1
|
.dev = I2C1,
|
||||||
#define I2C_APBCLK (CLOCK_APB1)
|
.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
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/* I2C 0 device configuration */
|
#define I2C_0_ISR isr_i2c1_ev
|
||||||
#define I2C_0_DEV I2C1
|
|
||||||
#define I2C_0_CLKEN() (RCC->APB1ENR |= RCC_APB1ENR_I2C1EN)
|
#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0]))
|
||||||
#define I2C_0_CLKDIS() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C1EN))
|
|
||||||
#define I2C_0_EVT_IRQ I2C1_EV_IRQn
|
|
||||||
#define I2C_0_EVT_ISR isr_i2c1_ev
|
|
||||||
#define I2C_0_ERR_IRQ I2C1_ER_IRQn
|
|
||||||
#define I2C_0_ERR_ISR isr_i2c1_er
|
|
||||||
/* I2C 0 pin configuration */
|
|
||||||
#define I2C_0_SCL_PORT GPIOB
|
|
||||||
#define I2C_0_SCL_PIN 8
|
|
||||||
#define I2C_0_SCL_AF 4
|
|
||||||
#define I2C_0_SCL_CLKEN() (RCC->AHB1ENR |= RCC_AHB1ENR_GPIOBEN)
|
|
||||||
#define I2C_0_SDA_PORT GPIOB
|
|
||||||
#define I2C_0_SDA_PIN 9
|
|
||||||
#define I2C_0_SDA_AF 4
|
|
||||||
#define I2C_0_SDA_CLKEN() (RCC->AHB1ENR |= RCC_AHB1ENR_GPIOBEN)
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -223,28 +223,24 @@ static const spi_conf_t spi_config[] = {
|
|||||||
* @name I2C configuration
|
* @name I2C configuration
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define I2C_NUMOF (1U)
|
static const i2c_conf_t i2c_config[] = {
|
||||||
#define I2C_0_EN 1
|
{
|
||||||
#define I2C_IRQ_PRIO 1
|
.dev = I2C1,
|
||||||
#define I2C_APBCLK (42000000U)
|
.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
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/* I2C 0 device configuration */
|
#define I2C_0_ISR isr_i2c1_ev
|
||||||
#define I2C_0_DEV I2C1
|
|
||||||
#define I2C_0_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_I2C1EN))
|
#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0]))
|
||||||
#define I2C_0_CLKDIS() (periph_clk_dis(APB1, RCC_APB1ENR_I2C1EN))
|
|
||||||
#define I2C_0_EVT_IRQ I2C1_EV_IRQn
|
|
||||||
#define I2C_0_EVT_ISR isr_i2c1_ev
|
|
||||||
#define I2C_0_ERR_IRQ I2C1_ER_IRQn
|
|
||||||
#define I2C_0_ERR_ISR isr_i2c1_er
|
|
||||||
/* I2C 0 pin configuration */
|
|
||||||
#define I2C_0_SCL_PORT GPIOB
|
|
||||||
#define I2C_0_SCL_PIN 8
|
|
||||||
#define I2C_0_SCL_AF 4
|
|
||||||
#define I2C_0_SCL_CLKEN() (periph_clk_en(AHB1, RCC_AHB1ENR_GPIOBEN))
|
|
||||||
#define I2C_0_SDA_PORT GPIOB
|
|
||||||
#define I2C_0_SDA_PIN 9
|
|
||||||
#define I2C_0_SDA_AF 4
|
|
||||||
#define I2C_0_SDA_CLKEN() (periph_clk_en(AHB1, RCC_AHB1ENR_GPIOBEN))
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -252,28 +252,24 @@ static const spi_conf_t spi_config[] = {
|
|||||||
* @name I2C configuration
|
* @name I2C configuration
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define I2C_NUMOF (1U)
|
static const i2c_conf_t i2c_config[] = {
|
||||||
#define I2C_0_EN 1
|
{
|
||||||
#define I2C_IRQ_PRIO 1
|
.dev = I2C1,
|
||||||
#define I2C_APBCLK (CLOCK_APB1)
|
.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
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/* I2C 0 device configuration */
|
#define I2C_0_ISR isr_i2c1_ev
|
||||||
#define I2C_0_DEV I2C1
|
|
||||||
#define I2C_0_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_I2C1EN))
|
#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0]))
|
||||||
#define I2C_0_CLKDIS() (periph_clk_dis(APB1, RCC_APB1ENR_I2C1EN))
|
|
||||||
#define I2C_0_EVT_IRQ I2C1_EV_IRQn
|
|
||||||
#define I2C_0_EVT_ISR isr_i2c1_ev
|
|
||||||
#define I2C_0_ERR_IRQ I2C1_ER_IRQn
|
|
||||||
#define I2C_0_ERR_ISR isr_i2c1_er
|
|
||||||
/* I2C 0 pin configuration */
|
|
||||||
#define I2C_0_SCL_PORT GPIOB
|
|
||||||
#define I2C_0_SCL_PIN 8
|
|
||||||
#define I2C_0_SCL_AF 4
|
|
||||||
#define I2C_0_SCL_CLKEN() (periph_clk_en(AHB1, RCC_AHB1ENR_GPIOBEN))
|
|
||||||
#define I2C_0_SDA_PORT GPIOB
|
|
||||||
#define I2C_0_SDA_PIN 9
|
|
||||||
#define I2C_0_SDA_AF 4
|
|
||||||
#define I2C_0_SDA_CLKEN() (periph_clk_en(AHB1, RCC_AHB1ENR_GPIOBEN))
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -161,28 +161,24 @@ static const spi_conf_t spi_config[] = {
|
|||||||
* @name I2C configuration
|
* @name I2C configuration
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define I2C_NUMOF (1U)
|
static const i2c_conf_t i2c_config[] = {
|
||||||
#define I2C_0_EN 1
|
{
|
||||||
#define I2C_IRQ_PRIO 1
|
.dev = I2C1,
|
||||||
#define I2C_APBCLK (42000000U)
|
.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
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/* I2C 0 device configuration */
|
#define I2C_0_ISR isr_i2c1_ev
|
||||||
#define I2C_0_DEV I2C1
|
|
||||||
#define I2C_0_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_I2C1EN))
|
#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0]))
|
||||||
#define I2C_0_CLKDIS() (periph_clk_dis(APB1, RCC_APB1ENR_I2C1EN))
|
|
||||||
#define I2C_0_EVT_IRQ I2C1_EV_IRQn
|
|
||||||
#define I2C_0_EVT_ISR isr_i2c1_ev
|
|
||||||
#define I2C_0_ERR_IRQ I2C1_ER_IRQn
|
|
||||||
#define I2C_0_ERR_ISR isr_i2c1_er
|
|
||||||
/* I2C 0 pin configuration */
|
|
||||||
#define I2C_0_SCL_PORT GPIOB
|
|
||||||
#define I2C_0_SCL_PIN 8
|
|
||||||
#define I2C_0_SCL_AF 4
|
|
||||||
#define I2C_0_SCL_CLKEN() (periph_clk_en(AHB1, RCC_AHB1ENR_GPIOBEN))
|
|
||||||
#define I2C_0_SDA_PORT GPIOB
|
|
||||||
#define I2C_0_SDA_PIN 9
|
|
||||||
#define I2C_0_SDA_AF 4
|
|
||||||
#define I2C_0_SDA_CLKEN() (periph_clk_en(AHB1, RCC_AHB1ENR_GPIOBEN))
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -218,28 +218,24 @@ static const spi_conf_t spi_config[] = {
|
|||||||
* @name I2C configuration
|
* @name I2C configuration
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define I2C_NUMOF (1U)
|
static const i2c_conf_t i2c_config[] = {
|
||||||
#define I2C_0_EN 1
|
{
|
||||||
#define I2C_IRQ_PRIO 1
|
.dev = I2C1,
|
||||||
#define I2C_APBCLK (CLOCK_APB1)
|
.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
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/* I2C 0 device configuration */
|
#define I2C_0_ISR isr_i2c1_ev
|
||||||
#define I2C_0_DEV I2C1
|
|
||||||
#define I2C_0_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_I2C1EN))
|
#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0]))
|
||||||
#define I2C_0_CLKDIS() (periph_clk_dis(APB1, RCC_APB1ENR_I2C1EN))
|
|
||||||
#define I2C_0_EVT_IRQ I2C1_EV_IRQn
|
|
||||||
#define I2C_0_EVT_ISR isr_i2c1_ev
|
|
||||||
#define I2C_0_ERR_IRQ I2C1_ER_IRQn
|
|
||||||
#define I2C_0_ERR_ISR isr_i2c1_er
|
|
||||||
/* I2C 0 pin configuration */
|
|
||||||
#define I2C_0_SCL_PORT GPIOB
|
|
||||||
#define I2C_0_SCL_PIN 8
|
|
||||||
#define I2C_0_SCL_AF 4
|
|
||||||
#define I2C_0_SCL_CLKEN() (periph_clk_en(AHB1, RCC_AHB1ENR_GPIOBEN))
|
|
||||||
#define I2C_0_SDA_PORT GPIOB
|
|
||||||
#define I2C_0_SDA_PIN 9
|
|
||||||
#define I2C_0_SDA_AF 4
|
|
||||||
#define I2C_0_SDA_CLKEN() (periph_clk_en(AHB1, RCC_AHB1ENR_GPIOBEN))
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -161,28 +161,24 @@ static const spi_conf_t spi_config[] = {
|
|||||||
* @name I2C configuration
|
* @name I2C configuration
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define I2C_NUMOF (1U)
|
static const i2c_conf_t i2c_config[] = {
|
||||||
#define I2C_0_EN 1
|
{
|
||||||
#define I2C_IRQ_PRIO 1
|
.dev = I2C1,
|
||||||
#define I2C_APBCLK (42000000U)
|
.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
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/* I2C 0 device configuration */
|
#define I2C_0_ISR isr_i2c1_ev
|
||||||
#define I2C_0_DEV I2C1
|
|
||||||
#define I2C_0_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_I2C1EN))
|
#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0]))
|
||||||
#define I2C_0_CLKDIS() (periph_clk_dis(APB1, RCC_APB1ENR_I2C1EN))
|
|
||||||
#define I2C_0_EVT_IRQ I2C1_EV_IRQn
|
|
||||||
#define I2C_0_EVT_ISR isr_i2c1_ev
|
|
||||||
#define I2C_0_ERR_IRQ I2C1_ER_IRQn
|
|
||||||
#define I2C_0_ERR_ISR isr_i2c1_er
|
|
||||||
/* I2C 0 pin configuration */
|
|
||||||
#define I2C_0_SCL_PORT GPIOB
|
|
||||||
#define I2C_0_SCL_PIN 8
|
|
||||||
#define I2C_0_SCL_AF 4
|
|
||||||
#define I2C_0_SCL_CLKEN() (periph_clk_en(AHB1, RCC_AHB1ENR_GPIOBEN))
|
|
||||||
#define I2C_0_SDA_PORT GPIOB
|
|
||||||
#define I2C_0_SDA_PIN 9
|
|
||||||
#define I2C_0_SDA_AF 4
|
|
||||||
#define I2C_0_SDA_CLKEN() (periph_clk_en(AHB1, RCC_AHB1ENR_GPIOBEN))
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -191,28 +191,24 @@ static const spi_conf_t spi_config[] = {
|
|||||||
* @name I2C configuration
|
* @name I2C configuration
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define I2C_NUMOF (1U)
|
static const i2c_conf_t i2c_config[] = {
|
||||||
#define I2C_0_EN 1
|
{
|
||||||
#define I2C_IRQ_PRIO 1
|
.dev = I2C1,
|
||||||
#define I2C_APBCLK (CLOCK_APB1)
|
.speed = I2C_SPEED_NORMAL,
|
||||||
|
.scl_pin = GPIO_PIN(PORT_B, 6),
|
||||||
|
.sda_pin = GPIO_PIN(PORT_B, 7),
|
||||||
|
.scl_af = GPIO_AF4,
|
||||||
|
.sda_af = GPIO_AF4,
|
||||||
|
.bus = APB1,
|
||||||
|
.rcc_mask = RCC_APB1ENR_I2C1EN,
|
||||||
|
.clk = CLOCK_APB1,
|
||||||
|
.irqn = I2C1_EV_IRQn
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/* I2C 0 device configuration */
|
#define I2C_0_ISR isr_i2c1_ev
|
||||||
#define I2C_0_DEV I2C1
|
|
||||||
#define I2C_0_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_I2C1EN))
|
#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0]))
|
||||||
#define I2C_0_CLKDIS() (periph_clk_dis(APB1, RCC_APB1ENR_I2C1EN))
|
|
||||||
#define I2C_0_EVT_IRQ I2C1_EV_IRQn
|
|
||||||
#define I2C_0_EVT_ISR isr_i2c1_ev
|
|
||||||
#define I2C_0_ERR_IRQ I2C1_ER_IRQn
|
|
||||||
#define I2C_0_ERR_ISR isr_i2c1_er
|
|
||||||
/* I2C 0 pin configuration */
|
|
||||||
#define I2C_0_SCL_PORT GPIOB
|
|
||||||
#define I2C_0_SCL_PIN 6
|
|
||||||
#define I2C_0_SCL_AF 4
|
|
||||||
#define I2C_0_SCL_CLKEN() (periph_clk_en(AHB1, RCC_AHB1ENR_GPIOBEN))
|
|
||||||
#define I2C_0_SDA_PORT GPIOB
|
|
||||||
#define I2C_0_SDA_PIN 7
|
|
||||||
#define I2C_0_SDA_AF 4
|
|
||||||
#define I2C_0_SDA_CLKEN() (periph_clk_en(AHB1, RCC_AHB1ENR_GPIOBEN))
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user