Skip to content

Commit

Permalink
Use more general way of counting time
Browse files Browse the repository at this point in the history
  • Loading branch information
mdclyburn committed Sep 19, 2019
1 parent 5d320d0 commit 89d2334
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/usci-uart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ namespace mardev::msp430::usci::uart
}

void wait_for_idle(const uart::Module module,
const uint16_t delay)
const uint16_t count,
const uint16_t ticks_per_count)
{
while(true)
{
timer::delay(delay);
timer::delay(count, ticks_per_count, timer::TASSEL::ACLK);
if(errors(module))
clear_errors(module);
else
Expand Down
6 changes: 4 additions & 2 deletions src/usci-uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,12 @@ namespace mardev::msp430::usci::uart
* If errors are detected (peripheral transmitted something), clears them and restarts the wait.
*
* \param module USCI module to await an idle state for.
* \param delay Milliseconds of idle time necessary to satisfy the condition.
* \param count Number of counts to wait for.
* \param ticks_per_count Number of ACLK ticks per count.
*/
void wait_for_idle(const Module module,
const uint16_t delay);
const uint16_t count,
const uint16_t ticks_per_count);
}

#endif

0 comments on commit 89d2334

Please sign in to comment.