mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
GPIO driver: Add an IOCTL command to get the pin type
This commit is contained in:
@@ -211,6 +211,21 @@ static int gpio_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* Command: GPIOC_PINTYPE
|
||||||
|
* Description: Return the GPIO pin type.
|
||||||
|
* Argument: A pointer to an instance of type enum gpio_pintype_e
|
||||||
|
*/
|
||||||
|
|
||||||
|
case GPIOC_PINTYPE:
|
||||||
|
{
|
||||||
|
FAR enum gpio_pintype_e *ptr = (FAR enum gpio_pintype_e *)((uintptr_t)arg);
|
||||||
|
DEBUGASSERT(ptr != NULL);
|
||||||
|
|
||||||
|
*ptr = dev->gp_pintype;
|
||||||
|
ret = OK;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
/* Command: GPIOC_REGISTER
|
/* Command: GPIOC_REGISTER
|
||||||
* Description: Register to receive a signal whenever there an
|
* Description: Register to receive a signal whenever there an
|
||||||
* interrupt is received on an input gpio pin. This
|
* interrupt is received on an input gpio pin. This
|
||||||
|
|||||||
@@ -60,6 +60,10 @@
|
|||||||
* Argument: A pointer to an bool value to receive the result:
|
* Argument: A pointer to an bool value to receive the result:
|
||||||
* false=low value; true=high value.
|
* false=low value; true=high value.
|
||||||
*
|
*
|
||||||
|
* Command: GPIOC_PINTYPE
|
||||||
|
* Description: Return the GPIO pin type.
|
||||||
|
* Argument: A pointer to an instance of type enum gpio_pintype_e
|
||||||
|
*
|
||||||
* Command: GPIOC_REGISTER
|
* Command: GPIOC_REGISTER
|
||||||
* Description: Register to receive a signal whenever there an interrupt
|
* Description: Register to receive a signal whenever there an interrupt
|
||||||
* is received on an input gpio pin. This feature, of course,
|
* is received on an input gpio pin. This feature, of course,
|
||||||
@@ -70,7 +74,8 @@
|
|||||||
|
|
||||||
#define GPIOC_WRITE _GPIOC(1)
|
#define GPIOC_WRITE _GPIOC(1)
|
||||||
#define GPIOC_READ _GPIOC(2)
|
#define GPIOC_READ _GPIOC(2)
|
||||||
#define GPIOC_REGISTER _GPIOC(3)
|
#define GPIOC_PINTYPE _GPIOC(3)
|
||||||
|
#define GPIOC_REGISTER _GPIOC(4)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Types
|
* Public Types
|
||||||
|
|||||||
Reference in New Issue
Block a user