From c8737e13db3c4d9f6087db0eb48b36f51a9d94b3 Mon Sep 17 00:00:00 2001 From: smlng Date: Wed, 5 Jul 2017 10:05:20 +0200 Subject: [PATCH] boards: adapt i2c config of cc2538 based boards --- boards/cc2538dk/include/periph_conf.h | 11 +++++------ boards/openmote-cc2538/include/periph_conf.h | 11 +++++------ boards/remote-pa/include/periph_conf.h | 11 +++++------ boards/remote-reva/include/periph_conf.h | 11 +++++------ boards/remote-revb/include/periph_conf.h | 11 +++++------ 5 files changed, 25 insertions(+), 30 deletions(-) diff --git a/boards/cc2538dk/include/periph_conf.h b/boards/cc2538dk/include/periph_conf.h index 575a8a653ffa9..8a9b6e41eedb0 100644 --- a/boards/cc2538dk/include/periph_conf.h +++ b/boards/cc2538dk/include/periph_conf.h @@ -92,7 +92,6 @@ static const timer_conf_t timer_config[] = { * @name I2C configuration * @{ */ -#define I2C_NUMOF 1 #define I2C_0_EN 1 #define I2C_IRQ_PRIO 1 @@ -100,15 +99,15 @@ static const timer_conf_t timer_config[] = { #define I2C_0_DEV 0 #define I2C_0_IRQ I2C_IRQn #define I2C_0_IRQ_HANDLER isr_i2c -#define I2C_0_SCL_PIN GPIO_PA2 /* SPI_SCK on the SmartRF06 baseboard */ -#define I2C_0_SDA_PIN GPIO_PA4 /* SPI_MOSI on the SmartRF06 baseboard */ -static const i2c_conf_t i2c_config[I2C_NUMOF] = { +static const i2c_conf_t i2c_config[] = { { - .scl_pin = GPIO_PA2, /* SPI_SCK on the SmartRF06 baseboard */ - .sda_pin = GPIO_PA4, /* SPI_MOSI on the SmartRF06 baseboard */ + .scl_pin = GPIO_PIN(0, 2), /**< GPIO_PA2, SPI_SCK on SmartRF06 */ + .sda_pin = GPIO_PIN(0, 4) /**< GPIO_PA4, SPI_MOSI on SmartRF06 */ }, }; + +#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0])) /** @} */ /** diff --git a/boards/openmote-cc2538/include/periph_conf.h b/boards/openmote-cc2538/include/periph_conf.h index aadf637d9d6f5..e5da9d4b1dc10 100644 --- a/boards/openmote-cc2538/include/periph_conf.h +++ b/boards/openmote-cc2538/include/periph_conf.h @@ -85,7 +85,6 @@ static const timer_conf_t timer_config[] = { * @name I2C configuration * @{ */ -#define I2C_NUMOF 1 #define I2C_0_EN 1 #define I2C_IRQ_PRIO 1 @@ -93,15 +92,15 @@ static const timer_conf_t timer_config[] = { #define I2C_0_DEV 0 #define I2C_0_IRQ I2C_IRQn #define I2C_0_IRQ_HANDLER isr_i2c -#define I2C_0_SCL_PIN GPIO_PB3 /* OpenBattery */ -#define I2C_0_SDA_PIN GPIO_PB4 /* OpenBattery */ -static const i2c_conf_t i2c_config[I2C_NUMOF] = { +static const i2c_conf_t i2c_config[] = { { - .scl_pin = GPIO_PB3, /* OpenBattery */ - .sda_pin = GPIO_PB4, /* OpenBattery */ + .scl_pin = GPIO_PIN(1, 3), /**< GPIO_PB3, OpenBattery */ + .sda_pin = GPIO_PIN(1, 4) /**< GPIO_PB4, OpenBattery */ }, }; + +#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0])) /** @} */ /** diff --git a/boards/remote-pa/include/periph_conf.h b/boards/remote-pa/include/periph_conf.h index 4212494a77a38..9d44ef427b15d 100644 --- a/boards/remote-pa/include/periph_conf.h +++ b/boards/remote-pa/include/periph_conf.h @@ -48,7 +48,6 @@ * @name I2C configuration * @{ */ -#define I2C_NUMOF 1 #define I2C_0_EN 1 #define I2C_IRQ_PRIO 1 @@ -56,15 +55,15 @@ #define I2C_0_DEV 0 #define I2C_0_IRQ I2C_IRQn #define I2C_0_IRQ_HANDLER isr_i2c -#define I2C_0_SCL_PIN GPIO_PB1 -#define I2C_0_SDA_PIN GPIO_PB0 -static const i2c_conf_t i2c_config[I2C_NUMOF] = { +static const i2c_conf_t i2c_config[] = { { - .scl_pin = I2C_0_SCL_PIN, - .sda_pin = I2C_0_SDA_PIN, + .scl_pin = GPIO_PIN(1, 1), /**< GPIO_PB1 */ + .sda_pin = GPIO_PIN(1, 0) /**< GPIO_PB0 */ }, }; + +#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0])) /** @} */ /** diff --git a/boards/remote-reva/include/periph_conf.h b/boards/remote-reva/include/periph_conf.h index 6b7350d41fe74..0091aef670cff 100644 --- a/boards/remote-reva/include/periph_conf.h +++ b/boards/remote-reva/include/periph_conf.h @@ -49,7 +49,6 @@ * @name I2C configuration * @{ */ -#define I2C_NUMOF 1 #define I2C_0_EN 1 #define I2C_IRQ_PRIO 1 @@ -57,15 +56,15 @@ #define I2C_0_DEV 0 #define I2C_0_IRQ I2C_IRQn #define I2C_0_IRQ_HANDLER isr_i2c -#define I2C_0_SCL_PIN GPIO_PC3 -#define I2C_0_SDA_PIN GPIO_PC2 -static const i2c_conf_t i2c_config[I2C_NUMOF] = { +static const i2c_conf_t i2c_config[] = { { - .scl_pin = I2C_0_SCL_PIN, - .sda_pin = I2C_0_SDA_PIN, + .scl_pin = GPIO_PIN(2, 3), /**< GPIO_PC3 */ + .sda_pin = GPIO_PIN(2, 2) /**< GPIO_PC2 */ }, }; + +#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0])) /** @} */ /** diff --git a/boards/remote-revb/include/periph_conf.h b/boards/remote-revb/include/periph_conf.h index 930cccfa92ca7..4c20e461f6356 100644 --- a/boards/remote-revb/include/periph_conf.h +++ b/boards/remote-revb/include/periph_conf.h @@ -51,7 +51,6 @@ * @name I2C configuration * @{ */ -#define I2C_NUMOF 1 #define I2C_0_EN 1 #define I2C_IRQ_PRIO 1 @@ -59,15 +58,15 @@ #define I2C_0_DEV 0 #define I2C_0_IRQ I2C_IRQn #define I2C_0_IRQ_HANDLER isr_i2c -#define I2C_0_SCL_PIN GPIO_PC3 -#define I2C_0_SDA_PIN GPIO_PC2 -static const i2c_conf_t i2c_config[I2C_NUMOF] = { +static const i2c_conf_t i2c_config[] = { { - .scl_pin = I2C_0_SCL_PIN, - .sda_pin = I2C_0_SDA_PIN, + .scl_pin = GPIO_PIN(2, 3), /**< GPIO_PC3 */ + .sda_pin = GPIO_PIN(2, 2) /**< GPIO_PC2 */ }, }; + +#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0])) /** @} */ /**