Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpu, cc2538: gpio cleanup #7320

Closed
wants to merge 11 commits into from
27 changes: 13 additions & 14 deletions boards/cc2538dk/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ static const timer_conf_t timer_config[] = {
#define UART_0_IRQ UART0_IRQn
#define UART_0_ISR isr_uart0
/* UART 0 pin configuration */
#define UART_0_TX_PIN GPIO_PA1
#define UART_0_RX_PIN GPIO_PA0
#define UART_0_RTS_PIN GPIO_PD3
#define UART_0_CTS_PIN GPIO_PB0
#define UART_0_TX_PIN GPIO_PIN(0, 1) /**< GPIO_PA1 */
#define UART_0_RX_PIN GPIO_PIN(0, 0) /**< GPIO_PA0 */
#define UART_0_RTS_PIN GPIO_PIN(3, 3) /**< GPIO_PD3 */
#define UART_0_CTS_PIN GPIO_PIN(1, 0) /**< GPIO_PB0 */

/* UART 1 device configuration */
#define UART_1_DEV UART1
Expand All @@ -92,23 +92,22 @@ static const timer_conf_t timer_config[] = {
* @name I2C configuration
* @{
*/
#define I2C_NUMOF 1
#define I2C_0_EN 1
#define I2C_IRQ_PRIO 1

/* I2C 0 device configuration */
#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]))
/** @} */

/**
Expand All @@ -133,10 +132,10 @@ static const spi_clk_conf_t spi_clk_config[] = {
static const spi_conf_t spi_config[] = {
{
.dev = SSI0,
.mosi_pin = GPIO_PA4,
.miso_pin = GPIO_PA5,
.sck_pin = GPIO_PA2,
.cs_pin = GPIO_PD0
.mosi_pin = GPIO_PIN(0, 4), /**< GPIO_PA4 */
.miso_pin = GPIO_PIN(0, 5), /**< GPIO_PA5 */
.sck_pin = GPIO_PIN(0, 2), /**< GPIO_PA2 */
.cs_pin = GPIO_PIN(3, 0) /**< GPIO_PD0 */
}
};

Expand Down
23 changes: 11 additions & 12 deletions boards/openmote-cc2538/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,31 +77,30 @@ static const timer_conf_t timer_config[] = {
#define UART_0_IRQ UART0_IRQn
#define UART_0_ISR isr_uart0
/* UART 0 pin configuration */
#define UART_0_TX_PIN GPIO_PA1
#define UART_0_RX_PIN GPIO_PA0
#define UART_0_TX_PIN GPIO_PIN(0, 1) /**< GPIO_PA1 */
#define UART_0_RX_PIN GPIO_PIN(0, 0) /**< GPIO_PA0 */
/** @} */

/**
* @name I2C configuration
* @{
*/
#define I2C_NUMOF 1
#define I2C_0_EN 1
#define I2C_IRQ_PRIO 1

/* I2C 0 device configuration */
#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]))
/** @} */

/**
Expand All @@ -126,10 +125,10 @@ static const spi_clk_conf_t spi_clk_config[] = {
static const spi_conf_t spi_config[] = {
{
.dev = SSI0,
.mosi_pin = GPIO_PA5,
.miso_pin = GPIO_PA4,
.sck_pin = GPIO_PA2,
.cs_pin = GPIO_PA3,
.mosi_pin = GPIO_PIN(0, 5), /**< GPIO_PA5 */
.miso_pin = GPIO_PIN(0, 4), /**< GPIO_PA4 */
.sck_pin = GPIO_PIN(0, 2), /**< GPIO_PA2 */
.cs_pin = GPIO_PIN(0, 3) /**< GPIO_PA3 */
},
};

Expand Down
18 changes: 18 additions & 0 deletions boards/remote-common/include/periph_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,24 @@ static const timer_conf_t timer_config[] = {
#define RADIO_IRQ_PRIO 1
/** @} */


/**
* @name UART configuration
* @{
*/
#define UART_NUMOF (1U)
#define UART_0_EN 1
#define UART_IRQ_PRIO 1

/* UART 0 device configuration */
#define UART_0_DEV UART0
#define UART_0_IRQ UART0_IRQn
#define UART_0_ISR isr_uart0
/* UART 0 pin configuration */
#define UART_0_TX_PIN GPIO_PIN(0, 1) /**< GPIO_PA1 */
#define UART_0_RX_PIN GPIO_PIN(0, 0) /**< GPIO_PA0 */
/** @} */

#ifdef __cplusplus
} /* end extern "C" */
#endif
Expand Down
7 changes: 4 additions & 3 deletions boards/remote-pa/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@
*/
#define RF_SWITCH_PORT GPIO_D
#define RF_SWITCH_PIN (4)
#define RF_SWITCH_EXTERNAL (RF_SWITCH_PORT->DATA |= (1 << RF_SWITCH_PIN))
#define RF_SWITCH_INTERNAL (RF_SWITCH_PORT->DATA &= ~(1 << RF_SWITCH_PIN))
#define RF_SWITCH_TOGGLE (RF_SWITCH_PORT->DATA ^= (1 << RF_SWITCH_PIN))
#define RF_SWITCH_GPIO GPIO_PIN(3, 4) /**< GPIO_PD4 */
#define RF_SWITCH_EXTERNAL gpio_set(RF_SWITCH_GPIO)
#define RF_SWITCH_INTERNAL gpio_clear(RF_SWITCH_GPIO)
#define RF_SWITCH_TOGGLE gpio_toggle(RF_SWITCH_GPIO)
/** @} */

/**
Expand Down
42 changes: 12 additions & 30 deletions boards/remote-pa/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,44 +27,26 @@
extern "C" {
#endif

/**
* @name UART configuration
* @{
*/
#define UART_NUMOF (1U)
#define UART_0_EN 1
#define UART_IRQ_PRIO 1

/* UART 0 device configuration */
#define UART_0_DEV UART0
#define UART_0_IRQ UART0_IRQn
#define UART_0_ISR isr_uart0
/* UART 0 pin configuration */
#define UART_0_TX_PIN GPIO_PA1
#define UART_0_RX_PIN GPIO_PA0
/** @} */

/**
* @name I2C configuration
* @{
*/
#define I2C_NUMOF 1
#define I2C_0_EN 1
#define I2C_IRQ_PRIO 1

/* I2C 0 device configuration */
#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]))
/** @} */

/**
Expand All @@ -89,16 +71,16 @@ static const spi_clk_conf_t spi_clk_config[] = {
static const spi_conf_t spi_config[] = {
{
.dev = SSI0,
.mosi_pin = GPIO_PD0,
.miso_pin = GPIO_PC4,
.sck_pin = GPIO_PD1,
.cs_pin = GPIO_PD3
.mosi_pin = GPIO_PIN(3, 0), /**< GPIO_PD0 */
.miso_pin = GPIO_PIN(2, 4), /**< GPIO_PC4 */
.sck_pin = GPIO_PIN(3, 1), /**< GPIO_PD1 */
.cs_pin = GPIO_PIN(3, 3) /**< GPIO_PD3 */
},
{
.dev = SSI1,
.mosi_pin = GPIO_PC7,
.miso_pin = GPIO_PA4,
.sck_pin = GPIO_PB5,
.mosi_pin = GPIO_PIN(2, 7), /**< GPIO_PC7 */
.miso_pin = GPIO_PIN(0, 4), /**< GPIO_PA4 */
.sck_pin = GPIO_PIN(1, 5), /**< GPIO_PB5 */
.cs_pin = GPIO_UNDEF
}
};
Expand Down
20 changes: 10 additions & 10 deletions boards/remote-reva/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
*
* @{
*/
#define RF_SWITCH_GPIO GPIO_PD2
#define RF_SWITCH_GPIO GPIO_PIN(3, 2) /**< GPIO_PD2 */
#define RF_SWITCH_SUB_GHZ gpio_set(RF_SWITCH_GPIO)
#define RF_SWITCH_2_4_GHZ gpio_clear(RF_SWITCH_GPIO)
#define RF_SWITCH_TOGGLE gpio_toggle(RF_SWITCH_GPIO)
Expand All @@ -94,22 +94,22 @@
* @name Shutdown enable/done pins
* @{
*/
#define SHUTDOWN_DONE_GPIO GPIO_PD0
#define SHUTDOWN_EN_GPIO GPIO_PD1
#define SHUTDOWN_DONE_GPIO GPIO_PIN(3, 0) /**< GPIO_PD0 */
#define SHUTDOWN_EN_GPIO GPIO_PIN(3, 1) /**< GPIO_PD1 */
/** @} */

/**
* @name CC1200 SPI and pins definitions
* @{
*/
#define CC1200_SPI_DEV SSI0
#define CC1200_MOSI_GPIO GPIO_PB1
#define CC1200_MISO_GPIO GPIO_PB3
#define CC1200_SCLK_GPIO GPIO_PB2
#define CC1200_CSN_GPIO GPIO_PB5
#define CC1200_RESET_GPIO GPIO_PC7
#define CC1200_GPD0_GPIO GPIO_PB4
#define CC1200_GPD2_GPIO GPIO_PB0
#define CC1200_MOSI_GPIO GPIO_PIN(1, 1) /**< GPIO_PB1 */
#define CC1200_MISO_GPIO GPIO_PIN(1, 3) /**< GPIO_PB3 */
#define CC1200_SCLK_GPIO GPIO_PIN(1, 2) /**< GPIO_PB2 */
#define CC1200_CSN_GPIO GPIO_PIN(1, 5) /**< GPIO_PB5 */
#define CC1200_RESET_GPIO GPIO_PIN(2, 7) /**< GPIO_PC7 */
#define CC1200_GPD0_GPIO GPIO_PIN(1, 4) /**< GPIO_PB4 */
#define CC1200_GPD2_GPIO GPIO_PIN(1, 0) /**< GPIO_PB0 */
/** @} */

/**
Expand Down
45 changes: 13 additions & 32 deletions boards/remote-reva/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,45 +27,26 @@
extern "C" {
#endif

/**
* @name UART configuration
* @{
*/
#define UART_NUMOF (1U)
#define UART_0_EN 1
#define UART_IRQ_PRIO 1

/* UART 0 device configuration */
#define UART_0_DEV UART0
#define UART_0_IRQ UART0_IRQn
#define UART_0_ISR isr_uart0
/* UART 0 pin configuration */
#define UART_0_TX_PIN GPIO_PA1
#define UART_0_RX_PIN GPIO_PA0

/** @} */

/**
* @name I2C configuration
* @{
*/
#define I2C_NUMOF 1
#define I2C_0_EN 1
#define I2C_IRQ_PRIO 1

/* I2C 0 device configuration */
#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]))
/** @} */

/**
Expand All @@ -90,17 +71,17 @@ static const spi_clk_conf_t spi_clk_config[] = {
static const spi_conf_t spi_config[] = {
{
.dev = SSI0,
.mosi_pin = GPIO_PB1,
.miso_pin = GPIO_PB3,
.sck_pin = GPIO_PB2,
.cs_pin = GPIO_PB5
.mosi_pin = GPIO_PIN(1, 1), /**< GPIO_PB1 */
.miso_pin = GPIO_PIN(1, 3), /**< GPIO_PB3 */
.sck_pin = GPIO_PIN(1, 2), /**< GPIO_PB2 */
.cs_pin = GPIO_PIN(1, 5) /**< GPIO_PB5 */
},
{
.dev = SSI1,
.mosi_pin = GPIO_PC5,
.miso_pin = GPIO_PC6,
.sck_pin = GPIO_PC4,
.cs_pin = GPIO_PA7
.mosi_pin = GPIO_PIN(2, 5), /**< GPIO_PC5 */
.miso_pin = GPIO_PIN(2, 6), /**< GPIO_PC6 */
.sck_pin = GPIO_PIN(2, 4), /**< GPIO_PC4 */
.cs_pin = GPIO_PIN(0, 7) /**< GPIO_PA7 */
}
};

Expand Down
18 changes: 9 additions & 9 deletions boards/remote-revb/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
*
* @{
*/
#define RF_SWITCH_GPIO GPIO_PD2
#define RF_SWITCH_GPIO GPIO_PIN(3, 2) /**< GPIO_PD2 */
#define RF_SWITCH_SUB_GHZ gpio_set(RF_SWITCH_GPIO)
#define RF_SWITCH_2_4_GHZ gpio_clear(RF_SWITCH_GPIO)
#define RF_SWITCH_TOGGLE gpio_toggle(RF_SWITCH_GPIO)
Expand All @@ -94,21 +94,21 @@
* @name Power management enable pin
* @{
*/
#define SHUTDOWN_EN_GPIO GPIO_PD1
#define SHUTDOWN_EN_GPIO GPIO_PIN(3, 1) /**< GPIO_PD1 */
/** @} */

/**
* @name CC1200 SPI and pins definitions
* @{
*/
#define CC1200_SPI_DEV SSI0
#define CC1200_MOSI_GPIO GPIO_PB1
#define CC1200_MISO_GPIO GPIO_PB3
#define CC1200_SCLK_GPIO GPIO_PB2
#define CC1200_CSN_GPIO GPIO_PB5
#define CC1200_RESET_GPIO GPIO_PC7
#define CC1200_GPD0_GPIO GPIO_PB4
#define CC1200_GPD2_GPIO GPIO_PB0
#define CC1200_MOSI_GPIO GPIO_PIN(1, 1) /**< GPIO_PB1 */
#define CC1200_MISO_GPIO GPIO_PIN(1, 3) /**< GPIO_PB3 */
#define CC1200_SCLK_GPIO GPIO_PIN(1, 2) /**< GPIO_PB2 */
#define CC1200_CSN_GPIO GPIO_PIN(1, 5) /**< GPIO_PB5 */
#define CC1200_RESET_GPIO GPIO_PIN(2, 7) /**< GPIO_PC7 */
#define CC1200_GPD0_GPIO GPIO_PIN(1, 4) /**< GPIO_PB4 */
#define CC1200_GPD2_GPIO GPIO_PIN(1, 0) /**< GPIO_PB0 */
/** @} */

/**
Expand Down
Loading