drivers/qencoder: add an interface to configure the encoder index pin position
This commit is contained in:
parent
5a4140f020
commit
bf23abfbd5
@ -328,6 +328,24 @@ static int qe_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* QEIOC_SETINDEX - Set the index pin position
|
||||||
|
* Argument: uint32
|
||||||
|
*/
|
||||||
|
|
||||||
|
case QEIOC_SETINDEX:
|
||||||
|
{
|
||||||
|
uint32_t indexpos = (uint32_t)arg;
|
||||||
|
if (lower->ops->setindex != NULL)
|
||||||
|
{
|
||||||
|
ret = lower->ops->setindex(lower, indexpos);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = -ENOTTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
/* Any unrecognized IOCTL commands might be platform-specific ioctl
|
/* Any unrecognized IOCTL commands might be platform-specific ioctl
|
||||||
* commands
|
* commands
|
||||||
*/
|
*/
|
||||||
|
@ -57,9 +57,10 @@
|
|||||||
#define QEIOC_POSITION _QEIOC(0x0001) /* Arg: int32_t* pointer */
|
#define QEIOC_POSITION _QEIOC(0x0001) /* Arg: int32_t* pointer */
|
||||||
#define QEIOC_RESET _QEIOC(0x0002) /* Arg: None */
|
#define QEIOC_RESET _QEIOC(0x0002) /* Arg: None */
|
||||||
#define QEIOC_SETPOSMAX _QEIOC(0x0003) /* Arg: uint32_t */
|
#define QEIOC_SETPOSMAX _QEIOC(0x0003) /* Arg: uint32_t */
|
||||||
|
#define QEIOC_SETINDEX _QEIOC(0x0004) /* Arg: uint32_t */
|
||||||
|
|
||||||
#define QE_FIRST 0x0001 /* First required command */
|
#define QE_FIRST 0x0001 /* First required command */
|
||||||
#define QE_NCMDS 3 /* Two required commands */
|
#define QE_NCMDS 4 /* 4 required commands */
|
||||||
|
|
||||||
/* User defined ioctl commands are also supported. These will be forwarded
|
/* User defined ioctl commands are also supported. These will be forwarded
|
||||||
* by the upper-half QE driver to the lower-half QE driver via the ioctl()
|
* by the upper-half QE driver to the lower-half QE driver via the ioctl()
|
||||||
@ -120,6 +121,10 @@ struct qe_ops_s
|
|||||||
|
|
||||||
CODE int (*reset)(FAR struct qe_lowerhalf_s *lower);
|
CODE int (*reset)(FAR struct qe_lowerhalf_s *lower);
|
||||||
|
|
||||||
|
/* Set the index pin position */
|
||||||
|
|
||||||
|
CODE int (*setindex)(FAR struct qe_lowerhalf_s *lower, uint32_t pos);
|
||||||
|
|
||||||
/* Lower-half logic may support platform-specific ioctl commands */
|
/* Lower-half logic may support platform-specific ioctl commands */
|
||||||
|
|
||||||
CODE int (*ioctl)(FAR struct qe_lowerhalf_s *lower,
|
CODE int (*ioctl)(FAR struct qe_lowerhalf_s *lower,
|
||||||
|
Loading…
Reference in New Issue
Block a user