Skip to content

Commit

Permalink
add end for a if in the docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed Dec 19, 2024
1 parent 5dc9f08 commit b91104c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/i2c.jl
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,10 @@ the error code).
```julia
(b, d) = i2c_read_block_data(pi, h, 10)
if b >= 0
# process data
# process data
else
# process read failure
# process read failure
end
```
"""
function i2c_read_block_data(self::Pi, handle, reg)
Expand Down
14 changes: 10 additions & 4 deletions src/pi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,7 @@ then GPIO x is high.
h = notify_open(pi)
if h >= 0
notify_begin(pi, h, 1234)
end
```
"""
function notify_open(self::Pi)
Expand All @@ -780,6 +781,7 @@ The following code starts notifications for GPIO 1, 4,
h = notify_open(pi)
if h >= 0
notify_begin(pi, h, 1234)
end
```
"""
function notify_begin(self::Pi, handle, bits)
Expand All @@ -803,6 +805,7 @@ if h >= 0
# ...
notify_begin(pi, h, 1234)
# ...
end
```
"""
function notify_pause(self::Pi, handle)
Expand All @@ -821,6 +824,7 @@ if h >= 0
# ...
notify_close(pi, h)
# ...
end
```
"""
function notify_close(self::Pi, handle)
Expand Down Expand Up @@ -1284,14 +1288,16 @@ otherwise false.
```julia
if wait_for_edge(pi, 23)
print("Rising edge detected")
print("Rising edge detected")
else
print("wait for edge timed out")
print("wait for edge timed out")
end
if wait_for_edge(pi, 23, PiGPIO.FALLING_EDGE, 5.0)
print("Falling edge detected")
print("Falling edge detected")
else
print("wait for falling edge timed out")
print("wait for falling edge timed out")
end
```
"""
function wait_for_edge(self::Pi, user_gpio, edge=RISING_EDGE, wait_timeout=60.0)
Expand Down
11 changes: 7 additions & 4 deletions src/spiSerial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@ the error code).
```julia
(b, d) = spi_read(pi, h, 60) # read 60 bytes from device h
if b == 60
# process read data
# process read data
else
# error path
# error path
end
```
"""
function spi_read(self::Pi, handle, count)
Expand Down Expand Up @@ -296,7 +297,8 @@ the error code).
```julia
(b, d) = serial_read(pi, h2, 100)
if b > 0
# process read data
# process read data
end
```
"""
function serial_read(self::Pi, handle, count)
Expand Down Expand Up @@ -349,7 +351,8 @@ device associated with handle.
rdy = serial_data_available(pi, h1)
if rdy > 0
(b, d) = serial_read(pi, h1, rdy)
(b, d) = serial_read(pi, h1, rdy)
end
```
"""
function serial_data_available(self::Pi, handle)
Expand Down

0 comments on commit b91104c

Please sign in to comment.