michallenc commented on code in PR #17510:
URL: https://github.com/apache/nuttx/pull/17510#discussion_r2622335090
##########
drivers/ioexpander/gpio.c:
##########
@@ -576,6 +576,31 @@ static int gpio_ioctl(FAR struct file *filep, int cmd,
unsigned long arg)
}
break;
+ /* Command: GPIOC_SETDEBOUNCE
+ * Description: Set the GPIO pin debounce duration.
+ * Argument: The duration of the channel debounce, uint is ns.
+ */
+
+ case GPIOC_SETDEBOUNCE:
+ {
+ DEBUGASSERT(dev->gp_ops->go_setdebounce != NULL);
+ ret = dev->gp_ops->go_setdebounce(dev, arg);
+ break;
+ }
+
+ /* Command: GPIOC_SETMASK
+ * Description: Set the GPIO pin type.
+ * Argument: Whether to enable interrupt mask.
+ */
+
+ case GPIOC_SETMASK:
+ {
+ bool mask = (bool)arg;
+ DEBUGASSERT(dev->gp_ops->go_setmask != NULL);
+ ret = dev->gp_ops->go_setmask(dev, mask);
Review Comment:
Is a separate function necessary? I think we could you `go_enable` here.
##########
include/nuttx/ioexpander/gpio.h:
##########
@@ -70,14 +70,24 @@
* Description: Set the GPIO pin type.
* Argument: The enum gpio_pintype_e type.
*
+ * Command: GPIOC_SETDEBOUNCE
+ * Description: Set the channel debounce duration
+ * Argument: The duration of the channel debounce, unit is ns.
+
+ * Command: GPIOC_SETMASK
Review Comment:
I am not sure about `GPIOC_SETMASK` name here, would put interrupt into it.
Maybe `GPIOC_IRQ_SETMASK` or
even just `GPIOC_IRQ_ENABLE`?
##########
include/nuttx/ioexpander/gpio.h:
##########
@@ -125,6 +135,8 @@ typedef CODE int (*pin_interrupt_t)(FAR struct gpio_dev_s
*dev, uint8_t pin);
* - go_attach and go_enable. Required only for the GPIO_INTERRUPT_PIN pin
* type. Unused for other pin types, may be NULL.
* - go_setpintype. Required for all pin types.
+ * - go_setdebounce. Required for all pin types.
+ * - go_setmask. Required for all pin types.
Review Comment:
This should be required only for `GPIO_INTERRUPT_PIN` type.
##########
drivers/ioexpander/gpio.c:
##########
@@ -576,6 +576,31 @@ static int gpio_ioctl(FAR struct file *filep, int cmd,
unsigned long arg)
}
break;
+ /* Command: GPIOC_SETDEBOUNCE
+ * Description: Set the GPIO pin debounce duration.
+ * Argument: The duration of the channel debounce, uint is ns.
+ */
+
+ case GPIOC_SETDEBOUNCE:
+ {
+ DEBUGASSERT(dev->gp_ops->go_setdebounce != NULL);
+ ret = dev->gp_ops->go_setdebounce(dev, arg);
+ break;
+ }
+
+ /* Command: GPIOC_SETMASK
+ * Description: Set the GPIO pin type.
Review Comment:
Fixed the description.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]