|
发表于 2016-9-9 10:33:15
|
显示全部楼层
本帖最后由 Super169 于 2016-9-13 12:06 编辑
你想太多了, 在 arudino 的 serial 輸出是沒有媛沖的.
不好意思, 這是錯誤的. 把原文改暗, 以免再誤導他人.
源碼中的說明是針對 incoming serial data:
// Define constants and variables for buffering incoming serial data. We're
// using a ring buffer (I think), in which head is the index of the location
// to which to write the next incoming character and tail is the index of the
// location from which to read.
但原來 對輸入 輸出 都有設定的, 是我自己沒看清楚, 攪錯了, 還誤導你了.
- #if defined(USBCON)
- ring_buffer rx_buffer = { { 0 }, 0, 0};
- ring_buffer tx_buffer = { { 0 }, 0, 0};
- #endif
- #if defined(UBRRH) || defined(UBRR0H)
- ring_buffer rx_buffer = { { 0 }, 0, 0 };
- ring_buffer tx_buffer = { { 0 }, 0, 0 };
- #endif
- #if defined(UBRR1H)
- ring_buffer rx_buffer1 = { { 0 }, 0, 0 };
- ring_buffer tx_buffer1 = { { 0 }, 0, 0 };
- #endif
- #if defined(UBRR2H)
- ring_buffer rx_buffer2 = { { 0 }, 0, 0 };
- ring_buffer tx_buffer2 = { { 0 }, 0, 0 };
- #endif
- #if defined(UBRR3H)
- ring_buffer rx_buffer3 = { { 0 }, 0, 0 };
- ring_buffer tx_buffer3 = { { 0 }, 0, 0 };
- #endif
复制代码 |
|