Skip to content

Commit

Permalink
Make modbus library compatible with older versions of Toit. (#13)
Browse files Browse the repository at this point in the history
Fixes #12.
  • Loading branch information
floitsch authored Aug 1, 2022
1 parent 49d2d2b commit c092869
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
4 changes: 2 additions & 2 deletions examples/package.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ packages:
rs485: toit-rs485
toit-rs485:
url: github.com/toitware/toit-rs485
version: 1.0.0
hash: 2e8d0ae08c97a5dcba69b4e438408ef374c2c63f
version: 1.0.1
hash: 854d96a9d27b6ce7325a9698001087b292f4b4b5
4 changes: 2 additions & 2 deletions package.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ prefixes:
packages:
toit-rs485:
url: github.com/toitware/toit-rs485
version: 1.0.0
hash: 2e8d0ae08c97a5dcba69b4e438408ef374c2c63f
version: 1.0.1
hash: 854d96a9d27b6ce7325a9698001087b292f4b4b5
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dependencies:
rs485:
url: github.com/toitware/toit-rs485
version: ^1.0.0
version: ^1.0.1
18 changes: 17 additions & 1 deletion src/bus.toit
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,22 @@ class Modbus:
run:
transactions_.run

/**
A signal synchronization primitive.
This class is a partial copy of the 'Signal' class from the 'monitor' library. Older
versions of Toit don't have that class yet, and for backwards compatilibity we thus
copied it here.
*/
monitor Signal_:
/** Waits until the $condition is satisfied. */
wait [condition] -> none:
await: condition.call

/** Raises the signal, making waiters evaluate their condition. */
raise -> none:


/**
A transaction manager.
Expand All @@ -145,7 +161,7 @@ class TransactionManager_:
max_concurrent_transactions_/int?

transactions_/Map ::= {:}
signal_/monitor.Signal ::= monitor.Signal
signal_/Signal_ ::= Signal_

run_task_ := null
next_id_ := 0
Expand Down

0 comments on commit c092869

Please sign in to comment.