From 20a6f14e893c8339654bdda08c967454e3b2c688 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sun, 25 Dec 2022 03:22:11 -0500 Subject: [PATCH] use PIN_IRQ_PIN_NONE to replace RT_PIN_NONE --- bsp/allwinner/libraries/drivers/touch/drv_touch.c | 2 +- bsp/nuvoton/numaker-iot-m467/board/board_dev.c | 2 +- bsp/nuvoton/numaker-iot-m487/board/board_dev.c | 4 ++-- bsp/nuvoton/numaker-m467hj/board/board_dev.c | 2 +- bsp/nuvoton/numaker-pfm-m487/board/board_dev.c | 4 ++-- bsp/stm32/stm32l475-atk-pandora/board/ports/sensor_port.c | 6 +++--- components/drivers/include/drivers/sensor.h | 1 - components/drivers/include/drivers/touch.h | 2 -- components/drivers/sensor/sensor.c | 4 ++-- components/drivers/touch/touch.c | 6 +++--- 10 files changed, 15 insertions(+), 18 deletions(-) diff --git a/bsp/allwinner/libraries/drivers/touch/drv_touch.c b/bsp/allwinner/libraries/drivers/touch/drv_touch.c index 7ee21ff0f5..9cf0260bfe 100644 --- a/bsp/allwinner/libraries/drivers/touch/drv_touch.c +++ b/bsp/allwinner/libraries/drivers/touch/drv_touch.c @@ -264,7 +264,7 @@ int rt_touch_init(void) else if (TOUCH_POLL_MODE == current_driver->check_mode) { rt_thread_t thread; - irq_pin = RT_PIN_NONE; // No interrupt pins are used + irq_pin = PIN_IRQ_PIN_NONE; // No interrupt pins are used thread = rt_thread_create("touch", touch_poll_entry, RT_NULL, 2048, 16, 20); if (thread == RT_NULL) { diff --git a/bsp/nuvoton/numaker-iot-m467/board/board_dev.c b/bsp/nuvoton/numaker-iot-m467/board/board_dev.c index 795fd11055..0c78b0bb7e 100644 --- a/bsp/nuvoton/numaker-iot-m467/board/board_dev.c +++ b/bsp/nuvoton/numaker-iot-m467/board/board_dev.c @@ -167,7 +167,7 @@ int rt_hw_nct7717u_port(void) struct rt_sensor_config cfg; cfg.intf.dev_name = "i2c2"; - cfg.irq_pin.pin = RT_PIN_NONE; + cfg.irq_pin.pin = PIN_IRQ_PIN_NONE; return rt_hw_nct7717u_init("nct7717u", &cfg); } diff --git a/bsp/nuvoton/numaker-iot-m487/board/board_dev.c b/bsp/nuvoton/numaker-iot-m487/board/board_dev.c index 972b09a9e9..97288f2d74 100644 --- a/bsp/nuvoton/numaker-iot-m487/board/board_dev.c +++ b/bsp/nuvoton/numaker-iot-m487/board/board_dev.c @@ -159,7 +159,7 @@ int rt_hw_max31875_port(void) cfg.intf.dev_name = "i2c1"; cfg.intf.user_data = (void *)MAX31875_I2C_SLAVE_ADR_R0; - cfg.irq_pin.pin = RT_PIN_NONE; + cfg.irq_pin.pin = PIN_IRQ_PIN_NONE; rt_hw_max31875_init("max31875", &cfg); return 0; @@ -175,7 +175,7 @@ int rt_hw_bmx055_port(void) struct rt_sensor_config cfg; cfg.intf.dev_name = "i2c2"; cfg.intf.user_data = (void *)0; - cfg.irq_pin.pin = RT_PIN_NONE; + cfg.irq_pin.pin = PIN_IRQ_PIN_NONE; rt_hw_bmx055_init("bmx055", &cfg); return 0; diff --git a/bsp/nuvoton/numaker-m467hj/board/board_dev.c b/bsp/nuvoton/numaker-m467hj/board/board_dev.c index e1399a6cbf..6d405e6538 100644 --- a/bsp/nuvoton/numaker-m467hj/board/board_dev.c +++ b/bsp/nuvoton/numaker-m467hj/board/board_dev.c @@ -347,7 +347,7 @@ int rt_hw_nct7717u_port(void) struct rt_sensor_config cfg; cfg.intf.dev_name = "i2c2"; - cfg.irq_pin.pin = RT_PIN_NONE; + cfg.irq_pin.pin = PIN_IRQ_PIN_NONE; return rt_hw_nct7717u_init("nct7717u", &cfg); } diff --git a/bsp/nuvoton/numaker-pfm-m487/board/board_dev.c b/bsp/nuvoton/numaker-pfm-m487/board/board_dev.c index 72d2ad1ff7..25d3c1cd78 100644 --- a/bsp/nuvoton/numaker-pfm-m487/board/board_dev.c +++ b/bsp/nuvoton/numaker-pfm-m487/board/board_dev.c @@ -183,7 +183,7 @@ int rt_hw_max31875_port(void) cfg.intf.dev_name = "i2c1"; cfg.intf.user_data = (void *)MAX31875_I2C_SLAVE_ADR_R0; - cfg.irq_pin.pin = RT_PIN_NONE; + cfg.irq_pin.pin = PIN_IRQ_PIN_NONE; rt_hw_max31875_init("max31875", &cfg); return 0; @@ -199,7 +199,7 @@ int rt_hw_mpu6500_port(void) cfg.intf.dev_name = "i2c2"; cfg.intf.user_data = (void *)MPU6XXX_ADDR_DEFAULT; - cfg.irq_pin.pin = RT_PIN_NONE; + cfg.irq_pin.pin = PIN_IRQ_PIN_NONE; rt_hw_mpu6xxx_init("mpu", &cfg); return 0; diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/sensor_port.c b/bsp/stm32/stm32l475-atk-pandora/board/ports/sensor_port.c index 887d18444e..2b3c3f584f 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/sensor_port.c +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/sensor_port.c @@ -20,7 +20,7 @@ static int rt_hw_icm20608_port(void) cfg.intf.dev_name = "i2c3"; cfg.intf.type = RT_SENSOR_INTF_I2C; cfg.intf.arg = (void *)MPU6XXX_ADDR_DEFAULT; - cfg.irq_pin.pin = RT_PIN_NONE; + cfg.irq_pin.pin = PIN_IRQ_PIN_NONE; rt_hw_mpu6xxx_init("icm", &cfg); @@ -39,7 +39,7 @@ static int rt_hw_ap3216c_port(void) cfg.intf.dev_name = "i2c3"; cfg.intf.type = RT_SENSOR_INTF_I2C; cfg.intf.arg = RT_NULL; - cfg.irq_pin.pin = RT_PIN_NONE; + cfg.irq_pin.pin = PIN_IRQ_PIN_NONE; rt_hw_ap3216c_init("ap3216c", &cfg); @@ -58,7 +58,7 @@ static int rt_hw_aht10_port(void) cfg.intf.dev_name = "i2c4"; cfg.intf.type = RT_SENSOR_INTF_I2C; cfg.intf.arg = (void *)AHT10_I2C_ADDR; - cfg.irq_pin.pin = RT_PIN_NONE; + cfg.irq_pin.pin = PIN_IRQ_PIN_NONE; rt_hw_aht10_init("aht10", &cfg); diff --git a/components/drivers/include/drivers/sensor.h b/components/drivers/include/drivers/sensor.h index f1bdf0c600..30d114fa47 100644 --- a/components/drivers/include/drivers/sensor.h +++ b/components/drivers/include/drivers/sensor.h @@ -25,7 +25,6 @@ extern "C" { #define rt_sensor_get_ts() rt_tick_get() /* API for the sensor to get the timestamp */ #endif -#define RT_PIN_NONE 0xFFFF /* RT PIN NONE */ #define RT_DEVICE_FLAG_FIFO_RX 0x200 /* Flag to use when the sensor is open by fifo mode */ #define RT_SENSOR_MODULE_MAX (3) /* The maximum number of members of a sensor module */ diff --git a/components/drivers/include/drivers/touch.h b/components/drivers/include/drivers/touch.h index 318f307081..367d132016 100644 --- a/components/drivers/include/drivers/touch.h +++ b/components/drivers/include/drivers/touch.h @@ -24,8 +24,6 @@ extern "C" { #define rt_touch_get_ts() rt_tick_get() /* API for the touch to get the timestamp */ #endif -#define RT_PIN_NONE 0xFFFF /* RT PIN NONE */ - /* Touch vendor types */ #define RT_TOUCH_VENDOR_UNKNOWN (0) /* unknown */ #define RT_TOUCH_VENDOR_GT (1) /* GTxx series */ diff --git a/components/drivers/sensor/sensor.c b/components/drivers/sensor/sensor.c index e877237621..a3d84d670f 100644 --- a/components/drivers/sensor/sensor.c +++ b/components/drivers/sensor/sensor.c @@ -96,7 +96,7 @@ static void _irq_callback(void *args) /* Sensor interrupt initialization function */ static rt_err_t _sensor_irq_init(rt_sensor_t sensor) { - if (sensor->config.irq_pin.pin == RT_PIN_NONE) + if (sensor->config.irq_pin.pin == PIN_IRQ_PIN_NONE) { return -RT_EINVAL; } @@ -269,7 +269,7 @@ static rt_err_t _sensor_close(rt_device_t dev) if (RT_SENSOR_MODE_GET_FETCH(sensor->info.mode) != RT_SENSOR_MODE_FETCH_POLLING) { /* Sensor disable interrupt */ - if (sensor->config.irq_pin.pin != RT_PIN_NONE) + if (sensor->config.irq_pin.pin != PIN_IRQ_PIN_NONE) { rt_pin_irq_enable(sensor->config.irq_pin.pin, RT_FALSE); } diff --git a/components/drivers/touch/touch.c b/components/drivers/touch/touch.c index 2b292e3ec0..6f5b73a7cb 100644 --- a/components/drivers/touch/touch.c +++ b/components/drivers/touch/touch.c @@ -43,7 +43,7 @@ static void touch_irq_callback(void *param) static rt_err_t rt_touch_irq_init(rt_touch_t touch) { #ifdef RT_TOUCH_PIN_IRQ - if (touch->config.irq_pin.pin == RT_PIN_NONE) + if (touch->config.irq_pin.pin == PIN_IRQ_PIN_NONE) { return -RT_EINVAL; } @@ -73,7 +73,7 @@ static rt_err_t rt_touch_irq_init(rt_touch_t touch) static void rt_touch_irq_enable(rt_touch_t touch) { #ifdef RT_TOUCH_PIN_IRQ - if (touch->config.irq_pin.pin != RT_PIN_NONE) + if (touch->config.irq_pin.pin != PIN_IRQ_PIN_NONE) { rt_pin_irq_enable(touch->config.irq_pin.pin, RT_TRUE); } @@ -86,7 +86,7 @@ static void rt_touch_irq_enable(rt_touch_t touch) static void rt_touch_irq_disable(rt_touch_t touch) { #ifdef RT_TOUCH_PIN_IRQ - if (touch->config.irq_pin.pin != RT_PIN_NONE) + if (touch->config.irq_pin.pin != PIN_IRQ_PIN_NONE) { rt_pin_irq_enable(touch->config.irq_pin.pin, RT_FALSE); }