瀏覽代碼

Fix off-by-1 error in new Serial#.room()

teensy4-core
PaulStoffregen 10 年之前
父節點
當前提交
603afcc984
共有 3 個文件被更改,包括 6 次插入6 次删除
  1. +2
    -2
      teensy3/serial1.c
  2. +2
    -2
      teensy3/serial2.c
  3. +2
    -2
      teensy3/serial3.c

+ 2
- 2
teensy3/serial1.c 查看文件

@@ -222,8 +222,8 @@ int serial_room(void)

head = tx_buffer_head;
tail = tx_buffer_tail;
if (head >= tail) return TX_BUFFER_SIZE - head + tail;
return tail - head;
if (head >= tail) return TX_BUFFER_SIZE - 1 - head + tail;
return tail - head - 1;
}

int serial_available(void)

+ 2
- 2
teensy3/serial2.c 查看文件

@@ -183,8 +183,8 @@ int serial2_room(void)

head = tx_buffer_head;
tail = tx_buffer_tail;
if (head >= tail) return TX_BUFFER_SIZE - head + tail;
return tail - head;
if (head >= tail) return TX_BUFFER_SIZE - 1 - head + tail;
return tail - head - 1;
}

int serial2_available(void)

+ 2
- 2
teensy3/serial3.c 查看文件

@@ -177,8 +177,8 @@ int serial3_room(void)

head = tx_buffer_head;
tail = tx_buffer_tail;
if (head >= tail) return TX_BUFFER_SIZE - head + tail;
return tail - head;
if (head >= tail) return TX_BUFFER_SIZE - 1 - head + tail;
return tail - head - 1;
}

int serial3_available(void)

Loading…
取消
儲存