You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by we...@apache.org on 2016/10/25 00:46:56 UTC
incubator-mynewt-core git commit: MYNEWT-408: Rename gpio_
definitions to hal_gpio_
Repository: incubator-mynewt-core
Updated Branches:
refs/heads/develop 87fe2727d -> c28b9b17d
MYNEWT-408: Rename gpio_ definitions to hal_gpio_
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/c28b9b17
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/c28b9b17
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/c28b9b17
Branch: refs/heads/develop
Commit: c28b9b17d6e9646103c8d3bc5a5c0a97ad4b41be
Parents: 87fe272
Author: William San Filippo <wi...@runtime.io>
Authored: Mon Oct 24 17:45:21 2016 -0700
Committer: William San Filippo <wi...@runtime.io>
Committed: Mon Oct 24 17:46:51 2016 -0700
----------------------------------------------------------------------
hw/drivers/uart/uart_bitbang/src/uart_bitbang.c | 2 +-
hw/hal/include/hal/hal_gpio.h | 44 ++++++++++----------
hw/mcu/native/src/hal_gpio.c | 6 +--
hw/mcu/nordic/nrf51xxx/src/hal_gpio.c | 14 +++----
hw/mcu/nordic/nrf52xxx/src/hal_gpio.c | 20 ++++-----
hw/mcu/nxp/MK64F12/src/hal_gpio.c | 8 ++--
hw/mcu/stm/stm32f4xx/include/mcu/stm32f4_bsp.h | 5 ++-
hw/mcu/stm/stm32f4xx/src/hal_gpio.c | 22 +++++-----
hw/mcu/stm/stm32f4xx/src/hal_i2c.c | 6 ++-
hw/mcu/stm/stm32f4xx/src/hal_spi.c | 4 +-
hw/mcu/stm/stm32f4xx/src/hal_spi_soft_ssi.c | 4 +-
11 files changed, 69 insertions(+), 66 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c28b9b17/hw/drivers/uart/uart_bitbang/src/uart_bitbang.c
----------------------------------------------------------------------
diff --git a/hw/drivers/uart/uart_bitbang/src/uart_bitbang.c b/hw/drivers/uart/uart_bitbang/src/uart_bitbang.c
index 175989d..0f856bc 100644
--- a/hw/drivers/uart/uart_bitbang/src/uart_bitbang.c
+++ b/hw/drivers/uart/uart_bitbang/src/uart_bitbang.c
@@ -265,7 +265,7 @@ uart_bitbang_config(struct uart_bitbang *ub, int32_t baudrate, uint8_t databits,
}
if (hal_gpio_irq_init(ub->ub_rx.pin, uart_bitbang_isr, ub,
- GPIO_TRIG_FALLING, GPIO_PULL_UP)) {
+ HAL_GPIO_TRIG_FALLING, HAL_GPIO_PULL_UP)) {
return -1;
}
hal_gpio_irq_enable(ub->ub_rx.pin);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c28b9b17/hw/hal/include/hal/hal_gpio.h
----------------------------------------------------------------------
diff --git a/hw/hal/include/hal/hal_gpio.h b/hw/hal/include/hal/hal_gpio.h
index d85c682..66b221a 100644
--- a/hw/hal/include/hal/hal_gpio.h
+++ b/hw/hal/include/hal/hal_gpio.h
@@ -28,38 +28,38 @@ extern "C" {
* The "mode" of the gpio. The gpio is either an input, output, or it is
* "not connected" (the pin specified is not functioning as a gpio)
*/
-enum gpio_mode_e {
- GPIO_MODE_NC = -1,
- GPIO_MODE_IN = 0,
- GPIO_MODE_OUT = 1
+enum hal_gpio_mode_e {
+ HAL_GPIO_MODE_NC = -1,
+ HAL_GPIO_MODE_IN = 0,
+ HAL_GPIO_MODE_OUT = 1
};
-typedef enum gpio_mode_e gpio_mode_t;
+typedef enum hal_gpio_mode_e hal_gpio_mode_t;
/*
* The "pull" of the gpio. This is either an input or an output.
*/
-enum gpio_pull {
- GPIO_PULL_NONE = 0, /* pull-up/down not enabled */
- GPIO_PULL_UP = 1, /* pull-up enabled */
- GPIO_PULL_DOWN = 2 /* pull-down enabled */
+enum hal_gpio_pull {
+ HAL_GPIO_PULL_NONE = 0, /* pull-up/down not enabled */
+ HAL_GPIO_PULL_UP = 1, /* pull-up enabled */
+ HAL_GPIO_PULL_DOWN = 2 /* pull-down enabled */
};
-typedef enum gpio_pull gpio_pull_t;
+typedef enum hal_gpio_pull hal_gpio_pull_t;
/*
* IRQ trigger type.
*/
-enum gpio_irq_trigger {
- GPIO_TRIG_NONE = 0,
- GPIO_TRIG_RISING = 1, /* IRQ occurs on rising edge */
- GPIO_TRIG_FALLING = 2, /* IRQ occurs on falling edge */
- GPIO_TRIG_BOTH = 3, /* IRQ occurs on either edge */
- GPIO_TRIG_LOW = 4, /* IRQ occurs when line is low */
- GPIO_TRIG_HIGH = 5 /* IRQ occurs when line is high */
+enum hal_gpio_irq_trigger {
+ HAL_GPIO_TRIG_NONE = 0,
+ HAL_GPIO_TRIG_RISING = 1, /* IRQ occurs on rising edge */
+ HAL_GPIO_TRIG_FALLING = 2, /* IRQ occurs on falling edge */
+ HAL_GPIO_TRIG_BOTH = 3, /* IRQ occurs on either edge */
+ HAL_GPIO_TRIG_LOW = 4, /* IRQ occurs when line is low */
+ HAL_GPIO_TRIG_HIGH = 5 /* IRQ occurs when line is high */
};
-typedef enum gpio_irq_trigger gpio_irq_trig_t;
+typedef enum hal_gpio_irq_trigger hal_gpio_irq_trig_t;
/* Function proto for GPIO irq handler functions */
-typedef void (*gpio_irq_handler_t)(void *arg);
+typedef void (*hal_gpio_irq_handler_t)(void *arg);
/**
* gpio init in
@@ -71,7 +71,7 @@ typedef void (*gpio_irq_handler_t)(void *arg);
*
* @return int 0: no error; -1 otherwise.
*/
-int hal_gpio_init_in(int pin, gpio_pull_t pull);
+int hal_gpio_init_in(int pin, hal_gpio_pull_t pull);
/**
* gpio init out
@@ -137,8 +137,8 @@ int hal_gpio_read(int pin);
*/
int hal_gpio_toggle(int pin);
-int hal_gpio_irq_init(int pin, gpio_irq_handler_t handler, void *arg,
- gpio_irq_trig_t trig, gpio_pull_t pull);
+int hal_gpio_irq_init(int pin, hal_gpio_irq_handler_t handler, void *arg,
+ hal_gpio_irq_trig_t trig, hal_gpio_pull_t pull);
void hal_gpio_irq_release(int pin);
void hal_gpio_irq_enable(int pin);
void hal_gpio_irq_disable(int pin);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c28b9b17/hw/mcu/native/src/hal_gpio.c
----------------------------------------------------------------------
diff --git a/hw/mcu/native/src/hal_gpio.c b/hw/mcu/native/src/hal_gpio.c
index 2da4e34..226330d 100644
--- a/hw/mcu/native/src/hal_gpio.c
+++ b/hw/mcu/native/src/hal_gpio.c
@@ -6,7 +6,7 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
@@ -32,14 +32,14 @@ static struct {
} hal_gpio[HAL_GPIO_NUM_PINS];
int
-hal_gpio_init_in(int pin, gpio_pull_t pull)
+hal_gpio_init_in(int pin, hal_gpio_pull_t pull)
{
if (pin >= HAL_GPIO_NUM_PINS) {
return -1;
}
hal_gpio[pin].dir = INPUT;
switch (pull) {
- case GPIO_PULL_UP:
+ case HAL_GPIO_PULL_UP:
hal_gpio[pin].val = 1;
break;
default:
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c28b9b17/hw/mcu/nordic/nrf51xxx/src/hal_gpio.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/nrf51xxx/src/hal_gpio.c b/hw/mcu/nordic/nrf51xxx/src/hal_gpio.c
index 58e6fac..4d6c507 100644
--- a/hw/mcu/nordic/nrf51xxx/src/hal_gpio.c
+++ b/hw/mcu/nordic/nrf51xxx/src/hal_gpio.c
@@ -55,7 +55,7 @@
struct gpio_irq_obj
{
void *arg;
- gpio_irq_handler_t isr;
+ hal_gpio_irq_handler_t isr;
};
#if 0
@@ -316,18 +316,18 @@ hal_gpio_set_nvic(IRQn_Type irqn)
* @return int 0: no error; -1 otherwise.
*/
int
-hal_gpio_init_in(int pin, gpio_pull_t pull)
+hal_gpio_init_in(int pin, hal_gpio_pull_t pull)
{
uint32_t conf;
switch (pull) {
- case GPIO_PULL_UP:
+ case HAL_GPIO_PULL_UP:
conf = GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos;
break;
- case GPIO_PULL_DOWN:
+ case HAL_GPIO_PULL_DOWN:
conf = GPIO_PIN_CNF_PULL_Pulldown << GPIO_PIN_CNF_PULL_Pos;
break;
- case GPIO_PULL_NONE:
+ case HAL_GPIO_PULL_NONE:
default:
conf = 0;
break;
@@ -447,8 +447,8 @@ int hal_gpio_toggle(int pin)
* @return int
*/
int
-hal_gpio_irq_init(int pin, gpio_irq_handler_t handler, void *arg,
- gpio_irq_trig_t trig, gpio_pull_t pull)
+hal_gpio_irq_init(int pin, hal_gpio_irq_handler_t handler, void *arg,
+ hal_gpio_irq_trig_t trig, hal_gpio_pull_t pull)
{
#if 0
int rc;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c28b9b17/hw/mcu/nordic/nrf52xxx/src/hal_gpio.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_gpio.c b/hw/mcu/nordic/nrf52xxx/src/hal_gpio.c
index ec5e31e..9932e94 100644
--- a/hw/mcu/nordic/nrf52xxx/src/hal_gpio.c
+++ b/hw/mcu/nordic/nrf52xxx/src/hal_gpio.c
@@ -45,7 +45,7 @@
/* Storage for GPIO callbacks. */
struct hal_gpio_irq {
- gpio_irq_handler_t func;
+ hal_gpio_irq_handler_t func;
void *arg;
};
@@ -62,18 +62,18 @@ static struct hal_gpio_irq hal_gpio_irqs[HAL_GPIO_MAX_IRQ];
* @return int 0: no error; -1 otherwise.
*/
int
-hal_gpio_init_in(int pin, gpio_pull_t pull)
+hal_gpio_init_in(int pin, hal_gpio_pull_t pull)
{
uint32_t conf;
switch (pull) {
- case GPIO_PULL_UP:
+ case HAL_GPIO_PULL_UP:
conf = GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos;
break;
- case GPIO_PULL_DOWN:
+ case HAL_GPIO_PULL_DOWN:
conf = GPIO_PIN_CNF_PULL_Pulldown << GPIO_PIN_CNF_PULL_Pos;
break;
- case GPIO_PULL_NONE:
+ case HAL_GPIO_PULL_NONE:
default:
conf = 0;
break;
@@ -266,8 +266,8 @@ hal_gpio_find_pin(int pin)
* @return int
*/
int
-hal_gpio_irq_init(int pin, gpio_irq_handler_t handler, void *arg,
- gpio_irq_trig_t trig, gpio_pull_t pull)
+hal_gpio_irq_init(int pin, hal_gpio_irq_handler_t handler, void *arg,
+ hal_gpio_irq_trig_t trig, hal_gpio_pull_t pull)
{
uint32_t conf;
int i;
@@ -280,13 +280,13 @@ hal_gpio_irq_init(int pin, gpio_irq_handler_t handler, void *arg,
hal_gpio_init_in(pin, pull);
switch (trig) {
- case GPIO_TRIG_RISING:
+ case HAL_GPIO_TRIG_RISING:
conf = GPIOTE_CONFIG_POLARITY_LoToHi << GPIOTE_CONFIG_POLARITY_Pos;
break;
- case GPIO_TRIG_FALLING:
+ case HAL_GPIO_TRIG_FALLING:
conf = GPIOTE_CONFIG_POLARITY_HiToLo << GPIOTE_CONFIG_POLARITY_Pos;
break;
- case GPIO_TRIG_BOTH:
+ case HAL_GPIO_TRIG_BOTH:
conf = GPIOTE_CONFIG_POLARITY_Toggle << GPIOTE_CONFIG_POLARITY_Pos;
break;
default:
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c28b9b17/hw/mcu/nxp/MK64F12/src/hal_gpio.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nxp/MK64F12/src/hal_gpio.c b/hw/mcu/nxp/MK64F12/src/hal_gpio.c
index bca8067..98bbd3b 100644
--- a/hw/mcu/nxp/MK64F12/src/hal_gpio.c
+++ b/hw/mcu/nxp/MK64F12/src/hal_gpio.c
@@ -36,20 +36,20 @@ static GPIO_Type *const s_gpioBases[] = GPIO_BASE_PTRS;
static PORT_Type *const s_portBases[] = PORT_BASE_PTRS;
static clock_ip_name_t const s_portClocks[] = PORT_CLOCKS;
-uint16_t hal_to_fsl_pull(gpio_pull_t pull)
+uint16_t hal_to_fsl_pull(hal_gpio_pull_t pull)
{
switch ((int)pull)
{
- case GPIO_PULL_UP:
+ case HAL_GPIO_PULL_UP:
return kPORT_PullUp;
- case GPIO_PULL_DOWN:
+ case HAL_GPIO_PULL_DOWN:
return kPORT_PullDown;
default:
return kPORT_PullDisable;
}
}
-int hal_gpio_init_in(int pin, gpio_pull_t pull)
+int hal_gpio_init_in(int pin, hal_gpio_pull_t pull)
{
gpio_pin_config_t gconfig;
port_pin_config_t pconfig;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c28b9b17/hw/mcu/stm/stm32f4xx/include/mcu/stm32f4_bsp.h
----------------------------------------------------------------------
diff --git a/hw/mcu/stm/stm32f4xx/include/mcu/stm32f4_bsp.h b/hw/mcu/stm/stm32f4xx/include/mcu/stm32f4_bsp.h
index 91364df..8613058 100644
--- a/hw/mcu/stm/stm32f4xx/include/mcu/stm32f4_bsp.h
+++ b/hw/mcu/stm/stm32f4xx/include/mcu/stm32f4_bsp.h
@@ -6,7 +6,7 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
@@ -42,7 +42,8 @@ struct stm32f4_uart_cfg {
/*
* Internal API for stm32f4xx mcu specific code.
*/
-int hal_gpio_init_af(int pin, uint8_t af_type, enum gpio_pull pull, uint8_t od);
+int hal_gpio_init_af(int pin, uint8_t af_type, enum hal_gpio_pull pull, uint8_t
+od);
struct hal_flash;
extern struct hal_flash stm32f4_flash_dev;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c28b9b17/hw/mcu/stm/stm32f4xx/src/hal_gpio.c
----------------------------------------------------------------------
diff --git a/hw/mcu/stm/stm32f4xx/src/hal_gpio.c b/hw/mcu/stm/stm32f4xx/src/hal_gpio.c
index 1db025e..27392b5 100644
--- a/hw/mcu/stm/stm32f4xx/src/hal_gpio.c
+++ b/hw/mcu/stm/stm32f4xx/src/hal_gpio.c
@@ -116,7 +116,7 @@ static GPIO_TypeDef * const portmap[HAL_GPIO_NUM_PORTS] =
struct gpio_irq_obj
{
void *arg;
- gpio_irq_handler_t isr;
+ hal_gpio_irq_handler_t isr;
};
static struct gpio_irq_obj gpio_irq_handlers[16];
@@ -436,7 +436,7 @@ hal_gpio_deinit_stm(int pin, GPIO_InitTypeDef *cfg)
* @return int 0: no error; -1 otherwise.
*/
int
-hal_gpio_init_in(int pin, gpio_pull_t pull)
+hal_gpio_init_in(int pin, hal_gpio_pull_t pull)
{
int rc;
GPIO_InitTypeDef init_cfg;
@@ -483,7 +483,7 @@ int hal_gpio_init_out(int pin, int val)
* Configure the specified pin for AF.
*/
int
-hal_gpio_init_af(int pin, uint8_t af_type, enum gpio_pull pull, uint8_t od)
+hal_gpio_init_af(int pin, uint8_t af_type, enum hal_gpio_pull pull, uint8_t od)
{
GPIO_InitTypeDef gpio;
@@ -599,8 +599,8 @@ int hal_gpio_toggle(int pin)
* @return int
*/
int
-hal_gpio_irq_init(int pin, gpio_irq_handler_t handler, void *arg,
- gpio_irq_trig_t trig, gpio_pull_t pull)
+hal_gpio_irq_init(int pin, hal_gpio_irq_handler_t handler, void *arg,
+ hal_gpio_irq_trig_t trig, hal_gpio_pull_t pull)
{
int rc;
int irqn;
@@ -612,22 +612,22 @@ hal_gpio_irq_init(int pin, gpio_irq_handler_t handler, void *arg,
/* Configure the gpio for an external interrupt */
rc = 0;
switch (trig) {
- case GPIO_TRIG_NONE:
+ case HAL_GPIO_TRIG_NONE:
rc = -1;
break;
- case GPIO_TRIG_RISING:
+ case HAL_GPIO_TRIG_RISING:
mode = GPIO_MODE_IT_RISING;
break;
- case GPIO_TRIG_FALLING:
+ case HAL_GPIO_TRIG_FALLING:
mode = GPIO_MODE_IT_FALLING;
break;
- case GPIO_TRIG_BOTH:
+ case HAL_GPIO_TRIG_BOTH:
mode = GPIO_MODE_IT_RISING_FALLING;
break;
- case GPIO_TRIG_LOW:
+ case HAL_GPIO_TRIG_LOW:
rc = -1;
break;
- case GPIO_TRIG_HIGH:
+ case HAL_GPIO_TRIG_HIGH:
rc = -1;
break;
default:
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c28b9b17/hw/mcu/stm/stm32f4xx/src/hal_i2c.c
----------------------------------------------------------------------
diff --git a/hw/mcu/stm/stm32f4xx/src/hal_i2c.c b/hw/mcu/stm/stm32f4xx/src/hal_i2c.c
index 96cf0d5..b8b8fd2 100644
--- a/hw/mcu/stm/stm32f4xx/src/hal_i2c.c
+++ b/hw/mcu/stm/stm32f4xx/src/hal_i2c.c
@@ -97,11 +97,13 @@ hal_i2c_init(uint8_t i2c_num, void *usercfg)
* Configure GPIO pins for I2C.
* Enable clock routing for I2C.
*/
- rc = hal_gpio_init_af(cfg->hic_pin_sda, cfg->hic_pin_af, GPIO_PULL_UP, 1);
+ rc = hal_gpio_init_af(cfg->hic_pin_sda, cfg->hic_pin_af, HAL_GPIO_PULL_UP,
+ 1);
if (rc) {
goto err;
}
- rc = hal_gpio_init_af(cfg->hic_pin_scl, cfg->hic_pin_af, GPIO_PULL_UP, 1);
+ rc = hal_gpio_init_af(cfg->hic_pin_scl, cfg->hic_pin_af, HAL_GPIO_PULL_UP,
+ 1);
if (rc) {
goto err;
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c28b9b17/hw/mcu/stm/stm32f4xx/src/hal_spi.c
----------------------------------------------------------------------
diff --git a/hw/mcu/stm/stm32f4xx/src/hal_spi.c b/hw/mcu/stm/stm32f4xx/src/hal_spi.c
index 4ed3bc0..c6b46ae 100644
--- a/hw/mcu/stm/stm32f4xx/src/hal_spi.c
+++ b/hw/mcu/stm/stm32f4xx/src/hal_spi.c
@@ -696,8 +696,8 @@ hal_spi_config(int spi_num, struct hal_spi_settings *settings)
}
if (spi->slave) {
hal_spi_slave_set_def_tx_val(spi_num, 0);
- rc = hal_gpio_irq_init(cfg->ss_pin, spi_ss_isr, spi, GPIO_TRIG_BOTH,
- GPIO_PULL_UP);
+ rc = hal_gpio_irq_init(cfg->ss_pin, spi_ss_isr, spi, HAL_GPIO_TRIG_BOTH,
+ HAL_GPIO_PULL_UP);
spi_ss_isr(spi);
}
__HAL_ENABLE_INTERRUPTS(sr);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c28b9b17/hw/mcu/stm/stm32f4xx/src/hal_spi_soft_ssi.c
----------------------------------------------------------------------
diff --git a/hw/mcu/stm/stm32f4xx/src/hal_spi_soft_ssi.c b/hw/mcu/stm/stm32f4xx/src/hal_spi_soft_ssi.c
index 71bea92..186ed5c 100644
--- a/hw/mcu/stm/stm32f4xx/src/hal_spi_soft_ssi.c
+++ b/hw/mcu/stm/stm32f4xx/src/hal_spi_soft_ssi.c
@@ -637,8 +637,8 @@ hal_spi_config(int spi_num, struct hal_spi_settings *settings)
if (!spi->slave) {
spi->handle.Instance->CR1 |= SPI_CR1_SSI;
} else {
- rc = hal_gpio_irq_init(cfg->ss_pin, spi_ss_isr, spi, GPIO_TRIG_BOTH,
- GPIO_PULL_UP);
+ rc = hal_gpio_irq_init(cfg->ss_pin, spi_ss_isr, spi, HAL_GPIO_TRIG_BOTH,
+ HAL_GPIO_PULL_UP);
spi_ss_isr(spi);
}
__HAL_ENABLE_INTERRUPTS(sr);