Skip to content

Commit

Permalink
Fixed timeout in _rxraw
Browse files Browse the repository at this point in the history
  • Loading branch information
totalspectrum committed Aug 29, 2023
1 parent a268733 commit 40fd35a
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Version 6.4.0
- Fixed some quirks in the space/tab warning code
- Fixed incorrect expansion of field[ptr][n]~~
- Fixed an incompatibility between _tx and debug()
- Fixed timeout in _rxraw() (test was wrong way around)
- Improved range of sin and cos functions
- Improved performance of flash access in littlefs (thanks, Evan!)
- Updated -gbrk code to most recent from Chip, and add support for brk #0 interactive debug (thanks, Ada!)
Expand Down
2 changes: 1 addition & 1 deletion sys/nucode_util.spin
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ pri _rxraw(timeout = 0) : rxbyte = long | z, endtime, temp2, rxpin
rxbyte := _rdpin(rxpin)>>24
quit
if timeout
if _getcnt() - endtime < 0
if endtime - _getcnt() < 0
quit

''
Expand Down
4 changes: 2 additions & 2 deletions sys/nucode_util.spin.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sys/p1_code.spin
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ pri _rxraw(timeout = 0) | val, waitcycles, i, bitcycles
repeat
if ina[_rxpin] == 0
quit
if waitcycles - cnt < 0
if cnt - waitcycles < 0
return -1
else
repeat until ina[_rxpin] == 0
Expand Down
6 changes: 3 additions & 3 deletions sys/p1_code.spin.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sys/p2_code.spin
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ pri _rxraw(timeout = 0) : rxbyte = long | z, endtime, temp2, rxpin
if_z shr temp2, #32 - 28
.breakone
endasm
until z or (timeout and (_getcnt() - endtime < 0))
until z or (timeout and (endtime - _getcnt() < 0))
if z
rxbyte := temp2 & $ff
_rx_temp := temp2
Expand Down
4 changes: 2 additions & 2 deletions sys/p2_code.spin.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 40fd35a

Please sign in to comment.