aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUri Shaked2021-07-16 00:39:30 +0300
committerUri Shaked2021-07-16 00:39:30 +0300
commite019ee8e002f9ff1cbb93d2673e14df7df416120 (patch)
treebe7ac9297aeba9df2337215e99d151c587413012
parent0.16.2 (diff)
downloadavr8js-e019ee8e002f9ff1cbb93d2673e14df7df416120.tar.gz
avr8js-e019ee8e002f9ff1cbb93d2673e14df7df416120.tar.bz2
avr8js-e019ee8e002f9ff1cbb93d2673e14df7df416120.zip
fix(usart): tx / rx complete timing
fix the calculation of cyclesPerChar, which is used to determine when a USART RX/TX operation is marked complete.
Diffstat (limited to '')
-rw-r--r--src/peripherals/usart.ts2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/peripherals/usart.ts b/src/peripherals/usart.ts
index 3ad787d..81451ba 100644
--- a/src/peripherals/usart.ts
+++ b/src/peripherals/usart.ts
@@ -210,7 +210,7 @@ export class AVRUSART {
private get cyclesPerChar() {
const symbolsPerChar = 1 + this.bitsPerChar + this.stopBits + (this.parityEnabled ? 1 : 0);
- return (this.UBRR * this.multiplier + 1) * symbolsPerChar;
+ return (this.UBRR + 1) * this.multiplier * symbolsPerChar;
}
private get UBRR() {