Pārlūkot izejas kodu

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

main
PaulStoffregen pirms 11 gadiem
vecāks
revīzija
603afcc984
3 mainītis faili ar 6 papildinājumiem un 6 dzēšanām
  1. +2
    -2
      teensy3/serial1.c
  2. +2
    -2
      teensy3/serial2.c
  3. +2
    -2
      teensy3/serial3.c

+ 2
- 2
teensy3/serial1.c Parādīt failu



head = tx_buffer_head; head = tx_buffer_head;
tail = tx_buffer_tail; 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) int serial_available(void)

+ 2
- 2
teensy3/serial2.c Parādīt failu



head = tx_buffer_head; head = tx_buffer_head;
tail = tx_buffer_tail; 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) int serial2_available(void)

+ 2
- 2
teensy3/serial3.c Parādīt failu



head = tx_buffer_head; head = tx_buffer_head;
tail = tx_buffer_tail; 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) int serial3_available(void)

Notiek ielāde…
Atcelt
Saglabāt