Skip to content
This repository was archived by the owner on Jan 11, 2024. It is now read-only.

Commit 5652977

Browse files
committed
Update event message
Updated the event message to match what `:circuits_gpio` does to have consistency across libraries.
1 parent 1386cd5 commit 5652977

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Circuits.GPIO.Chip.listen_event("gpiochip0", 27)
9090
When an event is received from the line it will be in the form of:
9191

9292
```
93-
{:circuits_cdev, pin_number, new_value, timestamp}
93+
{:circuits_cdev, pin_number, timestamp, new_value}
9494
```
9595

9696

lib/chip/events.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,16 @@ defmodule Circuits.GPIO.Chip.Events do
5050
%Event{
5151
handle: event_handle,
5252
listener: listener,
53-
last_event: last_event
53+
last_event: last_event,
54+
offset: offset
5455
} = event = Map.fetch!(state, event_ref)
5556

5657
{:ok, event_value, timestamp} = Nif.read_event_data_nif(event_handle, event_data_ref)
5758

5859
if event_value != last_event do
5960
send(
6061
listener,
61-
{:circuits_gpio_chip, :event, event_value_to_offset_value(event_value), timestamp}
62+
{:circuits_cdev, offset, timestamp, event_value_to_offset_value(event_value)}
6263
)
6364
end
6465

0 commit comments

Comments
 (0)