Capture adds the function of edges counting
Description: Add the function of counting cap edges Signed-off-by: zhangkai25 <zhangkai25@xiaomi.com>
This commit is contained in:
parent
25a6c0d6d8
commit
9e388d1d00
|
@ -304,6 +304,18 @@ static int cap_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||
}
|
||||
break;
|
||||
|
||||
/* CAPIOC_EDGES - Get the pwm edges from the capture.
|
||||
* Argument: int32_t pointer to the location to return the edges.
|
||||
*/
|
||||
|
||||
case CAPIOC_EDGES:
|
||||
{
|
||||
FAR uint32_t *ptr = (FAR uint32_t *)((uintptr_t)arg);
|
||||
DEBUGASSERT(lower->ops->getedges != NULL && ptr);
|
||||
ret = lower->ops->getedges(lower, ptr);
|
||||
}
|
||||
break;
|
||||
|
||||
/* Any unrecognized IOCTL commands might be platform-specific ioctl
|
||||
* commands
|
||||
*/
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#define CAPIOC_DUTYCYCLE _CAPIOC(1)
|
||||
#define CAPIOC_FREQUENCE _CAPIOC(2)
|
||||
#define CAPIOC_EDGES _CAPIOC(3)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
|
@ -67,6 +68,11 @@ struct cap_ops_s
|
|||
|
||||
CODE int (*getfreq)(FAR struct cap_lowerhalf_s *lower,
|
||||
FAR uint32_t *freq);
|
||||
|
||||
/* Get the result pwm capture edges value */
|
||||
|
||||
CODE int (*getedges)(FAR struct cap_lowerhalf_s *lower,
|
||||
FAR uint32_t *edges);
|
||||
};
|
||||
|
||||
/* This structure provides the publicly visible representation of the
|
||||
|
|
Loading…
Reference in New Issue