Skip to content

Commit 761a244

Browse files
committed
gpio: enable realtime timestamps for line events in cdev2 impl
fixes #60.
1 parent 6bfa04a commit 761a244

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

periphery/gpio_cdev2.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ class Cdev2GPIO(GPIO):
121121
_GPIO_V2_LINE_FLAG_BIAS_PULL_UP = 0x100
122122
_GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN = 0x200
123123
_GPIO_V2_LINE_FLAG_BIAS_DISABLED = 0x400
124+
_GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME = 0x800
124125

125126
SUPPORTED = KERNEL_VERSION >= (5, 10)
126127

@@ -257,6 +258,7 @@ def _reopen(self, direction, edge, bias, drive, inverted):
257258

258259
if direction == "in":
259260
flags |= Cdev2GPIO._GPIO_V2_LINE_FLAG_EDGE_RISING if edge == "rising" else Cdev2GPIO._GPIO_V2_LINE_FLAG_EDGE_FALLING if edge == "falling" else (Cdev2GPIO._GPIO_V2_LINE_FLAG_EDGE_RISING | Cdev2GPIO._GPIO_V2_LINE_FLAG_EDGE_FALLING) if edge == "both" else 0
261+
flags |= Cdev2GPIO._GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME if edge != "none" else 0
260262

261263
line_request.offsets[0] = self._line
262264
line_request.consumer = self._label

0 commit comments

Comments
 (0)